View source: R/asremlPlusUtilities.r
isCompoundSymmetric.matrix | R Documentation |
Tests whether an object of class matrix
is compound symmetric by checking whether all diagonal elements are equal and all off-diagonal elements are equal.
## S3 method for class 'matrix'
isCompoundSymmetric(object, tol = 100 * .Machine$double.eps, ...)
object |
An |
tol |
a |
... |
Provision for passing arguments to functions called internally - not used at present. |
A logical
.
Chris Brien
isSymmetric
data(Oats.dat)
## Not run:
## Use asreml to get the variance matrix of a set of predictions
m1.asr <- asreml(Yield ~ Nitrogen*Variety,
random=~Blocks/Wplots,
data=Oats.dat)
current.asrt <- as.asrtests(m1.asr)
Var.pred <- asreml::predict.asreml(m1.asr, classify="Nitrogen:Variety",
vcov = TRUE)
est.status = "status")
isCompoundSymmetrix(Var.pred$vcov)
## End(Not run)
## Use lmerTest and emmmeans to get the variance matrix of a set of predictions
if (requireNamespace("lmerTest", quietly = TRUE) &
requireNamespace("emmeans", quietly = TRUE))
{
m1.lmer <- lmerTest::lmer(Yield ~ Nitrogen*Variety + (1|Blocks/Wplots),
data=Oats.dat)
Var.emm <- emmeans::emmeans(m1.lmer, specs = ~ Nitrogen:Variety)
Var.vcov <- vcov(Var.emm)
}
if (exists("Var.vcov"))
{
## Check the variance matrix of the predictions is compound symmetric
isCompoundSymmetric(Var.vcov)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.