La siguiente entrada muestra como realizar algunas estimaciones de modelos lineales, asumiendo distintas formas funcionales, que permiten un mejor ajuste del modelo a las relaciones observadas en los datos.
> library(wooldridge)
> attach(wage1)
>
library(stargazer)
# Modelo lineal
mod1<-lm(wage~educ,
data=wage1)
# Modelo log-log
mod2<-lm(log(wage)~log(1+educ),
data=wage1)
# Modelo nivel-log
mod3<-lm(wage~log(1+educ),
data=wage1)
# Modelo log-nivel
mod4<-lm(log(wage)~(1+educ),
data=wage1)
>
stargazer(mod1,mod2,mod3,mod4, type="text")
========================================================================
Dependent variable:
-----------------------------------------
wage log(wage) wage
log(wage)
(1) (2)
(3) (4)
------------------------------------------------------------------------
educ
0.541***
0.083***
(0.053)
(0.008)
log(1 + educ)
0.669*** 4.317***
(0.080)
(0.558)
Constant
-0.905 -0.103 -5.237*** 0.584***
(0.685) (0.206) (1.446)
(0.097)
------------------------------------------------------------------------
Observations
526
526 526
526
R2
0.165 0.119
0.103 0.186
Adjusted R2
0.163 0.117 0.101
0.184
Residual Std. Error
(df = 524) 3.378 0.499
3.502 0.480
F Statistic (df = 1;
524) 103.363*** 70.877*** 59.964*** 119.582***
========================================================================
Note:
*p<0.1; **p<0.05;
***p<0.01
# Modelo con
inateracciones
>
summary(lm(wage~educ+I(educ*educ), data=wage1))
Call:
lm(formula = wage ~
educ + I(educ * educ), data = wage1)
Residuals:
Min 1Q Median 3Q
Max
-6.8722 -2.0002 -0.7472
1.2642 17.0159
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)
5.40769 1.45886 3.707 0.000232 ***
educ
-0.60750 0.24149 -2.516 0.012181
*
I(educ * educ)
0.04907 0.01007 4.872 1.46e-06 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard
error: 3.307 on 523 degrees of freedom
Multiple
R-squared: 0.201, Adjusted
R-squared: 0.198
F-statistic: 65.79 on
2 and 523 DF, p-value: < 2.2e-16