R lm()

Jmnote (토론 | 기여)님의 2021년 5월 7일 (금) 19:22 판 (→‎개요)

1 개요

R lm()
  • "Linear Models → 선형 모델"
R
Reload
Copy
x <- c(151, 174, 138, 186, 128, 136, 179, 163, 152, 131)
y <- c(63, 81, 56, 91, 47, 57, 76, 72, 62, 48)
relation <- lm(y~x)
relation
Loading
Copy
summary(relation)
Loading
R
Reload
Copy
summary(lm(Fertility ~ ., data=swiss))
Loading
R
Reload
Copy
library(MASS)
data(hills)
attach(hills)
md <- lm( time ~ dist + climb)
summary(md)
Loading
Copy
fit4 <- lm(Fertility ~ Agriculture + Education + Catholic + Infant.Mortality, data = swiss)
summary(fit4)
Loading
R
Reload
Copy
data(state)
statdata<-data.frame(state.x77,row.names=state.abb)
g3<-lm(Life.Exp ~ Illiteracy, data=statdata) 
summary(g3)
Loading
R
Reload
Copy
m <- lm(dist ~ speed, data=cars)
summary(m)
Loading

2 같이 보기

3 참고