'전진선택법'에 해당되는 글 1건

  1. 2019.02.17 :: step 함수를 이용한 전진선택법 적용 example
R 2019. 2. 17. 22:05

> library(MASS)

> data(hills)

> head(hills)

             dist climb   time

Greenmantle   2.5   650 16.083

Carnethy      6.0  2500 48.350

Craig Dunain  6.0   900 33.650

Ben Rha       7.5   800 45.600

Ben Lomond    8.0  3070 62.267

Goatfell      8.0  2866 73.217

> step(lm(time~1, hills), scope=list(lower=~1, upper=~dist+climb), direction="forward")

Start:  AIC=274.88

time ~ 1


        Df Sum of Sq   RSS    AIC

+ dist   1     71997 13142 211.49

+ climb  1     55205 29934 240.30

<none>               85138 274.88


Step:  AIC=211.49

time ~ dist


        Df Sum of Sq     RSS    AIC

+ climb  1    6249.7  6891.9 190.90

<none>               13141.6 211.49


Step:  AIC=190.9

time ~ dist + climb



Call:

lm(formula = time ~ dist + climb, data = hills)


Coefficients:

(Intercept)         dist        climb  

   -8.99204      6.21796      0.01105



'R' 카테고리의 다른 글

다차원척도법  (0) 2019.02.21
다변량분석 - 상관분석  (0) 2019.02.18
다중선형분석 example 2  (0) 2019.02.17
다중선형회귀 example  (0) 2019.02.17
단순회귀분석  (0) 2019.02.12
posted by 초코렛과자
: