autoplot.lmm | R Documentation |
Display fitted values or residual plot for the mean, variance, and correlation structure. Can also display quantile-quantile plot relative to the normal distribution.
## S3 method for class 'lmm'
autoplot(
object,
type = "fit",
type.residual = NULL,
obs.alpha = 0,
obs.size = c(2, 0.5),
at = NULL,
time.var = NULL,
color = TRUE,
ci = TRUE,
ci.alpha = NULL,
ylim = NULL,
mean.size = c(3, 1),
size.text = 16,
position.errorbar = "identity",
...
)
## S3 method for class 'lmm'
plot(x, ...)
object, x |
a |
type |
[character] the type of plot
|
type.residual |
[character] the type of residual to be used. Not relevant for |
obs.alpha |
[numeric, 0-1] When not NA, transparency parameter used to display the original data by cluster. |
obs.size |
[numeric vector of length 2] size of the point and line for the original data. |
at |
[data.frame] values for the covariates at which to evaluate the fitted values. |
time.var |
[character] x-axis variable for the plot. |
color |
[character] name of the variable in the dataset used to color the curve. |
ci |
[logical] should confidence intervals be displayed? |
ci.alpha |
[numeric, 0-1] When not NA, transparency parameter used to display the confidence intervals. |
ylim |
[numeric vector of length 2] the lower and higher value of the vertical axis. |
mean.size |
[numeric vector of length 2] size of the point and line for the mean trajectory. |
size.text |
[numeric, >0] size of the font used to display text. |
position.errorbar |
[character] relative position of the errorbars. |
... |
arguments passed to the |
A list with two elements
data
: data used to create the graphical display.
plot
: ggplot object.
plot(lmm)
: Graphical Display For Linear Mixed Models
plot.lmm
for other graphical display (residual plots, partial residual plots).
if(require(ggplot2)){
#### simulate data in the long format ####
set.seed(10)
dL <- sampleRem(100, n.times = 3, format = "long")
dL$X1 <- as.factor(dL$X1)
#### fit Linear Mixed Model ####
eCS.lmm <- lmm(Y ~ visit + X1 + X6,
repetition = ~visit|id, structure = "CS", data = dL, df = FALSE)
plot(eCS.lmm, type = "fit")
autoplot(eCS.lmm, type = "fit")$plot + facet_wrap(~X1)
plot(eCS.lmm, type = "qqplot") ## engine.qqplot = "qqtest"
plot(eCS.lmm, type = "qqplot", engine.qqplot = "qqtest")
plot(eCS.lmm, type = "correlation")
plot(eCS.lmm, type = "scatterplot")
plot(eCS.lmm, type = "scatterplot2")
plot(eCS.lmm, type = "partial", type.residual = "visit")
plot(eCS.lmm, type = "partial", type.residual = "X1")
plot(eCS.lmm, type = "partial", type.residual = "X6")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.