微观计量经济学模型ModelofMicroeconometrics.docx

上传人:b****2 文档编号:24496217 上传时间:2023-05-28 格式:DOCX 页数:16 大小:104.28KB
下载 相关 举报
微观计量经济学模型ModelofMicroeconometrics.docx_第1页
第1页 / 共16页
微观计量经济学模型ModelofMicroeconometrics.docx_第2页
第2页 / 共16页
微观计量经济学模型ModelofMicroeconometrics.docx_第3页
第3页 / 共16页
微观计量经济学模型ModelofMicroeconometrics.docx_第4页
第4页 / 共16页
微观计量经济学模型ModelofMicroeconometrics.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

微观计量经济学模型ModelofMicroeconometrics.docx

《微观计量经济学模型ModelofMicroeconometrics.docx》由会员分享,可在线阅读,更多相关《微观计量经济学模型ModelofMicroeconometrics.docx(16页珍藏版)》请在冰豆网上搜索。

微观计量经济学模型ModelofMicroeconometrics.docx

微观计量经济学模型ModelofMicroeconometrics

微观计量经济学模型(ModelofMicroeconometrics)

1.1GeneralizedLinearModels

Threeaspectsofthelinearregressionmodelforaconditionallynormally

distributedresponseyare:

(1)Thelinearpredictori^xT-throughwhich"二E(yi|xj.

2

(2)yi|XiisN(叫,二)

(3)i

GLMs:

extends

(2)and(3)tomoregeneralfamiliesofdistributionsfory.

Specifically,y|xmayfollowadensity:

f(y;日冲)=expty日+c(y;$)[

二:

canonicalparameter,dependsonthelinearpredictor.

:

dispersionparameter,isoftenknown.

Alsoiand叫arerelatedbyamonotonictransformation,

g(mi

CalledthelinkfunctionoftheGLM.

SelectedGLMfamiliesandtheircanonicallink

Family

Canonicallink

Name

binomial

log(曰(1一巴)

logit

gaussian

identity

poisson

log卩

log

1.2BinaryDependentVariables

Model:

E(%|人)=Pi=F(x「),i=1,2,……n

Intheprobitcase:

fequalsthestandardnormalCDF

Inthelogitcase:

FequalsthelogisticCDF

Example:

⑴Data

Consideringfemalelaborparticipationforasampleof872womenfrom

Switzerland.

Thedependentvariable:

participation

Theexplainvariables:

income,age,education,youngkids,oldkids,foreignyesandageH.

R:

library("AER")

data("SwissLabor")

summary(SwissLabor)

 

(2)Estimation

R:

swiss_prob=glm(participation~.+l(ageA2),data=SwissLabor,family=binomial(link="probit"))

summary(swiss_prob)

Call:

glm(formula=participation~.+I(ageA2),family=binomial(link="probit"),

data=SwissLabor)

DevianceResiduals:

Min1QMedian3QMax

-1.9191-0.9695-0.47921.02092.4803

Coefficients:

EstimateStd.ErrorzvaluePr(>|z|)

(Intercept)3.749091.406952.6650.00771**

income

-0.66694

0.13196

-5.0544.33e-07***

age

2.07530

0.40544

5.1193.08e-07***

education

0.01920

0.01793

1.0710.28428

youngkids

-0.71449

0.10039

-7.1171.10e-12***

oldkids

-0.14698

0.05089

-2.8880.00387**

foreignyes

0.71437

0.12133

5.8883.92e-09***

I(ageA2)

-0.29434

0.04995

-5.8933.79e-09***

 

Signif.codes:

0'***'0.001'**'0.01'*'0.05'.'0.1''1

(Dispersionparameterforbinomialfamilytakentobe1)

Nulldevianee:

1203.2on871degreesoffreedom

Residualdevianee:

1017.2on864degreesoffreedom

AIC:

1033.2

NumberofFisherSeoringiterations:

4

(3)Visualization

Plottingpartieipationversusage

R:

plot(partieipation~age,data=SwissLabor,ylevels=2:

1)

o

QU

scda

4

ega

 

(4)Effects

Xj

 

 

(x「)r

Averagemarginaleffects:

Theaverageofthesamplemarginaleffects:

R:

fav=mean(dnorm(predict(swiss_prob,type="link")))fav*coef(swiss_prob)

oldkidsforeignyesI(ageA2)

Theaveragemarginaleffectsattheaverageregressor:

R

av=colMeans(SwissLabor[,-c(1,7)])

av=data.frame(rbind(swiss=av,foreign=av),foreign=factor(c("no","yes"|))av=predict(swiss_prob,newdata=av,type="link")

av=dnorm(av)

av["swiss"]*coef(swiss_prob)[-7]

av["foreign"]*coef(swiss_prob)[-7]

swiss:

(Intercept)incomeageeducationyoungkids

oldkidsI(ageA2)

Foreign:

(Intercept)

incomeageeducationyoungkids

oldkids

I(ageA2)

(5)Goodnessoffitandprediction

Pseudo-R2:

R2=1』

C)

(?

)asthelog-likelihoodforthefittedmodel,0)(?

)asthelog-likelihoodforthemodelcontainingonlyaconstantterm.

R:

swiss_prob0=update(swiss_prob,formula=.~1)

1-as.vector(logLik(swiss_prob)/logLik(swiss_prob0))[1]0.1546416

Percentcorrectlypredicted:

R:

table(true=SwissLabor$participation,pred=round(fitted(swiss_prob)))

pred

true

0

1

no

337

134

yes

146

255

67.89%

ROCcurve:

TPR(c):

thenumberofwomenparticipatinginthelaborforcethatare

classifiedasparticipatingcomparedwiththetotalnumberofwomenparticipating.

FPR(c):

thenumberofwomennotparticipatinginthelaborforcethatareclassifiedasparticipatingcomparedwiththetotalnumberofwomennotparticipating.

R:

lbrary("ROCR")

pred=prediction(fitted(swiss_prob),SwissLabor$participation)

plot(performance(pred,"acc"))

plot(performance(pred,"tpr","fpr"))

abline(0,1,lty=2)

Cutoff

010s.o

iggoA昌」nCJov

0^.0

O

QLIcoo

go寸ofo欝」cltAESUdCItnH

Extensions:

Multinomialresponses

Forillustratingthemostbasicversionofthemultinomiallogitmodel,amodelwithonlyindividual-specificcovariates,.

data("BankWages")

Itcontains,foremployeesofaUSbank,anorderedfactorjobwithlevels

"custodial","admin"(foradministration),and"manage"(for

management),tobemodeledasafunctionofeducation(inyears)andafactorminorityindicatingminoritystatus.Therealsoexistsafactorgender,butsincetherearenowomeninthecategory"custodial",onlyasubsetofthedatacorrespondingtomalesisusedforparametricmodelingbelow.

summary(BankWages)

jobeducationgenderminoritycustodial:

27Min.:

8.00male:

258no:

370admin:

3631stQu.:

12.00female:

216yes:

104manage:

84Median:

12.00

Mean:

13.49

3rdQu.:

15.00Max.:

21.00

summary(BankWages)edcat<-factor(BankWages$education)edcatlevels(edcat)[3:

10]<-rep(c("14-15","16-18","19-21"),+c(2,3,3))head(edcat)

tab<-xtabs(~edcat+job,data=BankWages)head(tab)prop.table(tab,1)head(BankWages)

library("nnet")bank_mn2<-multinom(job~education+minority+gender,data=BankWages,trace=FALSE)

summary(bank_mn2)

1.3RegressionModelsforCountData

Webeginwiththestandardmodelforcountdata,aPoissonregression.

PoissonRegressionModel:

E®m二exp(XjT)

Canonicallink:

theloglink

Example:

TripstoLakeSomerville,Texas,1980.basedonasurveyadministeredto2,000registeredleisureboatownersin23countiesineasternTexas.Thedependentvariableistrips,andwewanttoregressitonallfurthervariables:

a(subjective)qualityrankingofthefacility(quality),afactorindicatingwhethertheindividualengagedinwater-skiingatthelake(ski),householdincome(income),afactorindicatingwhethertheindividualpaidauser'sfeeatthelake(userfee),andthreecostvariables(costC,costS,costH)representingopportunitycosts.

⑴Data

data("RecreationDemand")

tripsqualityski

Min.:

0.000Min.:

0.000no:

417

1stQu.:

0.0001stQu.:

0.000yes:

242

Median:

0.000Mean:

2.2443rdQu.:

2.000

Max.:

88.000

costC

Median:

0.000

Mean:

1.419

3rdQu.:

3.000

Max.:

5.000

costS

incomeuserfee

Min.:

1.000no:

6461stQu.:

3.000yes:

13

Median:

3.000

Mean3853

3rdQu.:

5.000

Max.:

9.000

costH

Min.

4.34Min.:

4.767Min.

5.70

1stQu.:

28.24

1stQu.:

33.312

1stQu.:

28.96

Median:

41.19

Median:

47.000

Median:

42.38

Mean

:

55.42Mean:

59.928

Mean:

55.99

summary(RecreationDemand)

 

3rdQu.:

69.673rdQu.:

72.5733rdQu.:

68.56

Max.:

493.77Max.:

491.547Max.:

491.05

head(RecreationDemand)

trips

qualityskiincome

userfee

costC

costS

costH

1

0

0yes

4

no

67.59

68.620

76.800

2

0

0no

9

no

68.86

70.936

84.780

3

0

0yes

5

no

58.12

59.465

72.110

4

0

0no

2

no

15.79

13.750

23.680

5

0

0yes

3

no

24.02

34.033

34.547

6

0

0yes

5

no129.46

137.377

137.850

(2)Estimationrd_pois=glm(trips~.,data=RecreationDemand,family=poisson)coeftest(rd_pois)

ztestofcoefficients:

EstimateStd.ErrorzvaluePr(>|z|)

(Intercept)

0.26499340.09372222.82740.004692**

quality

0.47172590.017090527.6016<2.2e-16***

skiyes

0.41821370.05719027.31272.619e-13***

income

-0.11132320.0195884-5.68311.323e-08***

userfeeyes

0.89816530.078985111.3713<2.2e-16***

costC

-0.00342970.0031178-1.10010.271309

costS

-0.04253640.0016703-25.4667<2.2e-16***

costH

0.03613360.002709613.3353<2.2e-16***

Signif.codes:

0‘***'0.001‘**'0.01‘*'0.05‘.'0.1

R:

logLik(rd_pois)

thelog-likelihoodofthefittedmodel:

'logLik.'-1529.431(df=8)

rbind(obs=table(RecreationDemand$trips)[1:

10],exp=round(

+sapply(0:

9,function(x)sum(dpois(x,fitted(rd_pois))))))

0123456789

obs417683834171311281

exp277146684130231713107

table(true=RecreationDemand$trips,pred=round(fitted(rd_nb)))

NOTWELL

(3)Dealingwithoverdispersion

Poissondistributionhasthepropertythatthevarianceequalsthemean.Ineconometrics,Poissonregressionsareoftenplaguedbyoverdispersion.Onewayoftestingforoverdispersionistoconsiderthealternativehypothesis(CameronandTrivedi1990)

Var(yi|xi)=a*h(+^i)

wherehisapositivefunctionof.

Overdispersioncorrespondstoa>0andunderdispersiontoa<0.

Commonspecificationsofthetransformationfunctionhareh(2or卩)=卩

h(□)=□.Theformercorrespondstoanegativebinomial(NB)model(see

below)withquadraticvariancefunction(calledNB2byCameronand

Trivedi1998),thelattertoanNBmodelwithlinearvariancefunction

(calledNB1byCameronandTrivedi1998).Inthestatisticalliterature,

thereparameterization

Var(yi|xi)=(1+a)•卩i=dispersion•

oftheNB1modelisoftencalledaquasi-Poissonmodelwithdispersionparameter.

R:

dispersiontest(rd_pois)

Overdispersiontestdata:

rd_poisz=2.4116,p-value=0.007941alternativehypothesis:

truedispersionisgreaterthan1sampleestimates:

dispersion

6.5658

R:

dispersiontest(rd_pois,trafo=2)Overdispersiontest

data:

rd_poisz=2.9381,p-value=0.001651alternativehypothesis:

truealphaisgreaterthan0sampleestimates:

alpha1.316051

BothsuggestthatthePoissonmodelforthetripsdataisnotwell

specified.

Onepossibleremedyistoconsideramoreflexibledistributionthatdoesnotimposeequalityofmeanandvariance.

Themostwidelyuseddistributioninthiscontextisthenegativebinomial.ItmaybeconsideredamixturedistributionarisingfromaPoissondistributionwithrandomscale,thelatterfollowingagammadistribution.Itsprobabilitymassfunctionis

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1