R:颜色编码模型诊断图

时间:2017-04-11 18:39:02

标签: r plot

>>> print(*(f'{s} {f:.4f}' for s,f in l))
a1 1.9626 b3 1.3600 e2 0.5715

我有一个14个不同library(nlme) SeedID <- unique(Loblolly$Seed) set.seed(3) group1 = sample(SeedID, 7) group1_ind = which(Loblolly$group == 1) Loblolly$group = ifelse(Loblolly$Seed %in% group1, 1, 0) fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc), data = Loblolly, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1, start = c(Asym = 103, R0 = -8.5, lrc = -3.3)) stdRes = resid(fm1, type = "p") fitted = fitted(fm1) plot(stdRes ~ fitted) points(stdRes[group1_ind] ~ fitted[group1_ind], col = "blue") 的数据集。我随机将它们分成两组(每组0或1,7个种子)并适合模型。我按组绘制了残差(0组为黑色,组1为蓝色),看起来很好。 enter image description here

但我无法弄清楚如何在同一个情节中按群组对QQ情节进行颜色编码。

Seed

1 个答案:

答案 0 :(得分:1)

您可以从qqnorm捕获返回的值(隐身),然后使用它们绘制您的积分

dd <- as.data.frame(qqnorm(stdRes))
points(y~x, dd[group1_ind,], col = "blue")