r - Treating binary variables for first difference method to solve autocorrelation issue -
i have autocorrelation problem in panel data. decided use first difference method deal problem.
most of independent variables binary. if finite difference method on this, -1, 0, , 1 instead of 0 or 1 before.
is ok?
besides, data set time flow follows not sure how can apply first difference method in case when have multiple difference incidents happening on same day:
date id x y z l m b c d e 01/01/2017 0 1 0 0 0 0 1 0 0 7.8 01/01/2017 0 1 0 0 0 1 0 0 1 6.5 01/01/2017 b 0 0 0 0 1 1 0 0 1 6.5 01/03/2017 0 1 0 0 0 0 0 0 0 7.8 01/04/2017 c 0 0 1 0 0 1 0 0 0 6.5 01/04/2017 c 0 0 0 0 0 0 1 0 0 7.3
i sort again according date , id become follows:
date id x y z l m b c d e 01/01/2017 0 1 0 0 0 0 1 0 0 7.8 01/01/2017 0 1 0 0 0 1 0 0 1 6.5 01/01/2017 b 0 0 0 0 1 1 0 0 1 6.5 01/03/2017 0 1 0 0 0 0 0 0 0 7.8 01/04/2017 c 0 0 1 0 0 1 0 0 0 6.5 01/04/2017 c 0 0 0 0 0 0 1 0 0 7.3
besides, new data sorting ok use in panel regression , take first difference on utilizing row sequence?
a regressor may either time-invariant, or time-varying. estimators, notably within , first differences estimators coefficients of time-varying regressors identified (cameron , triverdi, microeconometric methods , applications.). of regressors seem time invariant.
you not dealing time series, panel or longitudinal data. of course have repeated id , dates. said, need deal autocorrelation panel data tools arellano-bond , blundell-bond estimators, mention few. see pgmm
in r plm package or xtdpdsys
or xtabond
in stata.
if have more 1 variable identifying panel id, can aggreagate using: r create id within group. if working stata do: egen id = group(sub_id_1 sub_id_2)
.
Comments
Post a Comment