estVC  R Documentation 
Estimate model parameters for covariates, genetic variance components and residual effect.
estVC(y, x, v = list(E=diag(length(y))), initpar, nit = 25,
method = c("ML", "REML"), control = list(), hessian = FALSE)
y 
A numeric vector or a numeric matrix of one column (representing a phenotype for instance). 
x 
A data frame or matrix, representing covariates if not missing. 
v 
A list of matrices representing variance components of interest. Note:

initpar 
Optional initial parameter values. When provided, 
nit 
Maximum number of iterations for optimization. Ignored if there are not more than two variance components. 
method 
Either maximum likelihood (ML) or restricted maximum likelihood (REML). 
control 
A list of control parameters to be passed to 
hessian 
Logical. Should a numerically differentiated Hessian matrix be returned? 
The optimization function optim
is adopted in the above function to estimate the parameters and maximum likelihood. Several optimization methods are available for the optimization algorithm in optim
, but we recommend "NelderMead" for the sake of stability. Alternatively, one may choose other options, e.g., "BFGS" to initialize and speed up the estimation procedure and then the procedure will automatically turn to "NelderMead" for final results. If there is only one variance component (other than E
), optimize
will be used for optimization unless initpar
is provided.
Normality is assumed for the random effects. Input data should be free of missing values.
par 
estimates of the model parameters. 
value 
loglikelihood of the model. 
y 
y used. 
x 
associated with x used. 
v 
variance component matrices v used. 
... 
other information. 
Hessian matrix, if requested, pertains to loglikelihood function.
optim
and rem
.
data(miscEx)
## Not run:
# no sex effect
pheno< pdatF8[!is.na(pdatF8$bwt) & !is.na(pdatF8$sex),]
ii< match(rownames(pheno), rownames(gmF8$AA))
v< list(A=gmF8$AA[ii,ii], D=gmF8$DD[ii,ii])
o< estVC(y=pheno$bwt, v=v)
o
# sex as fixed effect
fo< estVC(y=pheno$bwt, x=pheno$sex, v=v)
fo
2*(fo$valueo$value) # loglikelihood test statistic
# sex as random effect
SM< rem(~sex, data=pheno)
ro< estVC(y=pheno$bwt, v=c(v,list(Sex=SM$sex)))
ro
2*(ro$valueo$value) # loglikelihood test statistic
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.