View source: R/bootREMLRT.v3.r
bootREMLRT.asreml | R Documentation |
Extracts the REML log likelihood for two asreml
objects
and forms the observed REML ratio statistic. It assumes that the second
asreml
object is the result of fitting a model that is a reduced
version of the model for the first object and is considered to the null model.
Using the mean
and V
, nboot
bootstrap samples of simulated
response values are generated in parallel; that is, ncores
cores are used
and each is used to generate and analyse a sample. The full and reduced models
are fitted to the data and if either analysis fails to converge another sample
is generated and analysed using the current core, with a maximum of
max.retries
attempts to obtain a sample that converges for both analysis.
Thus the maximum number of data sets that will be generated is
nboot
* max.retries
. If a bootstrap sample converges for both analyses,
the REML ratio test statistic is formed for it. The p-value is then calculated
as (k + 1) / (b + 1)
where k
is the number
of simulated ratio test statistics greater than the observed test statistic and
s
is the number of bootstrap samples that were returned.
The function checks that the models do not differ in either their fixed
or sparse models. It also check the difference in the number of variance
parameters between the two fits to the models, taking into account the
bound.exclusions
.
## S3 method for class 'asreml'
bootREMLRT(h0.asreml.obj, h1.asreml.obj,
nboot = 100, max.retries = 5, seed = NULL,
means=NULL, V = NULL, extra.matrix = NULL, ignore.terms = NULL,
fixed.spline.terms = NULL,
bound.exclusions = c("F","B","S","C"),
tolerance = 1E-10, update = TRUE, trace = FALSE,
ncores = 2, ...)
h0.asreml.obj |
|
h1.asreml.obj |
|
nboot |
The number of bootstrap samples to be generated. |
max.retries |
The maximum number of attempts to generate a sample whose analyses converge for both models. |
seed |
A single value, interpreted as an integer, that specifies the
starting value of the random number generator. The "L'Ecuyer-CMRG" random
generator is used and |
means |
The |
V |
The fitted variance |
extra.matrix |
A |
ignore.terms |
A |
fixed.spline.terms |
A |
bound.exclusions |
A |
tolerance |
The value such that eigenvalues less than it are considered to be zero. |
update |
If |
trace |
If |
ncores |
A |
... |
Other arguments that are passed down to the function asreml. Changes to the models are not allowed. Other changes are dangerous and generally should be avoided. |
A list
with the following components:
REMLRT: the observed REML ratio statistic.
p: the bootstrap p-value for the observed test statistic.
DF: the calculated difference in DF for the variance parameters in the two models.
totalunconverged: the total number of unconverged analyses over the simulations.
REMLRT.sim: a numeric
containing the values of the ratio statistics
for the simulated data. It has an attribute called na.action
that
can be retrieved using attr(REMLRT.sim, which = "na.action")
; it
contains a list of the simulation numbers that were abandoned because
max.retries
failed to converge for both models.
nunconverged: the number of unconverged analyses for each bootstrap sample, the
maximum being max.retries
.
A bootstrap sample is generated using a multivariate normal distribution with expected value as
specified by means
and variance matrix given by V
. Each simulated sample
is analysed according to the reduced model and, provided this analysis converges,
according to the full.model. If one of these analyses fails to converge, it is
abandoned and another sample is generated for this simulation. As many as
max.retries
attempts are made to generate a data set for which both analyses
converge. If data set that converges for both analyses is not generated for a
simulation, NA
is returned for that bootstrap sample. Hence, the maximum number
of data sets that will be generated is nboot
* max.retries
and less than
nboot
samples will be generated if a data set that converges for both analyses
is not obtained within max.retries
attempts.
If a bootstrap sample converges for both analyses, the REML ratio test statistic is calculated
as 2(log(REML)_F - log(REML)_R)
.
The DF
is calculated from the information in full.asreml.obj
and
reduced.asreml.obj
. The degrees of freedom are computed as the difference
between the two models in the number of variance parameters whose estimates do
not have a code for bound
specified in bound.exclusions
.
If ASReml-R version 4 is being used then the codes specified in
bound.exclusions
are not restricted to a subset of the default codes, but
a warning is issued if a code other than these is specified.
For ASReml-R version 3, only a subset of the default codes are allowed:
F
(Fixed
), B
(Boundary
), C
(Constrained
)
and S
(Singular
).
Chris Brien
REMLRT.asreml
, infoCriteria.asreml
, newfit.asreml
,
testranfix.asrtests
## Not run:
bootREMLRT(ICV.max, ICV.red, ncores = parallel::detectCores())
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.