I am trying to fit a model in R using NLME. I am translating from SAS and here is the SAS code:
proc mixed data=data;
class patient hospital equipment;
model blood_iron_content = equipment / noint ddfm=kr solution residual ;/* No int ensures the fixed effects are not relative to one level*/
random hospital / group=equipment;
repeated equipment / type=un subject=patient R rcorr;
run;
For each patient within a hospital we’ve got blood iron content for each equipment. We are interested to know the means levels for the 3 equipment but also the hospital to hospital variation as well as the patient to patient variation. Also as there is correlation between the equipment, we want the covariance to be estimated as well.
Anyone can help? (Data example below)
Thanks a lot.
Hospital | Patient | Equipment | Blood_Content_Iron |
---|---|---|---|
1 | 1 | A | 134 |
1 | 1 | B | 137 |
1 | 1 | C | 135 |
1 | 2 | A | 124 |
1 | 2 | B | 122 |
1 | 2 | C | 126 |
1 | 3 | A | 129 |
1 | 3 | B | 126 |
1 | 3 | C | 126 |
2 | 4 | A | 144 |
2 | 4 | B | 142 |
2 | 4 | C | 147 |
2 | 5 | A | 114 |
2 | 5 | B | 115 |
2 | 5 | C | 106 |
2 | 6 | A | 128 |
2 | 6 | B | 122 |
2 | 6 | C | 121 |
1