# 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.

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

## Related Questions

### Prediction Intervals (Conformal Predictions) for Regression Problems

0  Asked on December 29, 2021 by bioinformatics_student

### Why not use % change in regression instead of log diff?

0  Asked on December 29, 2021 by tjaqu787

### Estimating expected values for correlated data using random effects models

4  Asked on December 29, 2021 by nicolas-molano

### Should multiple testing correct with bonferroni ever reduce a p value’s size?

1  Asked on December 29, 2021

### Compute Mean of a Clipped Normal Distribution

2  Asked on December 29, 2021 by ahsan

### What is an example of perfect multicollinearity?

3  Asked on December 27, 2021 by tsteatime

### Should I use a seasonal arima or stl decomposition and model residuals only?

1  Asked on December 27, 2021 by string_is_hard

### Endogenous controls in linear regression – Alternative approach?

2  Asked on December 27, 2021 by sgtbp

### Variable selection in logistic regression model

3  Asked on December 27, 2021

### EM Algorithm Derivation, Discrete Case

1  Asked on December 27, 2021

### Should we really do Re-Sampling in Class Imbalance data?

2  Asked on December 27, 2021 by baktaawar

### How to determine data size is statistically efficient?

0  Asked on December 27, 2021 by 1111ktq

### (Non-limit) distribution of maxima from different univariate, discrete and stationary time series

1  Asked on December 27, 2021

### Confused about stationarity and ARIMA processes

2  Asked on December 27, 2021

### How to remove correlated features?

1  Asked on December 27, 2021 by ichait

### Between- and within-person level effects when using multilevel modelling for longitudinal data in R

1  Asked on December 27, 2021 by af1402

### How can I separate the abundance factor of the incidence results?

0  Asked on December 27, 2021

### Chi Square Test on non-numeric data in R

0  Asked on December 27, 2021 by ruffybeo

### How to make correlation test with compositional data?

0  Asked on December 27, 2021

### What are the parameters in signal recovery? Whether source of these parameters are the sampling property of impulse response?

0  Asked on December 27, 2021 by lakshman

### Ask a Question

Get help from others!