compare2 {lavaSearch2} | R Documentation |
Test Linear Hypotheses With Small Sample Correction
Description
Test Linear Hypotheses using Wald statistics in a latent variable model.
Similar to lava::compare
but with small sample correction.
Usage
compare2(
object,
linfct,
rhs,
robust,
cluster,
as.lava,
F.test,
conf.level,
...
)
## S3 method for class 'lvmfit'
compare2(
object,
linfct = NULL,
rhs = NULL,
robust = FALSE,
cluster = NULL,
as.lava = TRUE,
F.test = TRUE,
conf.level = 0.95,
ssc = lava.options()$ssc,
df = lava.options()$df,
...
)
## S3 method for class 'lvmfit2'
compare2(
object,
linfct = NULL,
rhs = NULL,
robust = FALSE,
cluster = NULL,
as.lava = TRUE,
F.test = TRUE,
conf.level = 0.95,
...
)
## S3 method for class 'lvmfit2'
compare(
object,
linfct = NULL,
rhs = NULL,
robust = FALSE,
cluster = NULL,
as.lava = TRUE,
F.test = TRUE,
conf.level = 0.95,
...
)
Arguments
object |
a |
linfct |
[matrix or vector of character] the linear hypotheses to be tested. Same as the argument |
rhs |
[vector] the right hand side of the linear hypotheses to be tested. |
robust |
[logical] should the robust standard errors be used instead of the model based standard errors? |
cluster |
[integer vector] the grouping variable relative to which the observations are iid. |
as.lava |
[logical] should the output be similar to the one return by |
F.test |
[logical] should a joint test be performed? |
conf.level |
[numeric 0-1] level of the confidence intervals. |
... |
additional argument passed to |
ssc |
[character] method used to correct the small sample bias of the variance coefficients: no correction ( |
df |
[character] method used to estimate the degree of freedoms of the Wald statistic: Satterthwaite |
Details
The linfct
argument and rhs
specify the set of linear hypotheses to be tested. They can be written:
linfct * \theta = rhs
where \theta
is the vector of the model coefficients.
The par
argument must contain expression(s) involving the model coefficients.
For example "beta = 0"
or c("-5*beta + alpha = 3","-alpha")
are valid expressions if alpha and beta belong to the set of model coefficients.
A contrast matrix and the right hand side will be generated inside the function.
When directly specified, the contrast matrix must contain as many columns as there are coefficients in the model (mean and variance coefficients).
Each hypothesis correspond to a row in the contrast matrix.
The rhs vector should contain as many elements as there are row in the contrast matrix.
Value
If as.lava=TRUE
an object of class htest
.
Otherwise a data.frame
object.
See Also
createContrast
to create contrast matrices.
estimate2
to obtain lvmfit2
objects.
Examples
#### simulate data ####
set.seed(10)
mSim <- lvm(Y~0.1*X1+0.2*X2)
categorical(mSim, labels = c("a","b","c")) <- ~X1
transform(mSim, Id~Y) <- function(x){1:NROW(x)}
df.data <- lava::sim(mSim, 1e2)
#### with lvm ####
m <- lvm(Y~X1+X2)
e.lvm <- estimate(m, df.data)
compare2(e.lvm, linfct = c("Y~X1b","Y~X1c","Y~X2"))
compare2(e.lvm, linfct = c("Y~X1b","Y~X1c","Y~X2"), robust = TRUE)