Dear all,
I have a few questions concerning the informative posts on this thread: https://www.statalist.org/forums/for...-periods/page2
- In #7, Nick Cox posted the following link: https://www.stata.com/support/faqs/d...ions-in-group/. This webpage explains that if one runs the code showcased on that same webpage (after proper sorting):
one will obtain a dummy assuming the value of 1 if the first and last values of egenotype differ, correct? However, in the example, within eid=2, egenotype goes from being equal to ww to vv and then back to ww. Dr. Cox nonetheless specifies that the dummy created will still assume the value of 1 for eid=2 as there is variation within eid=2, correct?
- Employing a similar example, except supposing that ww=0 and vv=1, and that a certain threshold exists: 0.5, we generate a diff dummy taking the value of 1 if within a given eid, egenotype crosses that threshold. Subsequently, we run a code quasi-identical to that above to generate a variable showing switchers. How would a researcher go about generating a dummy assuming the value of 1 if a unit switches back (above or below) the threshold, after having switched a first time from one side to another of the threshold to another.
I have a few questions concerning the informative posts on this thread: https://www.statalist.org/forums/for...-periods/page2
- In #7, Nick Cox posted the following link: https://www.stata.com/support/faqs/d...ions-in-group/. This webpage explains that if one runs the code showcased on that same webpage (after proper sorting):
Code:
by eid (egenotype), sort: gen diff = egenotype[1] != egenotype[_N]
- Employing a similar example, except supposing that ww=0 and vv=1, and that a certain threshold exists: 0.5, we generate a diff dummy taking the value of 1 if within a given eid, egenotype crosses that threshold. Subsequently, we run a code quasi-identical to that above to generate a variable showing switchers. How would a researcher go about generating a dummy assuming the value of 1 if a unit switches back (above or below) the threshold, after having switched a first time from one side to another of the threshold to another.
Comment