covariatemeans {predictmeans} | R Documentation |
Predicted Means of a Linear Model with Covariate Variable(s)
Description
This function obtains predicted means with graph for a new set of covariate values.
Usage
covariatemeans(model, modelterm=NULL, covariate, as.is=FALSE, covariateV=NULL,
data=NULL, level=0.05, Df=NULL, trans=NULL, transOff=0, responsen=NULL, trellis=TRUE,
plotord=NULL, mtitle=NULL, ci=TRUE, point=TRUE, jitterv=0, newwd=TRUE)
Arguments
model |
Model object returned by |
modelterm |
Name (in "quotes") for indicating which factor term's predicted mean to be calculated.
The |
covariate |
Name (in "quotes") of one the covariate variables in the |
as.is |
A logic value to specify wheather or not using original covariate values' rage for graph, the default is FALSE. |
covariateV |
A numeric vector when as.is is FALSE, then covariatemeans will produce the result for |
data |
In some cases, you need to provide the data set used in model fitting, especially when you have applied some variable trnasformation in the model. |
level |
A significant level for calculating confident interval. The default value is 0.05. |
Df |
A degree of freedom for calculating CI of predicted means (you can manually specified ddf here). For the above models, ddf is obtained from the function automatically. |
trans |
A function object for calculating the back transformed means, e.g. |
transOff |
When you use |
responsen |
Name (in "quotes") of the back transformed response variable in the |
trellis |
A logical variable. If set to TRUE (default), a trellis plots of predicted means with CI will be drawn. |
plotord |
A numeric vector specifying the order of plotting for two or three way interaction (e.g.
|
mtitle |
The main title in the graph. |
ci |
A logical variable to indicate whether to print confidence interval. The default value is TRUE. |
point |
A logical variable to indicate whether to print raw data points. The default value is TRUE. |
jitterv |
A degree of jitter in x and y direction in the graph. The default is zero. |
newwd |
A logical variable to indicate whether to print graph in a new window. The default value is TRUE. |
Value
Predicted Means |
A table of predicted means. |
Author(s)
Dongwen Luo, Siva Ganesh and John Koolaard
Examples
library(predictmeans)
data(Oats, package="nlme")
fm <- lme(yield ~ nitro*Variety, random=~1|Block/Variety, data=Oats)
# library(lme4)
# fm <- lmer(yield ~ nitro*Variety+(1|Block/Variety), data=Oats)
covariatemeans(fm, "Variety", covariate="nitro")
covariatemeans(fm, "Variety", covariate="nitro", covariateV=seq(0, 0.6, 0.1))$data