User Tools

Site Tools


statistical_regression_methods

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
statistical_regression_methods [2017/11/13 10:11] – [e.g. 1] hkimscilstatistical_regression_methods [2022/05/22 22:06] hkimscil
Line 5: Line 5:
   - Enter method   - Enter method
   - Selection method   - Selection method
 +    - [[:Hierarchical regression]] method Sequential regression method
     - Statistical regression method     - Statistical regression method
       - forward selection: 인들 (predictors) 중 종속변인인 Y와 상관관계가 가장 높은 변인부터 먼저 투입되어 회귀계산이 수행된다. 먼저 투입된 변인은 (상관관계가 높으므로) 이론적으로 종속변인을 설명하는 중요한 요소로 여겨지게 된다. 또한 다음 변인은 우선 투입된 변인을 고려한 상태로 투입된다.       - forward selection: 인들 (predictors) 중 종속변인인 Y와 상관관계가 가장 높은 변인부터 먼저 투입되어 회귀계산이 수행된다. 먼저 투입된 변인은 (상관관계가 높으므로) 이론적으로 종속변인을 설명하는 중요한 요소로 여겨지게 된다. 또한 다음 변인은 우선 투입된 변인을 고려한 상태로 투입된다.
       - backward deletion: 모든 독립변인들이 한꺼번에 투입되어 회귀계산이 시작된다. 이어서 회귀식에 통계학적으로 기여하지 못한다고 판단되는 X변인이 하나씩 제거되면서 회귀계산을 반복적으로 한다.       - backward deletion: 모든 독립변인들이 한꺼번에 투입되어 회귀계산이 시작된다. 이어서 회귀식에 통계학적으로 기여하지 못한다고 판단되는 X변인이 하나씩 제거되면서 회귀계산을 반복적으로 한다.
       - stepwise selection: Forward와 같은 방식으로 회귀계산을 하되, 투입된 변인의 설명력을 계산하여 버릴 것인지 취할 것인지를 결정한다. 각 IV에 대한 t-test를 근거로 그 IV가 significant한 기여를 했는지를 판단하는 것을 말한다.        - stepwise selection: Forward와 같은 방식으로 회귀계산을 하되, 투입된 변인의 설명력을 계산하여 버릴 것인지 취할 것인지를 결정한다. 각 IV에 대한 t-test를 근거로 그 IV가 significant한 기여를 했는지를 판단하는 것을 말한다. 
-    Sequential regression method+ 
 +---- 
 +혹은 아래와 같이 분류하기도 한다 
 +Multiple Regression 
 +  - Enter method 
 +  - Selection method 
 +    - Hierarchical regression 
 +    - Stepwise regression -- 이 경우 stepwise 방식은 컴퓨터를 이용하여 criteria를 정하여 독립변인을 고르는 방법을 말한다.  
 +      - forward 
 +      - backward 
 +      - both direction 
  
 See also {{youtube>4Y7PF3Ca3Gk}} See also {{youtube>4Y7PF3Ca3Gk}}
Line 34: Line 46:
 </WRAP> </WRAP>
  
 +R에서 statistical regression방법은 ''step'' 명령어를 이용하여 할 수 있다. 
 +step()에서 AIC 값이 더이상 작아지지 않는 모형을 최종적으로 선택한다. 
 ====== e.g. 1 ====== ====== e.g. 1 ======
 ===== backward elimination ===== ===== backward elimination =====
Line 59: Line 73:
 lm.null <- lm(bwt ~ 1, data = lbw) lm.null <- lm(bwt ~ 1, data = lbw)
 </code> </code>
 +
 +<code>
 +> step(m.full, direction="both")
 +Start:  AIC=1877.43
 +bwt ~ id + low + age + lwt + race + smoke + ptl + ht + ui + ftv + 
 +    preterm + ftv.cat + race.cat
 +
 +
 +Step:  AIC=1877.43
 +bwt ~ id + low + age + lwt + smoke + ptl + ht + ui + ftv + preterm + 
 +    ftv.cat + race.cat
 +
 +           Df Sum of Sq      RSS    AIC
 +- preterm          21  3323378 1875.4
 +- ptl             855  3324211 1875.5
 +- ftv.cat       36489  3359845 1875.5
 +- age            1417  3324774 1875.5
 +- smoke          2016  3325372 1875.5
 +- race.cat  2     38236  3361593 1875.6
 +- ftv           27686  3351043 1877.0
 +- lwt           30065  3353422 1877.1
 +<none>                   3323356 1877.4
 +- ui        1     42573  3365930 1877.8
 +- low           50278  3373635 1878.3
 +- ht        1    129875  3453231 1882.7
 +- id        1  29802422 33125778 2310.0
 +
 +Step:  AIC=1875.43
 +bwt ~ id + low + age + lwt + smoke + ptl + ht + ui + ftv + ftv.cat + 
 +    race.cat
 +
 +           Df Sum of Sq      RSS    AIC
 +- ftv.cat       36536  3359914 1873.5
 +- age            1463  3324840 1873.5
 +- smoke          2050  3325428 1873.5
 +- race.cat  2     38790  3362167 1873.6
 +- ptl            6424  3329802 1873.8
 +- ftv           27666  3351044 1875.0
 +- lwt           30250  3353628 1875.1
 +<none>                   3323378 1875.4
 +- ui        1     42696  3366074 1875.8
 +- low           50815  3374192 1876.3
 ++ preterm          21  3323356 1877.4
 +- ht        1    129854  3453231 1880.7
 +- id        1  29828678 33152056 2308.2
 +
 +Step:  AIC=1873.49
 +bwt ~ id + low + age + lwt + smoke + ptl + ht + ui + ftv + race.cat
 +
 +           Df Sum of Sq      RSS    AIC
 +- age             612  3360526 1871.5
 +- ftv            1077  3360991 1871.5
 +- ptl            4035  3363949 1871.7
 +- smoke          7262  3367176 1871.9
 +- race.cat  2     60911  3420825 1872.9
 +<none>                   3359914 1873.5
 +- ui        1     48125  3408039 1874.2
 +- low           50652  3410566 1874.3
 +- lwt           52277  3412191 1874.4
 ++ ftv.cat       36536  3323378 1875.4
 ++ preterm          68  3359845 1875.5
 +- ht        1    115086  3475000 1877.9
 +- id        1  29807178 33167091 2304.2
 +
 +Step:  AIC=1871.53
 +bwt ~ id + low + lwt + smoke + ptl + ht + ui + ftv + race.cat
 +
 +           Df Sum of Sq      RSS    AIC
 +- ftv             835  3361361 1869.6
 +- ptl            4613  3365139 1869.8
 +- smoke          6898  3367424 1869.9
 +- race.cat  2     60299  3420825 1870.9
 +<none>                   3360526 1871.5
 +- ui        1     47568  3408095 1872.2
 +- low           52254  3412780 1872.4
 +- lwt           55901  3416427 1872.7
 ++ age             612  3359914 1873.5
 ++ ftv.cat       35686  3324840 1873.5
 ++ preterm          32  3360494 1873.5
 +- ht        1    114704  3475230 1875.9
 +- id        1  30083255 33443781 2303.8
 +
 +Step:  AIC=1869.57
 +bwt ~ id + low + lwt + smoke + ptl + ht + ui + race.cat
 +
 +           Df Sum of Sq      RSS    AIC
 +- ptl            4631  3365992 1867.8
 +- smoke          7150  3368510 1868.0
 +- race.cat  2     61709  3423070 1869.0
 +<none>                   3361361 1869.6
 +- ui        1     48299  3409660 1870.3
 +- low           51933  3413294 1870.5
 +- lwt           55081  3416442 1870.7
 ++ ftv             835  3360526 1871.5
 ++ age             370  3360991 1871.5
 ++ preterm          65  3361296 1871.6
 ++ ftv.cat        8791  3352570 1873.1
 +- ht        1    118142  3479503 1874.1
 +- id        1  30120786 33482147 2302.0
 +
 +Step:  AIC=1867.83
 +bwt ~ id + low + lwt + smoke + ht + ui + race.cat
 +
 +           Df Sum of Sq      RSS    AIC
 +- smoke          9448  3375440 1866.4
 +- race.cat  2     63075  3429067 1867.3
 +<none>                   3365992 1867.8
 +- low           48510  3414502 1868.5
 +- lwt           52839  3418831 1868.8
 +- ui        1     56774  3422766 1869.0
 ++ ptl            4631  3361361 1869.6
 ++ preterm        3443  3362549 1869.6
 ++ ftv             853  3365139 1869.8
 ++ age             833  3365159 1869.8
 ++ ftv.cat        8311  3357682 1871.4
 +- ht        1    118424  3484417 1872.4
 +- id        1  30313012 33679005 2301.1
 +
 +Step:  AIC=1866.36
 +bwt ~ id + low + lwt + ht + ui + race.cat
 +
 +           Df Sum of Sq      RSS    AIC
 +- race.cat  2     53642  3429082 1865.3
 +<none>                   3375440 1866.4
 +- low           48366  3423806 1867.0
 +- lwt           50518  3425958 1867.2
 +- ui        1     57207  3432647 1867.5
 ++ smoke          9448  3365992 1867.8
 ++ ptl            6929  3368510 1868.0
 ++ preterm        5425  3370015 1868.1
 ++ ftv            1158  3374282 1868.3
 ++ age             401  3375039 1868.3
 ++ ftv.cat       10879  3364561 1869.8
 +- ht        1    118943  3494383 1870.9
 +- id        1  31159450 34534890 2303.9
 +
 +Step:  AIC=1865.34
 +bwt ~ id + low + lwt + ht + ui
 +
 +           Df Sum of Sq      RSS    AIC
 ++ race      1     47716  3381366 1864.7
 +- lwt           33877  3462959 1865.2
 +<none>                   3429082 1865.3
 +- low           49598  3478680 1866.1
 ++ race.cat  2     53642  3375440 1866.4
 +- ui        1     58727  3487809 1866.5
 ++ ptl            5932  3423150 1867.0
 ++ preterm        5360  3423723 1867.0
 ++ ftv            2306  3426776 1867.2
 ++ smoke            16  3429067 1867.3
 ++ age                3429081 1867.3
 ++ ftv.cat       18489  3410593 1868.3
 +- ht        1    125091  3554174 1870.1
 +- id        1  32067628 35496710 2305.1
 +
 +Step:  AIC=1864.7
 +bwt ~ id + low + lwt + ht + ui + race
 +
 +           Df Sum of Sq      RSS    AIC
 +<none>                   3381366 1864.7
 +- lwt           45021  3426387 1865.2
 +- race      1     47716  3429082 1865.3
 +- low           47807  3429173 1865.3
 +- ui        1     59260  3440626 1866.0
 ++ smoke          9418  3371948 1866.2
 ++ ptl            7086  3374280 1866.3
 ++ race.cat  1      5927  3375440 1866.4
 ++ preterm        5490  3375877 1866.4
 ++ ftv            1056  3380310 1866.6
 ++ age            1044  3380323 1866.6
 ++ ftv.cat       10958  3370409 1868.1
 +- ht        1    119185  3500552 1869.2
 +- id        1  31511908 34893274 2303.8
 +
 +Call:
 +lm(formula = bwt ~ id + low + lwt + ht + ui + race, data = lbw)
 +
 +Coefficients:
 +(Intercept)           id          low          lwt           ht  
 +  1647.3705      11.5379      59.4079      -0.5444    -109.0059  
 +         ui         race  
 +   -52.5856     -17.8063  
 +
 +
 +</code>
 +
 +
  
 <code>summary(lm.full)</code> <code>summary(lm.full)</code>
Line 95: Line 296:
 </code> </code>
  
-<code>Single term deletions+<code> 
 +Single term deletions
  
 Model: Model:
 bwt ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat bwt ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat
-         Df Sum of Sq      RSS    AIC F value    Pr(>F) +         Df Sum of Sq      RSS    AIC F value    Pr(>F)     
-<none>                74494960 2457.2                   +<none>                74494960 2457.2                       
-age           38343 74533303 2455.3  0.0916 0.7624834 +age           38343 74533303 2455.3  0.0916 0.7624834     
-lwt         2508944 77003904 2461.4  5.9949 0.0153165 +lwt         2508944 77003904 2461.4  5.9949 0.0153165 *   
-race.cat  2   5560980 80055939 2466.8  6.6438 0.0016492 +race.cat  2   5560980 80055939 2466.8  6.6438 0.0016492 **  
-smoke       3329939 77824899 2463.4  7.9566 0.0053352 +smoke       3329939 77824899 2463.4  7.9566 0.0053352 **  
-preterm      971457 75466416 2457.6  2.3212 0.1293944 +preterm      971457 75466416 2457.6  2.3212 0.1293944     
-ht        1   3346518 77841478 2463.5  7.9962 0.0052247 +ht        1   3346518 77841478 2463.5  7.9962 0.0052247 **  
-ui        1   5425727 79920686 2468.5 12.9644 0.0004115 +ui        1   5425727 79920686 2468.5 12.9644 0.0004115 *** 
-ftv.cat      380072 74875032 2454.1  0.4541 0.6357678 +ftv.cat      380072 74875032 2454.1  0.4541 0.6357678    
-             +
-<none>       +
-age          +
-lwt      *   +
-race.cat **  +
-smoke    **  +
-preterm      +
-ht       **  +
-ui       *** +
-ftv.cat     +
 --- ---
-Signif. codes:   +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
-0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 +
->  +
-+
 </code> </code>
  
Line 213: Line 402:
 <code>## ui is the most significant variable <code>## ui is the most significant variable
 add1(lm.null, scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F") add1(lm.null, scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F")
 +</code>
 +<code>
 Single term additions Single term additions
  
Line 229: Line 420:
 --- ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 +</code>
 +<code>
 ## Now race.cat is the most significant ## Now race.cat is the most significant
 add1(update(lm.null, ~ . +ui), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F") add1(update(lm.null, ~ . +ui), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F")
 +</code>
 +<code>
 Single term additions Single term additions
  
Line 246: Line 441:
 --- ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 +
 +</code>
 +<code>
 ## Now smoke is the most significant ## Now smoke is the most significant
 add1(update(lm.null, ~ . +ui +race.cat), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F") add1(update(lm.null, ~ . +ui +race.cat), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F")
 +</code>
 +<code>
 Single term additions Single term additions
  
Line 262: Line 462:
 --- ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 +</code>
 +<code>
 ## Now ht is the most significant ## Now ht is the most significant
 add1(update(lm.null, ~ . +ui +race.cat +smoke), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F") add1(update(lm.null, ~ . +ui +race.cat +smoke), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F")
 +</code>
 +<code>
 Single term additions Single term additions
  
Line 277: Line 481:
 --- ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 +</code>
 +<code>
 ## Now lwt is the most significant ## Now lwt is the most significant
 add1(update(lm.null, ~ . +ui +race.cat +smoke +ht), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F") add1(update(lm.null, ~ . +ui +race.cat +smoke +ht), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F")
 +</code>
 +<code>
 Single term additions Single term additions
  
Line 291: Line 499:
 --- ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 +
 +</code>
 +<code>
 ## Now no variable is significant at p < 0.1 ## Now no variable is significant at p < 0.1
 add1(update(lm.null, ~ . +ui +race.cat +smoke +ht +lwt), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F") add1(update(lm.null, ~ . +ui +race.cat +smoke +ht +lwt), scope = ~ age + lwt + race.cat + smoke + preterm + ht + ui + ftv.cat, test = "F")
 +</code>
 +<code>
 Single term additions Single term additions
  
Line 302: Line 515:
 preterm  1   1008759 74902970 2452    2.44   0.12 preterm  1   1008759 74902970 2452    2.44   0.12
 ftv.cat  2    325455 75586274 2456    0.39   0.68 ftv.cat  2    325455 75586274 2456    0.39   0.68
 +</code>
 +<code>
 ## Show summary for final model ## Show summary for final model
 summary(update(lm.null, ~ . +ui +race.cat +smoke +ht +lwt)) summary(update(lm.null, ~ . +ui +race.cat +smoke +ht +lwt))
 +</code> 
 +<code>
 Call: Call:
 lm(formula = bwt ~ ui + race.cat + smoke + ht + lwt, data = lbw) lm(formula = bwt ~ ui + race.cat + smoke + ht + lwt, data = lbw)
Line 327: Line 543:
 Multiple R-squared: 0.24,   Adjusted R-squared: 0.215  Multiple R-squared: 0.24,   Adjusted R-squared: 0.215 
 F-statistic: 9.59 on 6 and 182 DF,  p-value: 0.00000000366 </code> F-statistic: 9.59 on 6 and 182 DF,  p-value: 0.00000000366 </code>
 +
 +===== e.g. SWISS data =====
 +<code>A data frame with 47 observations on 6 variables, each of which is in percent, i.e., in [0, 100].
 +
 +[,1] Fertility Ig, ‘common standardized fertility measure’ 임신율
 +[,2] Agriculture % of males involved in agriculture as occupation
 +[,3] Examination % draftees receiving highest mark on army examination
 +[,4] Education % education beyond primary school for draftees.
 +[,5] Catholic % ‘catholic’ (as opposed to ‘protestant’).
 +[,6] Infant.Mortality live births who live less than 1 year.
 +All variables but ‘Fertility’ give proportions of the population.</code>
 +
 +<code>
 +head(swiss)
 +fit = lm(Infant.Mortality~., data=swiss)
 +summary(fit)
 +</code>
 +
 +<code>> head(swiss)
 +             Fertility Agriculture Examination Education Catholic
 +Courtelary        80.2        17.0          15        12     9.96
 +Delemont          83.1        45.1                      84.84
 +Franches-Mnt      92.5        39.7                      93.40
 +Moutier           85.8        36.5          12            33.77
 +Neuveville        76.9        43.5          17        15     5.16
 +Porrentruy        76.1        35.3                      90.57
 +             Infant.Mortality
 +Courtelary               22.2
 +Delemont                 22.2
 +Franches-Mnt             20.2
 +Moutier                  20.3
 +Neuveville               20.6
 +Porrentruy               26.6
 +> fit = lm(Infant.Mortality~., data=swiss)
 +> summary(fit)
 +
 +Call:
 +lm(formula = Infant.Mortality ~ ., data = swiss)
 +
 +Residuals:
 +    Min      1Q  Median      3Q     Max 
 +-8.2512 -1.2860  0.1821  1.6914  6.0937 
 +
 +Coefficients:
 +              Estimate Std. Error t value Pr(>|t|)   
 +(Intercept)  8.667e+00  5.435e+00   1.595  0.11850   
 +Fertility    1.510e-01  5.351e-02   2.822  0.00734 **
 +Agriculture -1.175e-02  2.812e-02  -0.418  0.67827   
 +Examination  3.695e-02  9.607e-02   0.385  0.70250   
 +Education    6.099e-02  8.484e-02   0.719  0.47631   
 +Catholic     6.711e-05  1.454e-02   0.005  0.99634   
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +Residual standard error: 2.683 on 41 degrees of freedom
 +Multiple R-squared:  0.2439, Adjusted R-squared:  0.1517 
 +F-statistic: 2.645 on 5 and 41 DF,  p-value: 0.03665
 +
 +> </code>
 +
 +<code>step <- stepAIC(fit, direction="both")
 +> step <- stepAIC(fit, direction="both"
 +Start:  AIC=98.34
 +Infant.Mortality ~ Fertility + Agriculture + Examination + Education + 
 +    Catholic
 +
 +              Df Sum of Sq    RSS     AIC
 +- Catholic         0.000 295.07  96.341
 +- Examination  1     1.065 296.13  96.511
 +- Agriculture  1     1.256 296.32  96.541
 +- Education    1     3.719 298.79  96.930
 +<none>                     295.07  98.341
 +- Fertility    1    57.295 352.36 104.682
 +
 +Step:  AIC=96.34
 +Infant.Mortality ~ Fertility + Agriculture + Examination + Education
 +
 +              Df Sum of Sq    RSS     AIC
 +- Examination  1     1.320 296.39  94.551
 +- Agriculture  1     1.395 296.46  94.563
 +- Education    1     5.774 300.84  95.252
 +<none>                     295.07  96.341
 ++ Catholic         0.000 295.07  98.341
 +- Fertility    1    72.609 367.68 104.681
 +
 +Step:  AIC=94.55
 +Infant.Mortality ~ Fertility + Agriculture + Education
 +
 +              Df Sum of Sq    RSS     AIC
 +- Agriculture  1     4.250 300.64  93.220
 +- Education    1     6.875 303.26  93.629
 +<none>                     296.39  94.551
 ++ Examination  1     1.320 295.07  96.341
 ++ Catholic         0.255 296.13  96.511
 +- Fertility    1    79.804 376.19 103.758
 +
 +Step:  AIC=93.22
 +Infant.Mortality ~ Fertility + Education
 +
 +              Df Sum of Sq    RSS     AIC
 +<none>                     300.64  93.220
 +- Education    1    21.902 322.54  94.525
 ++ Agriculture  1     4.250 296.39  94.551
 ++ Examination  1     4.175 296.46  94.563
 ++ Catholic         2.318 298.32  94.857
 +- Fertility    1    85.769 386.41 103.017
 +
 +</code>
 +
 +<code>> summary(step)
 +
 +Call:
 +lm(formula = Infant.Mortality ~ Fertility + Education, data = swiss)
 +
 +Residuals:
 +    Min      1Q  Median      3Q     Max 
 +-7.6927 -1.4049  0.2218  1.7751  6.1685 
 +
 +Coefficients:
 +            Estimate Std. Error t value Pr(>|t|)    
 +(Intercept)  8.63758    3.33524   2.590 0.012973 *  
 +Fertility    0.14615    0.04125   3.543 0.000951 ***
 +Education    0.09595    0.05359   1.790 0.080273 .  
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +Residual standard error: 2.614 on 44 degrees of freedom
 +Multiple R-squared:  0.2296, Adjusted R-squared:  0.1946 
 +F-statistic: 6.558 on 2 and 44 DF,  p-value: 0.003215
 +
 +></code> 
 +
 +How about fertility?
 +
 +<code>
 +head(swiss)
 +fit = lm(Fertility ~ ., data=swiss)
 +summary(fit)
 +
 +</code>
 +
 +<code>
 +step <- stepAIC(fit, direction="both")
 +summary(step)
 +</code>
 +Then figure out the standardized coefficients, betas. 
  
statistical_regression_methods.txt · Last modified: 2022/11/13 23:01 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki