Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/model.matrix.varComp.R

This function extracts the fixed-effect design matrix, random-effect design matrix, or the list of variance-covariance matrices whose weighted sum being the variance-covariance matrix of the response variable.

1 2 | ```
## S3 method for class 'varComp'
model.matrix(object, what = c("fixed", "random", "varcov", "X", "K", "Z"), ...)
``` |

`object` |
A |

`what` |
A character vector (only the first element will be used) specifying what kind of design matrix is requested. See details. |

`...` |
Not used. |

`"fixed"`

and `"X"`

are equivalent, requesting the fixed effect design matrix.

`"random"`

and `"Z"`

are equivalent, requesting the random effect design matrix. Note that this is an equivalent version of the design matrices such that the `tcrossprod`

will be the contribution to the marginal variance-covariance. This is not necessarily the one computed directly from the `random`

argument passed to `varComp`

. These are actually computed from `cholRoot`

of *K* matrices.

`"varcov"`

and `"K"`

are equivalent, requesting the contribution of each random effect to the marginal correlation matrix. These are not necessarily the same value passed to the `varcov`

argument of `varComp`

, because the input value will be treated as the "*G*" matrices when `random`

is not missing, but the result here will always be "*K*" matrices. See `varComp`

for notations.

If `what="fixed"`

or `"X"`

, a single numeric matrix of fixed-effect design matrix.

Otherwise, a list of requested matrices.

See details on possible confusions.

Long Qu

1 2 3 4 5 6 | ```
library(nlme)
data(Oxide)
vcf = varComp(Thickness~Source, Oxide, ~Lot/Wafer)
model.matrix(vcf, 'fixed')
model.matrix(vcf, 'random')
model.matrix(vcf, 'varcov')
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.