Difficulty to decompose time series in r

Asked

Viewed 283 times

1

I’m trying to use the R for the first time. I’m trying to assess possible shocks in a VAR model, so I can’t develop the decomp test. being my main question the message "time series has no period, or has less than 2"

At first I used the following code.

    dados.ts <- ts(data = Lmacro$PIB, frequency = 1)
    dados.ts.dec <- decompose(dados.ts, type = "mult")
  1. Being Lmacro, the logarithms data of my model at first started by the variable PIB.

  2. Unfortunately I do not know the other characteristics of the function.

  3. The spreadsheet has identification of the years, but I won’t be able to say how I associated with the data.

excel XLSX database. https://gitlab.com/fellipesillvaoff/TCC/blob/master/tcc%20excel_pt.xlsx

Features of the system:

    R version 3.4.1 (2017-06-30)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows >= 8 x64 (build 9200)

    Matrix products: default

    locale:
    [1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252   
    [3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C                      
    [5] LC_TIME=Portuguese_Brazil.1252    

    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods   base     

    other attached packages:
    [1] vars_1.5-2        lmtest_0.9-35     urca_1.3-0                                strucchange_1.5-1 sandwich_2.4-0   
    [6] zoo_1.8-1         MASS_7.3-49       Matrix_1.2-12    

    loaded via a namespace (and not attached):
    [1] compiler_3.4.1  tools_3.4.1     nlme_3.1-131.1  grid_3.4.1              lattice_0.20-35

Thank you.

  • 2

    I believe that this error message says it all, if the series has less than 2 periods it is because it is not periodic and not worth insisting. It’s not in the data. I’d start with acf and pacf. Then maybe (for sure) diff.

1 answer

0


According to Rui’s answer. For the specific case there is no viable return to the command, because actually the serious response is less than or equal to 2 periods.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.