简体   繁体   English

R 中的 GLM:具有 95% 置信区间的正态 QQ 图

[英]GLM in R: Normal Q-Q Plot with the 95% confidence interval

I'd like a function or package to plot the Normal QQ Plot with the 95% confidence interval, but I don't find for GLM, only GAM models and for response variables in package car .我想要一个函数或包来绘制具有 95% 置信区间的正态 QQ 图,但我没有找到 GLM,只有 GAM 模型和包car响应变量。 In my example:在我的例子中:

#Data set example
p <- read.csv("https://raw.githubusercontent.com/Leprechault/PEN-533/master/bradysia-greenhouse.csv")

#Quasi Poisson GLM
m1 <- glm(bradysia ~ area + mes, family="quasipoisson", data=p)

#Normal Q-Q Plot 
plot(m1, which = 2)

pl1

#Normal Q-Q Plot with the confidence interval

pl2

I'll like a plot like above for GLM models, it is possible?我会喜欢上面 GLM 模型的图,这可能吗? There are any function or package?有什么函数或包吗?

There are two types of confidence intervals: 1.confidence interval for prediction (what you have shown in your plot 2) and 2. confidence interval for regression.有两种类型的置信区间:1. 预测的置信区间(您在图 2 中显示的内容)和 2. 回归的置信区间。 To fit confidence interval for regression to the residuals of the glm model you can use car package like要拟合回归到 glm 模型残差的置信区间,您可以使用car包,如

library(car)
qqPlot(m1$resid, ylab="Residuals", xlab="Theoretical Quantiles")

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM