colvarcomps.mom: Many moment and maximum likelihood estimations of variance... In Rfast: A Collection of Efficient and Extremely Fast R Functions

Description

Many moment and maximum likelihood estimations of variance components.

Usage

 1 2 3 colvarcomps.mom(x, id, parallel = FALSE) colvarcomps.mle(x, id, ranef = FALSE, tol= 1e-08, maxiters = 100, parallel = FALSE)

Arguments

 x A matrix with the data, where each column refers to a different sample of subjects. id A numerical vector indicating the subject. You must put consecutive numbers and no zero values. Alternatively this can be a factor variable. ranef Do you also want the random effects to be returned? TRUE or FALSE. tol The tolerance level to terminate the golden ratio search. maxiters The maximum number of iterations to perform. parallel Should the computations run in parallel? TRUE or FALSE.

Details

Note that the "colvarcomp.mom" works for balanced designs only, i.e. for each subject the same number of measurements have been taken. The "colvarcomps.mle" works for unbalanced as well.

The variance components, the variance of the between measurements and the variance of the within are estimated using moment estimators. The "colvarcomps.mom" is the moment analogue of a random effects model which uses likelihood estimation ("colvarcomps.mle"). It is much faster, but can give negative variance of the random effects, in which case it becomes zero.

The maximum likelihood version is a bit slower (try youselves to see the difference), but statistically speaking is to be preferred when small samples are available. The reason why it is only a little bit slower and not a lot slower as one would imagine is because we are using a closed formula to calculate the two variance components (Demidenko, 2013, pg. 67-69). Yes, there are closed formulas for linear mixed models.

Value

For the "colvarcomps.mom": A matrix with 5 columns, The MSE, the estimate of the between variance, the variance components ratio and a 95% confidence for the ratio.

For the "colvarcomps.mle": If ranef = FALSE a list with a single component called "info". That is a matrix with 3 columns, The MSE, the estimate of the between variance and the log-likelihood value. If ranef = TRUE a list including "info" and an extra component called "ranef" containing the random effects. It is a matrix with the same number of columns as the data. Each column contains the randome effects of each variable.

Michail Tsagris

References

D.C. Montgomery (2001). Design and analysis of experiments (5th Edition). New York: John Wiley \& Sons.

Charles S. Davis (2002). Statistical methods for the analysis of repeated measures. New York: Springer-Verlag.

Demidenko E. (2013). Mixed Models: Thoery and Applications with R 2nd Edition). New Jersey: John Wiley \& Sons (Excellent book).