linear2btl.Rd
Transforms linear model coefficients to Bradley-Terry-Luce (BTL) model parameter estimates.
linear2btl(object, order = FALSE)
object | an object of class |
---|---|
order | logical, does the model include an order effect? Defaults to FALSE |
The design matrix used by glm
or lm
usually results from
a call to pcX
. It is assumed that the reference category is
the first level. The covariance matrix is estimated by employing the delta
method. See Imrey, Johnson, and Koch (1976) for more details.
a matrix; the first column holds the BTL parameter estimates, the second column the approximate standard errors
the approximate covariance matrix of the BTL parameter estimates
a vector of the original linear coefficients as returned
by glm
or lm
Imrey, P.B., Johnson, W.D., & Koch, G.G. (1976). An incomplete contingency table approach to paired-comparison experiments. Journal of the American Statistical Association, 71, 614--623. doi: 10.2307/2285591
data(drugrisk) y1 <- t(drugrisk[, , 1])[lower.tri(drugrisk[, , 1])] y0 <- drugrisk[, , 1][ lower.tri(drugrisk[, , 1])] ## Fit BTL model using glm (maximum likelihood) btl.glm <- glm(cbind(y1, y0) ~ 0 + pcX(6), binomial) linear2btl(btl.glm)#> $btl.parameters #> estimate se #> 0.019008209 0.004754588 #> pcX(6)1 0.014786508 0.003805432 #> pcX(6)2 0.009350402 0.002539089 #> pcX(6)3 0.167877536 0.029825405 #> pcX(6)4 0.604458817 0.053500761 #> pcX(6)5 0.184518527 0.032155050 #> #> $cova #> h #> h 2.260610e-05 1.163555e-05 7.658454e-06 4.320552e-05 -1.278855e-04 #> 1.163555e-05 1.448131e-05 6.253761e-06 3.372737e-05 -9.947951e-05 #> 7.658454e-06 6.253761e-06 6.446971e-06 2.138760e-05 -6.290748e-05 #> 4.320552e-05 3.372737e-05 2.138760e-05 8.895548e-04 -1.214332e-03 #> -1.278855e-04 -9.947951e-05 -6.290748e-05 -1.214332e-03 2.862331e-03 #> 4.277986e-05 3.338151e-05 2.116070e-05 2.264572e-04 -1.357726e-03 #> #> h 4.277986e-05 #> 3.338151e-05 #> 2.116070e-05 #> 2.264572e-04 #> -1.357726e-03 #> 1.033947e-03 #> #> $linear.coefs #> pcX(6)1 pcX(6)2 pcX(6)3 pcX(6)4 pcX(6)5 #> -0.2511558 -0.7094516 2.1783638 3.4594626 2.2728789 #>## Fit BTL model using lm (weighted least squares) btl.lm <- lm(log(y1/y0) ~ 0 + pcX(6), weights=y1*y0/(y1 + y0)) linear2btl(btl.lm)#> $btl.parameters #> estimate se #> 0.02268394 0.005231406 #> pcX(6)1 0.01818484 0.004549953 #> pcX(6)2 0.01244278 0.003256660 #> pcX(6)3 0.16018025 0.029897451 #> pcX(6)4 0.59402701 0.053218843 #> pcX(6)5 0.19248117 0.033218284 #> #> $cova #> h #> h 2.736761e-05 1.441924e-05 1.010296e-05 3.154721e-05 -1.187031e-04 #> 1.441924e-05 2.070207e-05 9.140673e-06 2.082393e-05 -9.412027e-05 #> 1.010296e-05 9.140673e-06 1.060583e-05 1.168456e-05 -6.197128e-05 #> 3.154721e-05 2.082393e-05 1.168456e-05 8.938576e-04 -1.163586e-03 #> -1.187031e-04 -9.412027e-05 -6.197128e-05 -1.163586e-03 2.832245e-03 #> 3.526607e-05 2.903435e-05 2.043726e-05 2.056726e-04 -1.393865e-03 #> #> h 3.526607e-05 #> 2.903435e-05 #> 2.043726e-05 #> 2.056726e-04 #> -1.393865e-03 #> 1.103454e-03 #> #> $linear.coefs #> pcX(6)1 pcX(6)2 pcX(6)3 pcX(6)4 pcX(6)5 #> -0.2210691 -0.6005164 1.9546424 3.2652675 2.1383410 #>