ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Tarea N°1 prueba de raiz unitaria


Enviado por   •  21 de Septiembre de 2020  •  Informe  •  1.486 Palabras (6 Páginas)  •  114 Visitas

Página 1 de 6

[Workspace loaded from D:/eco3-2020/.RData]

> # Puno, 21-09-20

> # Taller de econometria III

> # Tema: Prueba de raíz unitaria

> #

> #

> # Aplicacion en R studio.

> #

> #

> rm (list = ls ())

> library(readxl)

> library(tseries)

Registered S3 method overwritten by 'quantmod':

  method            from

  as.zoo.data.frame zoo

    ‘tseries’ version: 0.10-47

    ‘tseries’ is a package for time series analysis and computational finance.

    See ‘library(help="tseries")’ for details.

> library(tseries)

> library(urca)

> getwd() # muestra el directorio actual

[1] "D:/eco3-2020"

> setwd("d:/eco3-2020")

> datosxlsx<- read_xlsx("d:/eco3-2020/pbiganual.xlsx")

> attach(datosxlsx)

> names(datosxlsx)

[1] "años" "cpr"  "ibi"  "gpu"  "exp"  "imp"  "pbi"

> # Transformacion de variables

> lncpr<-log(cpr)

> # definiendo variables de series de tiempo

> lncprts=ts(lncpr, start = c(1950,1), end=c(2019,1), freq=1)

> #

> # Prueba de raíz unitaria de Dickey Fuller

> #

> dfs<- adf.test(log(lncprts),k=0) # prueba de RU de DF simple

> dfs

        Augmented Dickey-Fuller Test

data:  log(lncprts)

Dickey-Fuller = -2.0125, Lag order = 0, p-value = 0.5701

alternative hypothesis: stationary

> dfa<-adf.test(log(lncprts)) # prueba de RU de DFA

> # alternativamente puede ejecutar con las instrucciones

> dfa

        Augmented Dickey-Fuller Test

data:  log(lncprts)

Dickey-Fuller = -1.897, Lag order = 4, p-value = 0.6171

alternative hypothesis: stationary

> lc.df <- ur.df(y= lncprts, type='drift',lags=4, selectlags=c("AIC"))

> summary(lc.df)

###############################################

# Augmented Dickey-Fuller Test Unit Root Test #

###############################################

Test regression drift

Call:

lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)

Residuals:

      Min        1Q    Median        3Q       Max

-0.126111 -0.023551  0.005713  0.027482  0.112762

Coefficients:

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

(Intercept)  0.077624   0.114673   0.677  0.50102    

z.lag.1     -0.004414   0.009849  -0.448  0.65557    

z.diff.lag1  0.583373   0.119635   4.876 8.08e-06 ***

z.diff.lag2 -0.348732   0.119690  -2.914  0.00499 **

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.04404 on 61 degrees of freedom

Multiple R-squared:  0.289,        Adjusted R-squared:  0.2541

F-statistic: 8.267 on 3 and 61 DF,  p-value: 0.0001066

Value of test-statistic is: -0.4482 7.1155

Critical values for test statistics:

      1pct  5pct 10pct

tau2 -3.51 -2.89 -2.58

phi1  6.70  4.71  3.86

> lc.df <- ur.df(y= lncprts, type='none',lags=4, selectlags=c("AIC"))

> summary(lc.df)

###############################################

# Augmented Dickey-Fuller Test Unit Root Test #

###############################################

Test regression none

Call:

lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:

      Min        1Q    Median        3Q       Max

-0.127027 -0.024450  0.006763  0.027314  0.113297

Coefficients:

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

z.lag.1      0.0022396  0.0006008   3.727 0.000421 ***

z.diff.lag1  0.5843514  0.1191027   4.906 7.05e-06 ***

z.diff.lag2 -0.3512115  0.1191099  -2.949 0.004496 **

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.04384 on 62 degrees of freedom

Multiple R-squared:  0.5088,        Adjusted R-squared:  0.485

F-statistic: 21.41 on 3 and 62 DF,  p-value: 1.236e-09

Value of test-statistic is: 3.7275

Critical values for test statistics:

     1pct  5pct 10pct

tau1 -2.6 -1.95 -1.61

> # Prueba de Phillips - Perron

> pp.test(log(lncprts)) # Prueba de RU de Phillips Perron

        Phillips-Perron Unit Root Test

data:  log(lncprts)

Dickey-Fuller Z(alpha) = -7.0337, Truncation lag parameter = 3, p-value = 0.7014

alternative hypothesis: stationary

> lc.df <- ur.df(y= lncprts, type='trend',lags=4, selectlags=c("AIC"))

> summary(lc.df)

###############################################

# Augmented Dickey-Fuller Test Unit Root Test #

###############################################

Test regression trend

Call:

lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)

Residuals:

     Min       1Q   Median       3Q      Max

-0.12226 -0.02436  0.01097  0.02514  0.11185

Coefficients:

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

...

Descargar como (para miembros actualizados) txt (8 Kb) pdf (38 Kb) docx (14 Kb)
Leer 5 páginas más »
Disponible sólo en Clubensayos.com