Hi,
I have a panel dataset with 13 waves and my dependent variable is binary.
I am running a correlated random effects model which requires me to generate average variables for my time-variant explanatory variables ( please see slide 37: http://conference.iza.org/conference...nonlin_iza.pdf )
So I would do:
One of my main explanatory variables is "retire", which I think is a categorical variable. This measures how importantly the individual rates retirement as a motive to save money in the present, rated from 1-14 with 0 being very unimportant and 14 being very important.

To generate the average of this variable, I tried:
But this returned the error message: i: operator invalid
Could you please suggest how I can generate the average of this variable?
I think the following would be incorrect because it doesn't take into account that "retire" is categorical
Thank you
I have a panel dataset with 13 waves and my dependent variable is binary.
I am running a correlated random effects model which requires me to generate average variables for my time-variant explanatory variables ( please see slide 37: http://conference.iza.org/conference...nonlin_iza.pdf )
So I would do:
Code:
egen x1bar = mean(x1), by(id)
To generate the average of this variable, I tried:
Code:
egen retirebar = mean(i.retire), by(id)
Could you please suggest how I can generate the average of this variable?
I think the following would be incorrect because it doesn't take into account that "retire" is categorical
Code:
egen retirebar = mean(retire), by(id)
Comment