相关疑难解决方法(0)

有条件地将数据点指向R中的置信带之外

我需要为下面的图中的置信带之外的数据点着色不同于带内的数据点.我应该在数据集中添加单独的列来记录数据点是否在置信带内吗?你能提供一个例子吗?

情节乐队情节

示例数据集:

## Dataset from http://www.apsnet.org/education/advancedplantpath/topics/RModules/doc1/04_Linear_regression.html

## Disease severity as a function of temperature

# Response variable, disease severity
diseasesev<-c(1.9,3.1,3.3,4.8,5.3,6.1,6.4,7.6,9.8,12.4)

# Predictor variable, (Centigrade)
temperature<-c(2,1,5,5,20,20,23,10,30,25)

## For convenience, the data may be formatted into a dataframe
severity <- as.data.frame(cbind(diseasesev,temperature))

## Fit a linear model for the data and summarize the output from function lm()
severity.lm <- lm(diseasesev~temperature,data=severity)

# Take a look at the data
plot(
  diseasesev~temperature,
  data=severity,
  xlab="Temperature",
  ylab="% Disease Severity",
  pch=16,
  pty="s",
  xlim=c(0,30),
  ylim=c(0,30)
)
title(main="Graph of % Disease …
Run Code Online (Sandbox Code Playgroud)

statistics plot r linear-regression confidence-interval

7
推荐指数
2
解决办法
3216
查看次数