This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

License: CC BY-SA 4.0

License: CC BY-SA 4.0

1 Primeiros passos

Os primeiros passos são criar ou abrir um diretório de trabalho. Se optar por criar um novo projeto, haverá a possibilidade de criar em uma pasta vazia. Os dados básicos estão no pacote wooldridge, dataset fertil3.

Example 10.4 Effects of Personal exemption on fertility rates. The general fertility rate (gfr) is the number of children born to every 1,000 women of childbearing age. For the years 1913 through 1984, the equation, \[ gfr_t= \beta _0 + \beta _1 pe_t +\beta _2 ww2_t + \beta _3 pill_t + \mu _t ,\] explains gfr in terms of the average real dollar value of the personal tax exemption (pe) and two binary variables. The variable ww2 takes on the value unity during the years 1941 through 1945, when the United States was involved in World War II. The variable pill is unity from 1963 onward, when the birth control pill was made available for contraception. Using the data in FERTIL3, which were taken from the article by Whittington, Alm, and Peters (1990).

> library(dynlm);library(stargazer)
> data(fertil3, package='wooldridge')
> 
> # exemplo 10.8 do livro do Wooldridge, Introdução a Econometria
> # dados basicos de: 
> # Wooldridge Source: L.A. Whittington, J. Alm, and H.E. Peters (1990), 
> # “Fertility and the Personal Exemption: Implicit Pronatalist Policy in
> # the United States,” American Economic Review 80, 545-556.
> 
> # data.frame with 72 observations on 24 variables:
>   
> # gfr: births per 1000 women 15-44 [tgf]
> # pe: real value pers. exemption, $ [ip]
> # year: 1913 to 1984   [ano]
> # t: time trend, t=1,...,72   [tendencia]
> # tsq: t^2    [tendencia ao quadrado]
> # pill: =1 if year >= 1963    [pilula anticoncepcional]
> # ww2: =1, 1941 to 1945  [world war dummy]
> # tcu: t^3    [tendencia cubica]
> # cgfr: change in gfr: gfr - gfr_1    [mudanca na tx de fertilidade]
> 
> 
> # Definir time series anual iniciando em 1913
> attach(fertil3)
> tsdata <- ts(fertil3, start=1913)

O gráfico da variável dependente gfr é:

> require(fpp2)
> autoplot(as.ts(gfr))

2 Resultados

2.1 Estimação

Vamos estimar o modelo linear múltipla fazendo a regressão inicial conforme o exemplo 10.4.

> # Regressao Linear :
> reg1 <- dynlm(gfr ~ pe+ww2+pill, data=tsdata)
> stargazer(reg1,type = "text", style = "all",omit.stat = ("f"))

===============================================
                        Dependent variable:    
                    ---------------------------
                                gfr            
-----------------------------------------------
pe                           0.083***          
                              (0.030)          
                             t = 2.784         
                             p = 0.007         
ww2                         -24.238***         
                              (7.458)          
                            t = -3.250         
                             p = 0.002         
pill                        -31.594***         
                              (4.081)          
                            t = -7.742         
                             p = 0.000         
Constant                     98.682***         
                              (3.208)          
                            t = 30.760         
                             p = 0.000         
-----------------------------------------------
Observations                    72             
R2                             0.473           
Adjusted R2                    0.450           
Residual Std. Error      14.685 (df = 68)      
===============================================
Note:               *p<0.1; **p<0.05; ***p<0.01

2.2 Regressão com tendência

> # Regressao exemplo 10.8 - incluindo tendencia
> reg2 <- dynlm(gfr ~ pe + ww2 + pill + trend(tsdata), data=tsdata)
> reg2.a<-dynlm(gfr ~ pe + ww2 + pill + t, data=tsdata)
> stargazer(reg2,reg2.a,type = "text",omit.stat = ("f"))

==========================================================
                                  Dependent variable:     
                              ----------------------------
                                          gfr             
                                   (1)            (2)     
----------------------------------------------------------
pe                               0.279***      0.279***   
                                 (0.040)        (0.040)   
                                                          
ww2                             -35.592***    -35.592***  
                                 (6.297)        (6.297)   
                                                          
pill                              0.997          0.997    
                                 (6.262)        (6.262)   
                                                          
trend(tsdata)                   -1.150***                 
                                 (0.188)                  
                                                          
t                                              -1.150***  
                                                (0.188)   
                                                          
Constant                        111.769***    111.769***  
                                 (3.358)        (3.358)   
                                                          
----------------------------------------------------------
Observations                        72            72      
R2                                0.662          0.662    
Adjusted R2                       0.642          0.642    
Residual Std. Error (df = 67)     11.849        11.849    
==========================================================
Note:                          *p<0.1; **p<0.05; ***p<0.01

2.3 Regressão com a tendência quadrática

> reg3<-reg2 <- dynlm(gfr ~ pe + ww2 + pill + 
+                       t+I(t^2), data=tsdata)
> stargazer(reg2.a,reg3,type = "text",style="all",omit.stat = ("f"))

=====================================================
                           Dependent variable:       
                    ---------------------------------
                                   gfr               
                          (1)              (2)       
-----------------------------------------------------
pe                      0.279***         0.348***    
                        (0.040)          (0.040)     
                       t = 6.968        t = 8.639    
                       p = 0.000        p = 0.000    
ww2                    -35.592***       -35.880***   
                        (6.297)          (5.708)     
                       t = -5.652       t = -6.286   
                      p = 0.00000      p = 0.00000   
pill                     0.997           -10.120     
                        (6.262)          (6.336)     
                       t = 0.159        t = -1.597   
                       p = 0.874        p = 0.116    
t                      -1.150***        -2.531***    
                        (0.188)          (0.389)     
                       t = -6.119       t = -6.501   
                      p = 0.00000       p = 0.000    
I(t2)                                    0.020***    
                                         (0.005)     
                                        t = 3.945    
                                        p = 0.0002   
Constant               111.769***       124.092***   
                        (3.358)          (4.361)     
                       t = 33.287       t = 28.457   
                       p = 0.000        p = 0.000    
-----------------------------------------------------
Observations               72               72       
R2                       0.662            0.727      
Adjusted R2              0.642            0.706      
Residual Std. Error 11.849 (df = 67) 10.739 (df = 66)
=====================================================
Note:                     *p<0.1; **p<0.05; ***p<0.01