1. ## Re: Regression in STATA

I know how to do it. I am going to try, but this may take a while. I'll keep you posted.

2. ## Re: Regression in STATA

Hi guys,

I understand the way for creating this variable. So I tried it, but after 26 hours I broke the regression down.
Could anybody explain me why this takes so much time? I have 1662 products which eacht have a time horizon of 8 years daily data.
I know that this is a large dataset (3.6 million rows), but after 26 hours doing the -rolling-command STATA was by product 10. So could anyone explain me why this takes so long? And if there is a way of doing this more quickly? Because if I want it to do this, following this way, it may take a week to create that variable.
I hope you have some answers guys.
Regards,

3. ## Re: Regression in STATA

It could be slow if you have a large data set and apply -rolling- to panel data set.
You could use one panel each time and apply -rolling- to time-series but not panel data.

You could also calculate your own rolling. The difference is that if you have a gap or a missing value in the windows, missing value is returned rather than that the remaining non-missing observations' mean is calculated. Here is an example with window 10:

***************************
clear
set obs 3
set seed 12345
generate product = _n
expand 20
bysort product: generate time = _n
list

generate inc = int(runiform()*3)
tsset product time

local exp L.inc
forvalues i=2/10 {
local exp `exp' + L`i'.inc
}

di "`exp'"
generate rolmean = (`exp')/10

list
*******************

Originally Posted by Statahulk
Hi guys,

I understand the way for creating this variable. So I tried it, but after 26 hours I broke the regression down.
Could anybody explain me why this takes so much time? I have 1662 products which eacht have a time horizon of 8 years daily data.
I know that this is a large dataset (3.6 million rows), but after 26 hours doing the -rolling-command STATA was by product 10. So could anyone explain me why this takes so long? And if there is a way of doing this more quickly? Because if I want it to do this, following this way, it may take a week to create that variable.
I hope you have some answers guys.
Regards,

4. ## Re: Regression in STATA

I have split my dataset into multiple small datasets. I have 1662 products (panel data). But now I am running the -rolling-command over 25 products. This takes 40 minutes. So at the end i will have about 66 dataset which have to be merged. I don't see another opportunity.