TransWikia.com

How to set up first differences model?

Cross Validated Asked by Fabio on September 21, 2020

I am new to R and only know the very basics. Currently I am trying to estimate a model which is very simple, but I have problems thinking about how to set it up. Precisely, I am trying to estimate the following equation:

a(t) - a(t-1) = alpha + beta1 c(t) + beta2 c(t+1)

My data consists of 341 scenarios and each scenario calculates me 10 values for a and 10 values for c, meaning I got "10 ts", which gives me in total 341x2x10 = 6820 data points.
My problem is that I don’t know how to set this up. I brought my data already into tidy format and now I just want to get started, but how?

  • Looping approach

    Should I try to estimate this equation for 1 scenario and then try to loop the resulting code over the other scenarios? And if yes, how exactly would I do so? By using the diff() function, storing the result somewhere, looping over the other 340 scenarios, which would give me 341 stored results? How would I then combine these 341 results in the end?

  • Time series / panel data approach

    Should I rather focus on "the panel data character" of my data? (to be honest I am not even sure if it’s panel data or time series). In that case I would read a bit more into working with time series / panel data.

I am sure there are several options to do this (quite basic) estimation. I just don’t know which way to go, and once I decide for a specific way, how to carry it out and set it up.
I would just like to have a kind of roadmap for how to set this whole thing up.

One Answer

My advice is go for panel, the best choice here.

https://cran.r-project.org/web/packages/plm/vignettes/plmPackage.html

Really simple package to understand and a good example in this link.

Answered by josef_joestarr on September 21, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP