İleri Panel Veri Yöntemleri Sabit etkileri
Panel veri analizi ne işe yarar? Zaman serileri ve yatay kesit analizinin birleştirilmesini ve uygun modellerin test edilmesini sağlayan yönteme panel veri analizi denilmektedir Zaman serisi ve yatay kesit verilerinin birleştirilmesi ile oluşturulan verilere “Longitudinal veya Havuzlanmış Veri (Pooled Data) denilmektedir.
library(wooldridge)
## Warning: package 'wooldridge' was built under R version 4.1.3
library(plm)
## Warning: package 'plm' was built under R version 4.1.3
library(rmarkdown)
data("murder")
paged_table(murder)
zaman ve birey
murder.yahya1 <- pdata.frame(murder,index = c("state" , "year"))
plm içindeki padata frame tanıtım
‘pdata.frame’ sınıfı bir nesne, bireysel ve zaman boyutlarını tanımlayan bir indeks niteliğine sahip bir data.frame’dir.
‘pdata.frame’ sınıfı bir nesne, bireysel ve zaman boyutlarını tanımlayan bir indeks niteliğine sahip bir data.frame’dir.
pdim(murder.yahya1 )
## Balanced Panel: n = 51, T = 3, N = 153
13 değişkene ilişkin 153 gözlem içeren bir data.frame:
PLm modelin(Regresyonu) oluşturmak
model1 <- plm(mrdrte~id+state+year+exec+state,data = murder.yahya1,model ="within" )
summary(model1)
## Oneway (individual) effect Within Model
##
## Call:
## plm(formula = mrdrte ~ id + state + year + exec + state, data = murder.yahya1,
## model = "within")
##
## Balanced Panel: n = 51, T = 3, N = 153
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -26.935057 -0.635056 -0.079961 0.541240 13.633215
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## year90 1.36310 0.69746 1.9544 0.05348 .
## year93 1.73173 0.69887 2.4779 0.01491 *
## exec -0.12727 0.17599 -0.7231 0.47130
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 1311.5
## Residual Sum of Squares: 1222.2
## R-Squared: 0.068094
## Adj. R-Squared: -0.4308
## F-statistic: 2.41131 on 3 and 99 DF, p-value: 0.071365
normal bildiğimiz lm regresyonu oluşturmak
model2 <- lm( mrdrte~id+state+year+exec+state,data = murder.yahya1)
summary(model2)
##
## Call:
## lm(formula = mrdrte ~ id + state + year + exec + state, data = murder.yahya1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.9351 -0.6351 -0.0800 0.5412 13.6332
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.055094 2.150831 3.745 0.000303 ***
## id -0.110019 0.058559 -1.879 0.063219 .
## stateAL 2.238449 2.946425 0.760 0.449229
## stateAR 0.889726 2.821657 0.315 0.753182
## stateAZ -0.696048 2.845353 -0.245 0.807252
## stateCA 3.414900 2.787458 1.225 0.223446
## stateCO -3.159926 2.759174 -1.145 0.254869
## stateCT -2.883240 2.734217 -1.055 0.294219
## stateDC 56.070131 2.687439 20.864 < 2e-16 ***
## stateDE -3.173222 2.710296 -1.171 0.244489
## stateFL 3.280107 2.957488 1.109 0.270080
## stateGA 4.384080 2.766399 1.585 0.116210
## stateHI -3.566481 2.625516 -1.358 0.177427
## stateIA -5.226407 2.559433 -2.042 0.043809 *
## stateID -4.756462 2.607180 -1.824 0.071112 .
## stateIL 2.453556 2.590039 0.947 0.345790
## stateIN -0.960669 2.574429 -0.373 0.709828
## stateKS -2.283055 2.546014 -0.897 0.372045
## stateKY -0.006369 2.533877 -0.003 0.997999
## stateLA 9.839985 2.665378 3.692 0.000365 ***
## stateMA -3.032962 2.498499 -1.214 0.227669
## stateMD 4.490353 2.505338 1.792 0.076137 .
## stateME -4.719665 2.513523 -1.878 0.063364 .
## stateMI 4.243724 2.493017 1.702 0.091848 .
## stateMN -3.546258 2.488901 -1.425 0.157352
## stateMO 3.707092 2.559985 1.448 0.150751
## stateMS 5.757694 2.490434 2.312 0.022854 *
## stateMT -2.116202 2.484806 -0.852 0.396460
## stateNC 4.814529 2.526712 1.905 0.059623 .
## stateND -3.902720 2.534112 -1.540 0.126733
## stateNE -2.639517 2.486200 -1.062 0.290970
## stateNH -3.486146 2.493115 -1.398 0.165145
## stateNJ -0.509461 2.498625 -0.204 0.838853
## stateNM 3.533891 2.505492 1.410 0.161539
## stateNV 3.773524 2.496972 1.511 0.133913
## stateNY 7.577243 2.513704 3.014 0.003271 **
## stateOH 0.840632 2.546276 0.330 0.741990
## stateOK 3.077918 2.562889 1.201 0.232634
## stateOR -0.239331 2.574429 -0.093 0.926120
## statePA 1.504021 2.590378 0.581 0.562817
## stateRI -0.619294 2.607544 -0.238 0.812759
## stateSC 5.860414 2.632209 2.226 0.028252 *
## stateSD -2.065923 2.645433 -0.781 0.436702
## stateTN 5.577429 2.666106 2.092 0.038999 *
## stateTX 11.163079 4.719968 2.365 0.019976 *
## stateUT -0.875267 2.713145 -0.323 0.747677
## stateVA 5.014439 2.935501 1.708 0.090732 .
## stateVT -1.159182 2.734718 -0.424 0.672576
## stateWA 1.469944 2.785139 0.528 0.598832
## stateWI 0.580892 2.840560 0.204 0.838383
## stateWV 2.104207 2.812645 0.748 0.456159
## stateWY NA NA NA NA
## year90 1.363103 0.697461 1.954 0.053478 .
## year93 1.731727 0.698869 2.478 0.014908 *
## exec -0.127267 0.175991 -0.723 0.471296
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.514 on 99 degrees of freedom
## Multiple R-squared: 0.9049, Adjusted R-squared: 0.8539
## F-statistic: 17.76 on 53 and 99 DF, p-value: < 2.2e-16
Kesensiz lm regregresyonu
model3 <- lm( mrdrte~id+state+year+exec+state-1,data = murder.yahya1)
summary(model3)
##
## Call:
## lm(formula = mrdrte ~ id + state + year + exec + state - 1, data = murder.yahya1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.9351 -0.6351 -0.0800 0.5412 13.6332
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## id 0.04792 0.04056 1.182 0.240220
## stateAK 7.73921 2.06649 3.745 0.000303 ***
## stateAL 10.13560 2.13151 4.755 6.74e-06 ***
## stateAR 8.31305 2.08036 3.996 0.000124 ***
## stateAZ 6.88522 2.07367 3.320 0.001260 **
## stateCA 10.68028 2.07296 5.152 1.32e-06 ***
## stateCO 3.94751 2.07310 1.904 0.059793 .
## stateCT 4.06625 2.07673 1.958 0.053044 .
## stateDC 62.70374 2.08634 30.054 < 2e-16 ***
## stateDE 3.61833 2.08115 1.739 0.085210 .
## stateFL 9.75577 2.44986 3.982 0.000130 ***
## stateGA 10.70180 2.24774 4.761 6.58e-06 ***
## stateHI 2.59330 2.10654 1.231 0.221214
## stateIA 0.30160 2.14395 0.141 0.888413
## stateID 1.24537 2.11479 0.589 0.557278
## stateIL 8.29745 2.12378 3.907 0.000171 ***
## stateIN 4.72528 2.13372 2.215 0.029083 *
## stateKS 3.08701 2.15511 1.432 0.155176
## stateKY 5.20575 2.16697 2.402 0.018156 *
## stateLA 14.89416 2.34090 6.363 6.19e-09 ***
## stateMA 1.54739 2.22120 0.697 0.487658
## stateMD 9.22864 2.20665 4.182 6.25e-05 ***
## stateME 0.17657 2.19275 0.081 0.935983
## stateMI 8.66613 2.23639 3.875 0.000192 ***
## stateMN 0.71820 2.25221 0.319 0.750483
## stateMO 7.65567 2.36612 3.236 0.001651 **
## stateMS 9.86421 2.27301 4.340 3.44e-05 ***
## stateMT 1.67443 2.30331 0.727 0.468961
## stateNC 7.49956 2.44541 3.067 0.002790 **
## stateND -1.37563 2.46388 -0.558 0.577887
## stateNE 0.99317 2.32151 0.428 0.669716
## stateNH -0.16934 2.35958 -0.072 0.942931
## stateNJ 2.64940 2.37942 1.113 0.268205
## stateNM 6.53481 2.39979 2.723 0.007645 **
## stateNV 7.24827 2.34842 3.086 0.002627 **
## stateNY 10.42022 2.42066 4.305 3.94e-05 ***
## stateOH 3.20978 2.48620 1.291 0.199698
## stateOK 5.28912 2.51206 2.105 0.037779 *
## stateOR 1.81393 2.53221 0.716 0.475466
## statePA 3.39934 2.55586 1.330 0.186569
## stateRI 1.11808 2.57994 0.433 0.665686
## stateSC 7.43984 2.61064 2.850 0.005323 **
## stateSD -0.64444 2.62931 -0.245 0.806889
## stateTN 6.84097 2.65458 2.577 0.011440 *
## stateTX 12.26868 4.71467 2.602 0.010683 *
## stateUT 0.07239 2.70855 0.027 0.978731
## stateVA 5.64621 2.93491 1.924 0.057251 .
## stateVT -0.36947 2.73260 -0.135 0.892723
## stateWA 1.94377 2.78580 0.698 0.486974
## stateWI 0.73884 2.84141 0.260 0.795385
## stateWV 2.42009 2.81372 0.860 0.391810
## stateWY NA NA NA NA
## year90 1.36310 0.69746 1.954 0.053478 .
## year93 1.73173 0.69887 2.478 0.014908 *
## exec -0.12727 0.17599 -0.723 0.471296
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.514 on 99 degrees of freedom
## Multiple R-squared: 0.9464, Adjusted R-squared: 0.9172
## F-statistic: 32.38 on 54 and 99 DF, p-value: < 2.2e-16
stargazer taplolarin birleşimektir
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
stargazer(model1,model2,model3,type = "text")
##
## =================================================================================================
## Dependent variable:
## -------------------------------------------------------------------
## mrdrte
## panel OLS
## linear
## (1) (2) (3)
## -------------------------------------------------------------------------------------------------
## id -0.110* 0.048
## (0.059) (0.041)
##
## stateAK 7.739***
## (2.066)
##
## stateAL 2.238 10.136***
## (2.946) (2.132)
##
## stateAR 0.890 8.313***
## (2.822) (2.080)
##
## stateAZ -0.696 6.885***
## (2.845) (2.074)
##
## stateCA 3.415 10.680***
## (2.787) (2.073)
##
## stateCO -3.160 3.948*
## (2.759) (2.073)
##
## stateCT -2.883 4.066*
## (2.734) (2.077)
##
## stateDC 56.070*** 62.704***
## (2.687) (2.086)
##
## stateDE -3.173 3.618*
## (2.710) (2.081)
##
## stateFL 3.280 9.756***
## (2.957) (2.450)
##
## stateGA 4.384 10.702***
## (2.766) (2.248)
##
## stateHI -3.566 2.593
## (2.626) (2.107)
##
## stateIA -5.226** 0.302
## (2.559) (2.144)
##
## stateID -4.756* 1.245
## (2.607) (2.115)
##
## stateIL 2.454 8.297***
## (2.590) (2.124)
##
## stateIN -0.961 4.725**
## (2.574) (2.134)
##
## stateKS -2.283 3.087
## (2.546) (2.155)
##
## stateKY -0.006 5.206**
## (2.534) (2.167)
##
## stateLA 9.840*** 14.894***
## (2.665) (2.341)
##
## stateMA -3.033 1.547
## (2.498) (2.221)
##
## stateMD 4.490* 9.229***
## (2.505) (2.207)
##
## stateME -4.720* 0.177
## (2.514) (2.193)
##
## stateMI 4.244* 8.666***
## (2.493) (2.236)
##
## stateMN -3.546 0.718
## (2.489) (2.252)
##
## stateMO 3.707 7.656***
## (2.560) (2.366)
##
## stateMS 5.758** 9.864***
## (2.490) (2.273)
##
## stateMT -2.116 1.674
## (2.485) (2.303)
##
## stateNC 4.815* 7.500***
## (2.527) (2.445)
##
## stateND -3.903 -1.376
## (2.534) (2.464)
##
## stateNE -2.640 0.993
## (2.486) (2.322)
##
## stateNH -3.486 -0.169
## (2.493) (2.360)
##
## stateNJ -0.509 2.649
## (2.499) (2.379)
##
## stateNM 3.534 6.535***
## (2.505) (2.400)
##
## stateNV 3.774 7.248***
## (2.497) (2.348)
##
## stateNY 7.577*** 10.420***
## (2.514) (2.421)
##
## stateOH 0.841 3.210
## (2.546) (2.486)
##
## stateOK 3.078 5.289**
## (2.563) (2.512)
##
## stateOR -0.239 1.814
## (2.574) (2.532)
##
## statePA 1.504 3.399
## (2.590) (2.556)
##
## stateRI -0.619 1.118
## (2.608) (2.580)
##
## stateSC 5.860** 7.440***
## (2.632) (2.611)
##
## stateSD -2.066 -0.644
## (2.645) (2.629)
##
## stateTN 5.577** 6.841**
## (2.666) (2.655)
##
## stateTX 11.163** 12.269**
## (4.720) (4.715)
##
## stateUT -0.875 0.072
## (2.713) (2.709)
##
## stateVA 5.014* 5.646*
## (2.936) (2.935)
##
## stateVT -1.159 -0.369
## (2.735) (2.733)
##
## stateWA 1.470 1.944
## (2.785) (2.786)
##
## stateWI 0.581 0.739
## (2.841) (2.841)
##
## stateWV 2.104 2.420
## (2.813) (2.814)
##
## stateWY
##
##
## year90 1.363* 1.363* 1.363*
## (0.697) (0.697) (0.697)
##
## year93 1.732** 1.732** 1.732**
## (0.699) (0.699) (0.699)
##
## exec -0.127 -0.127 -0.127
## (0.176) (0.176) (0.176)
##
## Constant 8.055***
## (2.151)
##
## -------------------------------------------------------------------------------------------------
## Observations 153 153 153
## R2 0.068 0.905 0.946
## Adjusted R2 -0.431 0.854 0.917
## Residual Std. Error (df = 99) 3.514 3.514
## F Statistic 2.411* (df = 3; 99) 17.765*** (df = 53; 99) 32.385*** (df = 54; 99)
## =================================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01