空间面板数据分析R的splm包Word文件下载.docx
- 文档编号:21239610
- 上传时间:2023-01-28
- 格式:DOCX
- 页数:8
- 大小:17.82KB
空间面板数据分析R的splm包Word文件下载.docx
《空间面板数据分析R的splm包Word文件下载.docx》由会员分享,可在线阅读,更多相关《空间面板数据分析R的splm包Word文件下载.docx(8页珍藏版)》请在冰豆网上搜索。
plm
bdsmatrix
载入程辑包:
‘bdsmatrix’
下列对象被屏蔽了from‘package:
base’:
backsolve
Formula
sandwich
zoo
‘zoo’
spam
grid
Spamversion(2013-09-11)isloaded.
Type'
help(Spam)'
or'
demo(spam)'
forashortintroduction
andoverviewofthispackage.
Helpforindividualfunctionsisalsoobtainedbyaddingthe
suffix'
.spam'
tothefunctionname,.'
help('
.
‘spam’
bdsmatrix’:
backsolve,forwardsolve
ibdreg
car
lmtest
Ecdat
‘Ecdat’
car’:
Mroz
nlme’:
Gasoline
MASS’:
SP500
datasets’:
Orange
maxLik
miscTools
Pleasecitethe'
maxLik'
packageas:
Henningsen,ArneandToomet,Ott(2011).maxLik:
ApackageformaximumlikelihoodestimationinR.ComputationalStatistics26(3),443-458.DOIs001.
Ifyouhavequestions,suggestions,orcommentsregardingthe'
package,pleaseuseaforumor'
tracker'
atmaxLik'
sR-Forgesite:
Warningmessage:
程辑包‘Matrix’是用R版本3.0.3来建造的
注意:
在导入splm时,如果发现还有其他配套的包没有安装,需要先安装。
2、接着,查看数据及结构,命令如下:
data(Produc,package=”Ecdat”)
View(Produc)
3、引入空间权重矩阵(spatialweightsmatrix),命令如下
data(usaww)
Views(usaww)
4、空间面板数据的广义矩估计,命令spgm
GM<
-spgm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp,data=Produc,
listw=usaww,moments=”fullweights”,=TRUE)
summary(GM)
GM<
-spgm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp,data=Produc,
+listw=usaww,moments="
fullweights"
=TRUE)
SpatialpanelfixedeffectsGMmodel
Call:
spgm(formula=log(gsp)~log(pcap)+log(pc)+log(emp)+unemp,
data=Produc,listw=usaww,=TRUE,moments="
)
Residuals:
Min.1stQu.Median3rdQu.Max.
Estimatedspatialcoefficient,variancecomponentsandtheta:
Estimate
rho
sigma^2_v
Coefficients:
EstimateStd.Errort-valuePr(>
|t|)
log(pcap)
log(pc)<
***
log(emp)<
unemp***
---
Signif.codes:
0‘***’‘**’‘*’‘.’‘’1
5、空间面板极大似然估计,命令spml
fm<
-log(gsp)~log(pcap)+log(pc)+log(emp)+unemp
##fixedeffectspanelwithspatialerrors
Fespaterr<
-spml(fm,data=Produc,listw=mat2listw(usaww),model=”within”,
=”b”,hess=FALSE)
summary(Fespaterr)
fm<
-log(gsp)~log(pcap)+log(pc)+log(emp)+unemp
Fespaterr<
-spml(fm,data=Produc,listw=mat2listw(usaww),model="
within"
+="
b"
hess=FALSE)
summary(Fespaterr)
Spatialpanelfixedeffectserrormodel
spml(formula=fm,data=Produc,listw=mat2listw(usaww),model="
="
hess=FALSE)
rho<
2e-16***
unemp*
##randomeffectspanalwithspatiallag
Respatlag<
-spml(fm,data=Produc,listw=mat2listw(usaww),model=”random”,
=”none”,lag=TRUE)
summary(Respatlag)
Respatlag<
random"
+="
none"
lag=TRUE)
summary(Respatlag)
SpatialpanelrandomeffectsMLmodel
spreml(formula=formula,data=data,index=index,w=listw2mat(listw),
w2=listw2mat(listw2),lag=lag,errors=errors,cl=cl)
Min.1stQu.MedianMean3rdQu.Max.
Errorvarianceparameters:
phi*
Spatialautoregressivecoefficient:
lambda***
0‘***’‘**’‘*’‘.’‘’1
6、伴有随机效应和序列误差相关的空间面板模型的极大似然估计,命令speml
##randomeffectspanelwithspatiallagandserialerrorcorrelation
##optimizationmethodsetto“BFGS“
Sarsrmod<
-spreml(fm,data=Froduc,w=usaww,error=”sr”,lag=TRUE,method=”BFGS”)
summary(Sarsrmod)
Sarsrmod<
-spreml(fm,data=Produc,w=usaww,error="
sr"
lag=TRUE,method="
BFGS"
summary(Sarsrmod)
spreml(formula=fm,data=Produc,w=usaww,lag=TRUE,errors="
method="
lambda<
log(pcap)*
log(pc)
7、模型检验
(1)bsjktest,Baltigi,Song,Jung,andKohLMtestforspatialpanels
bsjktest(fm,data=Produc,listw=usaww,test="
"
Baltagi,Song,JungandKohconditionaltest
data:
log(gsp)~log(pcap)+log(pc)+log(emp)+unemp
LM=,df=1,p-value=
alternativehypothesis:
spatialdependenceinerrorterms,subREandserialcorr.
(2)bsktest,Baltigi,SongandKohLMtestforspatialpanels
bsktest(fm,data=Produc,listw=mat2listw(usaww),
+test="
LM1"
standardize=TRUE)
Baltagi,SongandKohSLM1marginaltest
SLM1=,p-value=
Randomeffects
(3)Covarianceextractormethodforsplmobjects
sarremod<
+lag=TRUE,="
library(lmtest)
coeftest(sarremod)
ztestofcoefficients:
EstimateStd.ErrorzvaluePr(>
|z|)
library(car)
lht(sarremod,"
log(pcap)=log(pc)"
Linearhypothesistest
Hypothesis:
log(pcap)-log(pc)=0
Model1:
restrictedmodel
Model2:
function(x,...)
UseMethod("
formula"
DfChisqPr(>
Chisq)
1
21***
(更多详情请查看splm的help文档以及文后列的参考文献)
参考文献
.,Song,.,JungB.andKoh,W.(2007)Testingpaneldataregressionmodelswithspatialandserialerrorcorrelation.JournalofEconometrics,140,5-51
.,Song,andKoh,W.(2003)Testingpaneldataregressionmodelswithspatialerrorcorrelation.JournalofEconometrics,117,123-150
G.,Piras,G.(2012)splm:
SpatialPanelDataModelsinR.JournalofStatisticalSoftware,47
(1),
(2003)Specificationandestimationofspatialpaneldatamodels,InternationalRegionalScienceReview,26,pages244-268
(2009)Spatialpaneldatamodels,InFisher,.andGetis,A.(eds),HandbookofAppliedSpatialAnalysisSpringer,Berlin
MilloandGaetanoCarmeci,(2011)“Non-lifeinsuranceconsumptioninItaly:
asubregionalpaneldataanalysis”,JournalofGeographicalSystems,13:
273-298
FengandWilliamC.Horrace,(2012)”AlternativeMeasuresofTechnicalEfficiency:
Skew,BiasandScale”,JournalofAppliedEconometrics,Forthcoming.
M.,Kelejian,.andPrucha,.(2007)Paneldatamodelwithspatiallycorrelatederrorcomponents,JournalofEconometrics,140,pages97-130
J.,andPfaffermayr,M.(2011)TheHausmantestinaCliffandOrdpanelmodel,EconometricsJournal,14,pages48-76
.andPrucha,.(1999)AGeneraliedMomentsEstimatorfortheAutoregressiveParameterinaSpatialModel,InternationalEconomicReviews,40,pages509-533
11.Kelejian,.andPrucha,.(1999)AGeneraliedSpatialTwoStageLeastSquareProcedureforEstimatingaSpatialAutoregressiveModelwithAutoregressiveDisturbances,JournalofRealEstateFinanceandEconomics,17,pages99-122
G.(2013)Maximumlikelihoodestimationofspatiallyandseriallycorrelatedpanelwithrandomeffects.ComputationalStatisticsandDataAnalysis,forthcoming.
A(2006)Object-OrientedComputationofSandwichEstimators.JournalofStatisticalSoftware,16(9),1-16
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 空间 面板 数据 分析 splm