as.predictions.frame | R Documentation |
predictions.frame
from a data.frame
, ensuring that the correct
columns are present.Creates a predictions.frame
from a data.frame
by adding the
class
predictions.frame
to it, and renaming the columns containing
the predictions
, se
, est.status
and error.intervals
.
as.predictions.frame(data, classify = NULL,
predictions = NULL, se = NULL, est.status = NULL,
interval.type = NULL, interval.names = NULL)
data |
A |
classify |
A |
predictions |
A |
se |
A |
est.status |
A |
interval.type |
A |
interval.names |
A |
An S3-class predictions.frame
.
Chris Brien
asremlPlus-package
, predictions.frame
,
is.predictions.frame
, predictions.frame
,
validPredictionsFrame
data(Oats.dat)
## Use asreml to get predictions and associated statistics
## Not run:
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",
sed=TRUE)
if (getASRemlVersionLoaded(nchar = 1) == "3")
Var.pred <- Var.pred$predictions
#Form predictions.frame changing asreml-R4 names to the standard names, if these are present
Var.preds <- as.predictions.frame(Var.pred$pvals, se = "std.error",
est.status = "status")
## End(Not run)
## Use lmerTest and emmmeans to get predictions and associated statistics
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.preds <- summary(Var.emm)
Var.preds <- as.predictions.frame(Var.preds, predictions = "emmean",
se = "SE", interval.type = "CI",
interval.names = c("lower.CL", "upper.CL"))
}
## Check the class and validity of the alldiffs object
if (exists("Var.preds"))
{
is.predictions.frame(Var.preds)
validPredictionsFrame(Var.preds)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.