| calibrateType1 | R Documentation | 
Perform a simulation study over one or several sample size to assess the bias of the estimate and the type 1 error of the Wald test and robust Wald test
calibrateType1(object, param, n.rep, ...)
## S3 method for class 'lvm'
calibrateType1(
  object,
  param,
  n.rep,
  n,
  correction = TRUE,
  warmup = NULL,
  null = NULL,
  F.test = FALSE,
  cluster = NULL,
  generative.object = NULL,
  generative.coef = NULL,
  true.coef = NULL,
  n.true = 1e+06,
  round.true = 2,
  bootstrap = FALSE,
  n.bootstrap = 1000,
  checkType1 = FALSE,
  checkType2 = FALSE,
  dir.save = NULL,
  label.file = NULL,
  seed = NULL,
  cpus = 1,
  trace = 2,
  ...
)
## S3 method for class 'lvmfit'
calibrateType1(
  object,
  param,
  n.rep,
  correction = TRUE,
  F.test = FALSE,
  bootstrap = FALSE,
  n.bootstrap = 1000,
  seed = NULL,
  trace = 2,
  cpus = 1,
  ...
)
object | 
 a   | 
param | 
 [character vector] names of the coefficient whose value will be tested.  | 
n.rep | 
 [integer, >0] number of simulations per sample size.  | 
... | 
 [internal] Only used by the generic method.  | 
n | 
 [integer vector, >0] sample size(s) considered in the simulation study.  | 
correction | 
 [logical] should the type 1 error after correction be computed?  | 
warmup | 
 [list of lvm] a list of   | 
null | 
 [numeric vector] vector of null hypotheses, one for each model coefficient. By default a vector of 0.  | 
F.test | 
 [logical] should a multivariate Wald test be perform testing simultaneously all the null hypotheses?  | 
cluster | 
 [integer vector] the grouping variable relative to which the observations are iid.
Will be passed to   | 
generative.object | 
 [lvm] object defining the statistical model generating the data.  | 
generative.coef | 
 [name numeric vector] values for the parameters of the generative model.
Can also be   | 
true.coef | 
 [name numeric vector] expected values for the parameters of the fitted model.  | 
n.true | 
 [integer, >0] sample size at which the estimated coefficients will be a reliable approximation of the true coefficients.  | 
round.true | 
 [integer, >0] the number of decimal places to be used for the true value of the coefficients. No rounding is done if   | 
bootstrap | 
 [logical] should bootstrap resampling be performed?  | 
n.bootstrap | 
 [integer, >0] the number of bootstrap sample to be used for each bootstrap.  | 
checkType1 | 
 [logical] returns an error if the coefficients associated to the null hypotheses do not equal 0.  | 
checkType2 | 
 [logical] returns an error if the coefficients associated to the null hypotheses equal 0.  | 
dir.save | 
 [character] path to the directory were the results should be exported.
Can also be   | 
label.file | 
 [character] element to include in the file name.  | 
seed | 
 [integer, >0] value that will be set before adjustment for multiple comparisons to ensure reproducible results.
Can also be   | 
cpus | 
 [integer >0] the number of processors to use. If greater than 1, the simulations are performed in parallel.  | 
trace | 
 [integer] should the execution of the function be trace. Can be 0, 1 or 2.  | 
An object of class calibrateType1.
Brice Ozenne
link{autoplot.calibrateType1} for a graphical display of the bias or of the type 1 error.
## Not run: 
#### simulate data ####
m.Sim <- lvm(c(Y1[mu1:sigma]~1*eta,
               Y2[mu2:sigma]~1*eta,
               Y3[mu3:sigma]~1*eta,
               eta~beta1*Group+beta2*Gender))
latent(m.Sim) <- ~eta
categorical(m.Sim, labels = c("M","F")) <- ~Gender
d <- lava::sim(m.Sim, 1e2)
#### calibrate type 1 error on the estimated model ####
m <- lvm(Y1~eta,
         Y2~eta,
         Y3~eta,
         eta~Group+Gender)
e <- lava::estimate(m, data = d)
res <- calibrateType1(e, param = "eta~Group", n.rep = 100)
res <- calibrateType1(e, param = c("eta~Group","Y1~eta"), F.test = TRUE, n.rep = 100)
res <- calibrateType1(e, param = "eta~Group", n.rep = 100, cpus = 4)
summary(res)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.