# phtest error: Error in solve.default(dvcov)

Hi, and welcome.

Could you post a reproducible example, called a reprex, please?

Also, there's a there's a community guideline concerning homework, FAQ: Homework Policy, that you should be aware of for reference.

How does your case differ from the example in the documentation?

``````library(plm)
data(Wages)
ht <- plm(lwage ~ wks + south + smsa + married + exp + I(exp ^ 2) +
bluecol + ind + union + sex + black + ed |
bluecol + south + smsa + ind + sex + black |
wks + married + union + exp + I(exp ^ 2),
data = Wages, index = 595,
random.method = "ht", model = "random", inst.method = "baltagi")
summary(ht)
#> Oneway (individual) effect Random Effect Model
#>    (Hausman-Taylor's transformation)
#> Instrumental variable estimation
#>    (Baltagi's transformation)
#>
#> Call:
#> plm(formula = lwage ~ wks + south + smsa + married + exp + I(exp^2) +
#>     bluecol + ind + union + sex + black + ed | bluecol + south +
#>     smsa + ind + sex + black | wks + married + union + exp +
#>     I(exp^2), data = Wages, model = "random", random.method = "ht",
#>     inst.method = "baltagi", index = 595)
#>
#> Balanced Panel: n = 595, T = 7, N = 4165
#>
#> Effects:
#>                   var std.dev share
#> idiosyncratic 0.02304 0.15180 0.025
#> individual    0.88699 0.94180 0.975
#> theta: 0.9392
#>
#> Residuals:
#>       Min.    1st Qu.     Median    3rd Qu.       Max.
#> -12.643736  -0.466002   0.043285   0.524739  13.340263
#>
#> Coefficients:
#>                Estimate  Std. Error z-value  Pr(>|z|)
#> (Intercept)  2.9127e+00  2.8365e-01 10.2687 < 2.2e-16 ***
#> wks          8.3740e-04  5.9973e-04  1.3963   0.16263
#> southyes     7.4398e-03  3.1955e-02  0.2328   0.81590
#> smsayes     -4.1833e-02  1.8958e-02 -2.2066   0.02734 *
#> marriedyes  -2.9851e-02  1.8980e-02 -1.5728   0.11578
#> exp          1.1313e-01  2.4710e-03 45.7851 < 2.2e-16 ***
#> I(exp^2)    -4.1886e-04  5.4598e-05 -7.6718 1.696e-14 ***
#> bluecolyes  -2.0705e-02  1.3781e-02 -1.5024   0.13299
#> ind          1.3604e-02  1.5237e-02  0.8928   0.37196
#> unionyes     3.2771e-02  1.4908e-02  2.1982   0.02794 *
#> sexfemale   -1.3092e-01  1.2666e-01 -1.0337   0.30129
#> blackyes    -2.8575e-01  1.5570e-01 -1.8352   0.06647 .
#> ed           1.3794e-01  2.1248e-02  6.4919 8.474e-11 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Total Sum of Squares:    243.04
#> Residual Sum of Squares: 4163.6
#> R-Squared:      0.60945