Solved
Contributor
Posts: 39

# mixed modelling, help with correct model writing

Hi All

I am writting a  model to estimate the varaince components, and I am not sure of the correct model to estimate the components I need. Please help me.

So I have 60 patients, who each got  scanned on 6 days, and 6 times everyday. Each scan contains 20 images. I want to estimate intraday, interday and intrascan variance. With my model my residual variance is higher than the intraday varaince, which is causing doubts. 20 images within a scan should be very close and should have least variability. scans within a day should than have less varaibility than variability between days. Please help me with correct model writing.

``````proc mixed data=p2.req;
class pt_nbr day_nbr scan_nbr image_nbr ;
model Y= ;
random day_nbr pt_nbr day_nbr*pt_nbr scan_nbr(day_nbr) ;
run;``````

SAS Output

Covariance Parameter Estimates
Cov Parm Estimate
day_nbr 0
pt_nbr 1078.39
pt_nbr*day_nbr 12.7373
scan_nbr(day_nbr) 2.1783
Residual 13.0825

Accepted Solutions
Solution
‎07-21-2016 02:40 PM
Posts: 2,655

## Re: mixed modelling, help with correct model writing

You may wish to fit a fully factorial random model.  I have a hunch that the missing terms are falling to the residual error, and consequently inflating it.  What happens if you try:

``````proc mixed data=p2.req;
class pt_nbr day_nbr scan_nbr image_nbr ;
model Y= ;
random pt_nbr|day_nbr|scan_nbr ;
run;``````

I used the pipe notation to get all main effects, the three first order interactions and the second order interaction.  You could also delete image_nbr from the class statement.

The problem I see here is that these repeated measurements mean that the actual experimental unit is the scan_nbr, and the residual error is pseudo-replication.  With that in mind, what happens with:

``````proc mixed data=p2.req;
class pt_nbr day_nbr scan_nbr image_nbr ;
model Y= ;
random pt_nbr|day_nbr|scan_nbr@2 ;
repeated image_nbr/subject=pt_nbr*day_nbr*scan_nbr;
run;``````

Have to admit I am spitballing at this.

Steve Denham

All Replies
Solution
‎07-21-2016 02:40 PM
Posts: 2,655

## Re: mixed modelling, help with correct model writing

You may wish to fit a fully factorial random model.  I have a hunch that the missing terms are falling to the residual error, and consequently inflating it.  What happens if you try:

``````proc mixed data=p2.req;
class pt_nbr day_nbr scan_nbr image_nbr ;
model Y= ;
random pt_nbr|day_nbr|scan_nbr ;
run;``````

I used the pipe notation to get all main effects, the three first order interactions and the second order interaction.  You could also delete image_nbr from the class statement.

The problem I see here is that these repeated measurements mean that the actual experimental unit is the scan_nbr, and the residual error is pseudo-replication.  With that in mind, what happens with:

``````proc mixed data=p2.req;
class pt_nbr day_nbr scan_nbr image_nbr ;
model Y= ;
random pt_nbr|day_nbr|scan_nbr@2 ;
repeated image_nbr/subject=pt_nbr*day_nbr*scan_nbr;
run;``````

Have to admit I am spitballing at this.

Steve Denham

Contributor
Posts: 39

## Re: mixed modelling, help with correct model writing

[ Edited ]

Hello Steve

Thanks for your quick reply. I tried your both models. I personally think first one is better, I think because I understand it better .FYI, I don't have missing data.

Fit statistics are also better with the first model. From the sas output that follows , I think the highlighted portions of the data will give me the required estimates I need. Please let me know if you think I am thinking correct?

SAS Output

Covariance Parameter Estimates
Cov Parm Estimate
pt_nbr 1042.21
day_nbr 0.1685
pt_nbr*day_nbr 13.0275 (interday)
scan_nbr 0.2490
pt_nbr*scan_nbr 0.3753
day_nbr*scan_nbr 0
Residual 4.3063(intrascan)

SAS output form the second model you suggested.
SAS Output
Covariance Parameter Estimates
Cov Parm Subject Estimate
pt_nbr   1041.89
day_nbr   0.1569
pt_nbr*day_nbr   14.5853
scan_nbr   0.2367
pt_nbr*scan_nbr   2.2446
day_nbr*scan_nbr   0.07033
image_nbr pt_nbr*day_nb*scan_n 11.0527
Posts: 2,655

## Re: mixed modelling, help with correct model writing

I agree--the first model is more easily interpreted (and since it was my first thought, that says something as well).  Sometimes, overthinking a model will lead to trouble.  I did see a zero estimate, so you probably saw something about the G matrix not being positive definite.  In this case, that is not a problem--the REML estimates of variance components are better estimators.

Steve Denham

☑ This topic is solved.