File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ # 把資料叫進R studio
2+ load(" C:/Users/simone/Desktop/計量經濟學(一)/R/wage1.RData" )
3+ View(data )
4+
5+ # log(wage) on educ,exper,tenure的多變量回歸模型
6+ regression = lm(formula = log(wage )~ educ + exper + tenure ,data )
7+ summary(regression )
8+
9+ # partialling out interpretation of the OLS
10+ # 步驟一:算出educ on exper,tenure的多變量回歸模型,save the residuals to excel
11+ regression1 = lm(formula = educ ~ exper + tenure ,data )
12+ summary(regression1 )
13+ u = residuals(regression1 )
14+ View(u )
15+
16+ # 把殘差和wage存在同一個excel檔(檔名Wage11),把它叫進來
17+ library(readxl )
18+ wage1 <- read_excel(" wage11.xlsx" )
19+ View(wage11 )
20+
21+ # 對log(wage) on V1(殘差)做迴歸分析
22+ regression2 = lm(formula = log(wage )~ V1 , wage11 )
23+ summary(regression2 )
Original file line number Diff line number Diff line change 1+ # 叫wage2的資料進來
2+ load(" C:/Users/simone/Desktop/計量經濟學(一)/R/wage2.RData" )
3+ View(data )
4+
5+ # 對IQ on educ做迴歸分析
6+ a = lm(formula = IQ ~ educ ,data )
7+ summary(a )
8+
9+ # 對log(wage) on educ做迴歸分析
10+ b = lm(formula = log(wage )~ educ ,data )
11+ summary(b )
12+
13+ # 對log(wage) on educ,IQ做迴歸分析
14+ lm(formula = log(wage )~ educ + IQ ,data = data )
You can’t perform that action at this time.
0 commit comments