R 단순선형회귀분석

(R 단순회귀분석에서 넘어옴)

1 개요[ | ]

R simple regression
R simple linear regression
R 회귀분석
R 단순회귀분석
R 단순선형회귀분석

2 예시 1: 키와 몸무게[ | ]

df <- data.frame(
  height = c(1.47, 1.50, 1.52, 1.55, 1.57, 1.60, 1.63, 1.65, 1.68, 1.70, 1.73, 1.75, 1.78, 1.80, 1.83),
  mass = c(52.21, 53.12, 54.48, 55.84, 57.20, 58.57, 59.93, 61.29, 63.11, 64.47, 66.28, 68.10, 69.92, 72.19, 74.46)
)
model <- lm(mass ~ height, data=df)
summary(model)
→ 회귀식 [math]\displaystyle{ y=61.272x-39.062 }[/math]
→ 결정계수 [math]\displaystyle{ R^2=0.9892 }[/math]

3 예시 2: 대학 불합격[ | ]

df <- data.frame(
  student = c(4000,10000,15000,12000,8000,16000,5000,7000,9000,10000),
  rejection = c(100,400,500,400,300,400,200,100,400,200)
)
model <- lm(rejection ~ student, data=df)
summary(model)
→ 회귀식 [math]\displaystyle{ y=0.028902x+22.543353 }[/math]
→ 결정계수 [math]\displaystyle{ R^2=0.6423 }[/math]

4 예시 3: 아이스티 주문[ | ]

df <- read.csv('https://raw.githubusercontent.com/jmnote/ds/main/simple-regression/iced-tea-orders.csv')
head(df)
model <- lm(order ~ high_temperature, data=df)
summary(model)
→ 회귀식 [math]\displaystyle{ y=3.7379x-36.3612 }[/math]
→ 결정계수 [math]\displaystyle{ R^2=0.8225 }[/math]

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}