计量经济学

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

C5.1

(1)代码:mydata<-read.csv("C:\\Users\\x1nreborn\\Desktop\\新建文件夹\\伍德里奇计量经济学导论第四版数据总和\\excel 伍德里奇\\wage1.csv", header=F,sep=",",stringsAsFactors=FALSE)

wage<-mydata[,1:4]

names(wage)<-c("wage","educ","exper","tenure")

fit1<-lm(wage~educ+exper+tenure,data=wage)

fit1

summary(fit1)

residual<-resid(fit1)

hist(residual)

结果:Coefficients:(Intercept) educ exper tenure -2.87273 0.59897 0.02234 0.16927 Residuals:

Min 1Q Median 3Q Max

-7.6068 -1.7747 -0.6279 1.1969 14.6536

Histogram of residual

residual F r e q u e n c y

-505

10

15

05010015020

(2)代码:mydata<-read.csv("C:\\Users\\x1nreborn\\Desktop\\新建文件夹

\\伍德里奇计量经济学导论第四版数据总和\\excel 伍德里奇\\wage1.csv", header=F,sep=",",stringsAsFactors=FALSE)

wage<-mydata[,1:4]

names(wage)<-c("wage","educ","exper","tenure")

fit2<-lm(log(wage)~educ+exper+tenure,data=wage)

fit2

summary(fit2)

residual2<-resid(fit2)

hist(residual2)

结果:Coefficients:(Intercept) educ exper tenure 0.284360 0.092029 0.004121 0.022067 Residuals:

Min 1Q Median 3Q Max

-2.05802 -0.29645 -0.03265 0.28788 1.42809

Histogram of residual2

residual2F r e q u e n c y

-2-1

1

05010015020

(3)我认为对数—水平值模型更接近于满足假定MLR.6

C5.2

(1)代码:

mydata<-read.csv("C:\\Users\\x1nreborn\\Desktop\\新建文件夹\\伍德里奇计量经济学导论第四版数据总和\\excel伍德里奇\\gpa2.csv",

header=F,sep=",",stringsAsFactors=FALSE)

gpa2<-mydata[,c(1,3,8)]

names(gpa2)<-c("sat","colgpa","hsperc")

fit<-lm(colgpa~hsperc+sat,data=gpa2)

summary(fit)

结果:

Coefficients:

(Intercept) hsperc sat

1.391757 -0.013519 0.001476

Coefficients:

Estimate Std. Error t value Pr(>|t|)

(Intercept) 1.392e+00 7.154e-02 19.45 <2e-16

hsperc -1.352e-02 5.495e-04 -24.60 <2e-16

sat 1.476e-03 6.531e-05 22.60 <2e-16

(2)代码:

gpa3<-gpa2[1:2070,]

fit1<-lm(colgpa~hsperc+sat,data=gpa3)

结果:

Coefficients:

(Intercept) hsperc sat

1.436017 -0.012749 0.001468

(3)c11=4.6 c12=0.0353 c13=0.0042

c21=4.4 c22=0.0327 c23=0.00403

所以c1i=c2i,可认为符合(5.10)中的等式。

C5.3

mydata<-read.csv("C:\\Users\\x1nreborn\\Desktop\\新建文件夹\\伍德里奇

计量经济学导论第四版数据总和\\excel伍德里奇\\bwght.csv",

header=F,sep=",",stringsAsFactors=FALSE)

bwght1<-mydata[,c(4,10,7,1,5,6)]

names(bwght1)<-c("bwght","cigs","parity","faminc","motheduc","fathedu c")

bwght1$motheduc[bwght1$motheduc=="."]<-NA

bwght1$fatheduc[bwght1$fatheduc=="."]<-NA

bwght2<-na.omit(bwght1)

fit<-lm(bwght~cigs+parity+faminc+motheduc+fatheduc,data=bwght2)

R<-residuals(fit)

bwght2$R<-R

fit1<-lm(R~cigs+parity+faminc+motheduc+fatheduc,data=bwght2)

结果显示,motheduc和fatheduc不联合显著。

C6.2

(1)代码:

mydata<-read.csv("C:\\Users\\x1nreborn\\Desktop\\新建文件夹\\伍德里奇计量经济学导论第四版数据总和\\excel伍德里奇\\wage1.csv",

header=F,sep=",",stringsAsFactors=FALSE)

wage<-mydata[,1:3]

names(wage)<-c("wage","educ","exper")

fit1<-lm(log(wage)~educ+exper+I(exper^2),data=wage)

结果:

Coefficients:

(Intercept) educ exper I(exper^2)

0.1279975 0.0903658 0.0410089 -0.0007136

Coefficients:

Estimate Std. Error t value Pr(>|t|)

相关文档
最新文档