Hello,
I am currently having some issues with the "rangestat" function. I am attempting to compute a rolling mean of variable X, which has unique values for each year and state. I would like to compute a rolling average of X using all the values of X since 1960. For example, for the entry "Alabama" "1990" I would like to generate the average value of X for each year between 1960 and 1990 within Alabama.
In order to do this, I constructed the variable "years_from_1960" as -(year - 1960). This command works fine. Then I do the following:
rangestat (mean) rm_X = X, interval(years_from_1960 years_from_1960 0) by(statename)
Initially, this command correctly generated rolling averages. However, the last few times I have run the command (without changing anything), rm_X is just generated as the value of X for that entry. Is this a common error with rangestat? And is there a quick fix?
Thanks,
Erik
I am currently having some issues with the "rangestat" function. I am attempting to compute a rolling mean of variable X, which has unique values for each year and state. I would like to compute a rolling average of X using all the values of X since 1960. For example, for the entry "Alabama" "1990" I would like to generate the average value of X for each year between 1960 and 1990 within Alabama.
In order to do this, I constructed the variable "years_from_1960" as -(year - 1960). This command works fine. Then I do the following:
rangestat (mean) rm_X = X, interval(years_from_1960 years_from_1960 0) by(statename)
Initially, this command correctly generated rolling averages. However, the last few times I have run the command (without changing anything), rm_X is just generated as the value of X for that entry. Is this a common error with rangestat? And is there a quick fix?
Thanks,
Erik
Comment