我正在使用 lme4 中的 lmer 函数分析一个庞大而复杂的数据集。我正在使用格子和点图来生成我的随机效应的毛毛虫图。有没有办法通过我的数据集中的因子或连续变量对我的毛毛虫图进行颜色编码?也使用过 qqmath,我可能只需要帮助理解如何使用“组”参数。这将有助于讨论点。
library("lme4")
data(package = "lme4")
summary(grouseticks)
fit1<-lmer(TICKS~1+(1|LOCATION), grouseticks)
rr1<-ranef(fit1, condVar = TRUE)
dotplot(rr1)
#We get a nice caterpillar plot of intecepts and variances by location, is there any way to color code those
#blue intercept points by another factor, such as year?
Run Code Online (Sandbox Code Playgroud) 我正在创建一个包含多个透视图的面板,每个图显示通过调整复杂回归模型中的预测变量生成的一系列数据。我希望我的 3D 表面由我的 z 变量进行颜色编码,我可以很容易地做到这一点。如何获取此色标并使其覆盖面板中所有图表示的所有 z 变量值的范围,以便可以比较多个透视图之间的色标?
#colorized z scale, only a smidge modified from http://www.inside-r.org/r-doc/graphics/persp
par(bg = "white")
par(mfrow=c(1,2))
x <- seq(-1.95, 1.95, length = 30)
y <- seq(-1.95, 1.95, length = 35)
z1 <- outer(x, y, function(a, b) a*b^2)
nrz <- nrow(z1)
ncz <- ncol(z1)
# Create a function interpolating colors in the range of specified colors
jet.colors <- colorRampPalette( c("blue", "green") )
# Generate the desired number of colors from this palette
nbcol <- 100
color <- …Run Code Online (Sandbox Code Playgroud)