dimanche 3 juin 2018

How to divide time series data in different periods with if condition using Stata 12.1?

I'm doing a OLS-regression of monthly time series data (1970-2018) in stata 12.1.

gen MONTH= mofd(month)
format MONTH %tm
tsset MONAT
//OLS-Regression
regress Return May
estat hettest, rhs
estat szroeter, rhs
display floor(4*(r(N)/100)^(2/9))
estat durbinalt, lags(1/5)
estat dwatson
estat bgodfrey, lags(1/1)

As a robustness test I'd like to run the regression again, but divide the data in different periods e.g. 1970-1980, 1980-1990 etc. without midifying the original data set.

I've read the if and if qualifier manual, but neither of them works the way i want it to.

regress May Return if MONTH <=td(01aug1990)

or

if MONTH <=tm(01aug1990){
regress Return May
}

Both run without error messages, but neither of them returns data only for the given period. Both versions are looking at the full data set. What did I do wrong? I appreciate your help.

Aucun commentaire:

Enregistrer un commentaire