一般化線形モデル 設定誤差分布:正規分布

R
『World Economic Outlook Database,April 2014』より
2019年の国別予想実質GDP(10億米ドル)と人口(百万人)
20140708_16

> dataset
                 Country       GDP Population
1              Australia  1736.788     24.966
2                Austria   558.163      8.697
3                Belgium   655.963     11.522
4                 Canada  2124.239     37.252
5                 Cyprus    27.816      0.934
6          CzechRepublic   226.970     10.594
7                Denmark   425.025      5.702
8                Estonia    42.417      1.330
9                Finland   344.155      5.584
10                France  3646.415     65.430
11               Germany  4871.168     80.947
12                Greece   333.594     10.988
13           HongKongSAR   414.158      7.654
14               Iceland    21.671      0.330
15               Ireland   298.364      5.009
16                Israel   399.252      8.969
17                 Italy  2648.343     61.187
18                 Japan  5718.368    124.894
19                 Korea  1873.970     51.536
20                Latvia    50.324      1.999
21            Luxembourg    84.251      0.609
22                 Malta    13.250      0.426
23           Netherlands  1048.161     17.023
24            NewZealand   241.148      4.702
25                Norway   608.040      5.437
26              Portugal   293.590     10.664
27             Singapore   378.191      5.748
28        SlovakRepublic   143.036      5.450
29              Slovenia    62.105      2.079
30                 Spain  1698.249     45.941
31                Sweden   788.490     10.066
32           Switzerland   815.713      8.295
33 TaiwanProvinceofChina   695.822     23.723
34         UnitedKingdom  3757.254     66.697
35          UnitedStates 22089.994    331.518

> y<-dataset$GDP

> x<-dataset$Population

> result<-glm(y~x,family=gaussian)

> summary(result)

Call:
glm(formula = y ~ x, family = gaussian)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1969.0   -133.8    169.9    243.2   1287.9  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -239.791    109.745  -2.185   0.0361 *  
x             63.471      1.659  38.268   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for gaussian family taken to be 332576.3)

    Null deviance: 498024372  on 34  degrees of freedom
Residual deviance:  10975018  on 33  degrees of freedom
AIC: 548.28

Number of Fisher Scoring iterations: 2

> plot(x,y,ylim=c(-3000,23000))

> abline(result,col=2)

> e<-result$res

> par(new=T)

> plot(x,e,col=4,ylim=c(-3000,23000))

> adf.test(e,k=0)

        Augmented Dickey-Fuller Test

data:  e
Dickey-Fuller = -3.3378, Lag order = 0, p-value = 0.08272
alternative hypothesis: stationary

参考文献
服部環(2011).『心理・教育のためのRによるデータ解析』.福村出版.pp435

アプリケーション
R Core Team (2013). R: A language and environment for statistical computing.
R Foundation for Statistical Computing, Vienna, Austria.
URL http://www.R-project.org/.