[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: Analysis of binary cluster data with missing values
Louise Linsell writes:
Subject: st: Re: Analysis of binary cluster data with missing values
I have a dataset that looks something like this - each person has
observations on 2 hips and 2 knees and I wish to calcuate the odds ratio
of hips to knees, taking account of the clustering within person using
robust standard errors.
id hip knee row
1 1 0 1
1 1 0 2 (1=replaced, 2=not replaced)
2 . 1 3
2 0 1 4
3 1 0 5
3 0 . 6
4 1 0 7
4 . . 8
The problem here is that the 4 joints are tied together in pairs.
When one is missing, the wule line is dropped. This is not intended.
To break the pairing, the data must be reshaped long, with one line per joint.
Something like the following is needed:
rename hip new_joint1
rename knee new_joint2
bys id: gen side = _n
reshape long new_joint , i(id side) j(hip_knee)
gen hip = hip_knee == 1
gen knee = hip_knee == 2
logistic new_joint hip, cluster(id)
Note: The rows for each subject row might not refer to the side of the body.
However, something is needed to give a unique id for each line.
Paul T Seed (Paul.Seed@kcl.ac.uk)
Department of Obstetrics & Gynaecology
Guy's Kings and St. Thomas' School of Medicine, King's College London,
St Thomas' Hospital,
Lambeth Palace Road,
London SE1 7EH
tel (+44) (0) 20 7960 5889
fax (+44) (0) 20 7620 1227
Thurs only: (+44) (0) 20 7848 4208
* For searches and help try: