BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hakeem
Fluorite | Level 6

I have binary outcome data to be fitted on a binary treatment effect and a continuous covariate. Each of my subjects have data collected over two weeks. Below is the correlation structure that I want to fit: 

Screenshot 2020-05-01 at 11.00.11 AM.png

I want to run this in both glimmix and genmod, since I want to compare both conditional and marginal models. I can nest the AR(1) blocks in the weekday and weekend. However, is there a way for me to estimate psi and phi while forcing 0's in specific entries from the above correlation structure in glimmix, or even genmod?

 

I'd greatly appreciate advice and comments on this matter. Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

Absolutely no guarantees on this. This is for GLIMMIX.

 

Fit the AR(1) within weekday and weekend and save the covariance matrices from those.  In a datastep create a 3x4 matrix and its transpose, with 1's at the corners and zeroes everywhere else. Now get all 4 matrices into one that matches the schema shown.  

 

Using the PARMS statement and the pdata= option, load this matrix as the covariance structure.  You will need to use HOLD to fix the values for the upper and lower blocks, and all the desired zeroes (45 entries).  In the end, only 4 parameters will be estimated.  If the covariance matrix is positive definite, then the 2 parameters for psi and 2 for phi should be equal. This assumes that 1 is a good starting value for the estimation process for these parameters.

 

There might be a way using the type=lin(q) and the ldata= option, but I would be even more cautious about giving advice on that as I have never used that structure.  Still, Google is your friend and there might be something out there on the interwebs where someone has used this approach.

 

As far as I can tell, GENMOD doesn't have anything equivalent to this.

 

Now, as for marginal and conditional estimates, you can get both from GLIMMIX.  To get the marginal estimates, include a residual option in the RANDOM statement with method=MSPL in the PROC GLIMMIX statement.  For the conditional fit, delete the residual option and change to method=laplace or method=quad.

 

Good luck - this is a complex analysis and fitting this model will be as much art as technique.

 

SteveDenham

View solution in original post

2 REPLIES 2
SteveDenham
Jade | Level 19

Absolutely no guarantees on this. This is for GLIMMIX.

 

Fit the AR(1) within weekday and weekend and save the covariance matrices from those.  In a datastep create a 3x4 matrix and its transpose, with 1's at the corners and zeroes everywhere else. Now get all 4 matrices into one that matches the schema shown.  

 

Using the PARMS statement and the pdata= option, load this matrix as the covariance structure.  You will need to use HOLD to fix the values for the upper and lower blocks, and all the desired zeroes (45 entries).  In the end, only 4 parameters will be estimated.  If the covariance matrix is positive definite, then the 2 parameters for psi and 2 for phi should be equal. This assumes that 1 is a good starting value for the estimation process for these parameters.

 

There might be a way using the type=lin(q) and the ldata= option, but I would be even more cautious about giving advice on that as I have never used that structure.  Still, Google is your friend and there might be something out there on the interwebs where someone has used this approach.

 

As far as I can tell, GENMOD doesn't have anything equivalent to this.

 

Now, as for marginal and conditional estimates, you can get both from GLIMMIX.  To get the marginal estimates, include a residual option in the RANDOM statement with method=MSPL in the PROC GLIMMIX statement.  For the conditional fit, delete the residual option and change to method=laplace or method=quad.

 

Good luck - this is a complex analysis and fitting this model will be as much art as technique.

 

SteveDenham

hakeem
Fluorite | Level 6

Thank you very much for this Steve!

I'll run this in SAS and see how things unfold.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 685 views
  • 5 likes
  • 2 in conversation