oppo版本指令代码大全(oppo手机常用代码)
❝
本文主要介绍空间计量及R操作(面板空间计量篇)
❞
本文主要介绍空间计量及R操作(面板空间计量篇)
❞
1、数据介绍
Produc
相关数据来源于:Munnell A (1990). “Why Has Productivity Growth Declined? Productivity and Public Investment.” New England Economic Review, 3–22.
原文已经下载并上传至计量经济学社群,可以免费进入查看!
US States Production
从1970年到1986年的48个观测截面的面板数据
数据格式:数据框
变量介绍:
state:the state
year:the year
region:the region
pcap:public capital stock
hwy:highway and streets
water:water and sewer facilities
util:other public buildings and structures
pc:private capital stock
gsp;gross state product
emp:labor input measured by the employment in non–agricultural payrolls
unemp:state unemployment rate
展开全文
Details:total number of observations : 816
observation : regional
country : United States
数据来源:
Online complements to Baltagi (2001):
http://www.wiley.com/legacy/wileychi/baltagi/
Online complements to Baltagi (2013):http://bcs.wiley.com/he-bcs/Books?action=resource&bcsId=4338&itemId=1118672321&resourceId=13452
参考文献:Baltagi B (2001). Econometric Analysis of Panel Data, 3rd edition. John Wiley and Sons ltd.
Baltagi B (2013). Econometric Analysis of Panel Data, 5th edition. John Wiley and Sons ltd.
Baltagi BH, Pinnoi N (1995). “Public capital stock and state productivity growth: further evidence from an error components model.” Empirical Economics, 20, 351-359.
Munnell A (1990). “Why Has Productivity Growth Declined? Productivity and Public Investment.” New England Economic Review, 3–22.
1、导入数据
2、查看数据
3、查看数据结构
4、导入查看空间权重矩阵及介绍
2、传统的面案数据分析
需要使用到的命令是plm,该函数表示:面板数据估计,面板数据的线性模型估计使用plm函数。
语法格式为:
选项含义表示:
2.1 传统的个体固定效应面板模型
代码为
Oneway (individual) effect Within Model
Call:plm(formula = df, data = Produc, effect = "individual", model = "within", index= c( "state", "year"))
Balanced Panel: n = 48, T = 17, N = 816
Residuals:Min. 1st Qu. Median 3rd Qu. Max. - 0. 1359569- 0. 0233995 - 0. 0033379 0. 0184788 0. 1844763
Coefficients:Estimate Std. Error t-value Pr(>|t|) log(pcap) - 0.088029 0. 027081 - 3.25060. 001202** log(pc) 0. 2324370. 02293 010.1369< 2.2e- 16*** log(emp) 0. 8577680. 02546633.6834< 2.2e- 16*** ---Signif. codes: 0‘***’ 0. 001‘**’ 0. 01‘*’ 0. 05‘.’ 0. 1‘ ’ 1
Total Sum of Squares: 18.941Residual Sum of Squares: 1.1529R-Squared: 0. 93913Adj. R-Squared: 0. 93515F-statistic: 3934.33on 3and765DF, p-value: < 2.22e- 16
2.2 传统的个体随机效应面板模型
代码为
结果为:
Call:plm(formula = df, data = Produc, effect = "individual", model = "random", index = c( "state", "year"))
Balanced Panel: n = 48, T = 17, N = 816
Effects:var std.dev shareidiosyncratic 0.001507 0.038822 0.184individual 0.006702 0.081863 0.816theta: 0.8857
Residuals:Min. 1st Qu. Median 3rd Qu. Max. -0.118735 -0.025222 -0.003688 0.021632 0.217416
Coefficients:Estimate Std. Error z-value Pr(>|z|) (Intercept) 2.611567 0.114880 22.7331 < 2e-16 ***log(pcap) -0.046151 0.022643 -2.0382 0.04153 * log(pc) 0.252960 0.018208 13.8926 < 2e-16 ***log(emp) 0.812907 0.022039 36.8854 < 2e-16 ***---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Total Sum of Squares: 29.789Residual Sum of Squares: 1.261R-Squared: 0.95767Adj. R-Squared: 0.95751Chisq: 18370.4 on 3 DF, p-value: < 2.22e-16
3、空间面案数据分析
空间面板数据分析分为极大似然估计和广义矩估计,命令分别是spml和 spgm
spml语法格式为:
spgm语法格式为:
1、spgm操作案例
代码为
Call:spgm(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, listw = usaww, spatial.error = TRUE, moments = "fullweights")
Residuals:Min. 1st Qu. Median 3rd Qu. Max. -0.1496836 -0.0174426 -0.0019014 0.0142554 0.1703041
Estimated spatial coefficient, variance components and theta:Estimaterho 0.499871sigma^2_v 0.001105
Coefficients:Estimate Std. Error t-value Pr(>|t|) log(pcap) 0.0043026 0.0253425 0.1698 0.86519 log(pc) 0.2144604 0.0232533 9.2228 < 2e-16 *** log(emp) 0.7830897 0.0279794 27.9881 < 2e-16 *** unemp -0.0025609 0.0010546 -2.4282 0.01517 * ---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
2、极大似然估计的个体随机效应
代码为
Call: spreml(formula= formula, data = data, index = index, w = listw2mat(listw), w2= listw2mat(listw2), lag = lag, errors = errors, cl = cl)
Residuals: Min.1st Qu. Median Mean 3rd Qu. Max. -0.2477-0.0411 0.0123 0.0191 0.0727 0.4841
Errorvariance parameters:EstimateStd. Error t-value Pr(>|t|) phi7.53078 1.85638 4.0567 4.977e-05 ***rho0.53683 0.05603 9.5811 < 2.2e-16 ***
Spatialautoregressive coefficient:EstimateStd. Error t-value Pr(>|t|)lambda0.0018204 0.0400679 0.0454 0.9638
Coefficients: EstimateStd. Error t-value Pr(>|t|) (Intercept)2.3735772 0.1394744 17.0180 < 2.2e-16 ***log(pcap)0.0425017 0.0222146 1.9132 0.055719 . log(pc)0.2415075 0.0202970 11.8987 < 2.2e-16 ***log(emp)0.7419063 0.0244212 30.3796 < 2.2e-16 ***unemp-0.0034560 0.0010605 -3.2589 0.001118 ** ---Signif.codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
3、极大似然估计的个体固定效应
代码为
Call:spml(formula = df, data = Produc, index= c( "state", "year"), listw = mat2listw(usaww), model = "within", effect = "individual", lag = T, spatial.error = "b")
Residuals:Min. 1st Qu. Median 3rd Qu. Max. - 0. 1335552- 0. 0220919 - 0. 0032048 0. 0171787 0. 1748911
Spatial error parameter:Estimate Std. Error t-value Pr(>|t|) rho 0. 4553120. 042538 10.704< 2.2e- 16***
Spatial autoregressive coefficient:Estimate Std. Error t-value Pr(>|t|) lambda 0.088576 0. 0263123.36630. 0007618 ***
Coefficients:Estimate Std. Error t-value Pr(>|t|) log(pcap) - 0. 0103497 0. 0255345- 0. 40530. 6852log(pc) 0. 19057810. 0242829 7.84834.219e- 15*** log(emp) 0. 75523720. 0290385 26.0081< 2.2e- 16*** unemp - 0. 00306130. 0010315- 2.96780. 0030** ---Signif. codes: 0‘***’ 0. 001‘**’ 0. 01‘*’ 0. 05‘.’ 0. 1‘ ’ 1
>