linest.RdCompute linear estimates, i.e. L %*% beta for a range of models. One example of
linear estimates is population means (also known as LSMEANS).
Model object
Either NULL or a matrix with p columns where p is
the number of parameters in the systematic effects in the
model. If NULL then L is taken to be the p times
p identity matrix
Additional arguments; currently not used.
Specification of the parameters estimates for which confidence intervals are to be calculated.
The level of the (asymptotic) confidence interval.
Should confidence interval appear in output.
A dataframe with results from computing the contrasts.
## Make balanced dataset
dat.bal <- expand.grid(list(AA=factor(1:2), BB=factor(1:3), CC=factor(1:3)))
dat.bal$y <- rnorm(nrow(dat.bal))
## Make unbalanced dataset
#   'BB' is nested within 'CC' so BB=1 is only found when CC=1
#   and BB=2,3 are found in each CC=2,3,4
dat.nst <- dat.bal
dat.nst$CC <-factor(c(1,1,2,2,2,2,1,1,3,3,3,3,1,1,4,4,4,4))
mod.bal  <- lm(y ~ AA + BB * CC, data=dat.bal)
mod.nst  <- lm(y ~ AA + BB : CC, data=dat.nst)
L <- LE_matrix(mod.nst, effect=c("BB", "CC"))
linest( mod.nst, L )
#>         estimate  std.error  statistic         df p.value
#>  [1,]  0.0070647  0.2439499  0.0289598 10.0000000  0.9775
#>  [2,]         NA         NA         NA         NA      NA
#>  [3,]         NA         NA         NA         NA      NA
#>  [4,]         NA         NA         NA         NA      NA
#>  [5,]  0.0211182  0.4225336  0.0499800 10.0000000  0.9611
#>  [6,]  1.0559073  0.4225336  2.4989899 10.0000000  0.0315
#>  [7,]         NA         NA         NA         NA      NA
#>  [8,]  0.6592607  0.4225336  1.5602562 10.0000000  0.1498
#>  [9,]  1.1315871  0.4225336  2.6780995 10.0000000  0.0232
#> [10,]         NA         NA         NA         NA      NA
#> [11,] -0.9210848  0.4225336 -2.1799087 10.0000000  0.0543
#> [12,]         NA         NA         NA         NA      NA