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

Hello,

I have a dataset with missing data (17/722=2.35%).  I have run multiple imputations on this dataset.  I want to run a mixed model with repeated option on the imputations.  In addition to overall effects I would like to test contrasts.

1.  How do I get Mianalyze to give me the results of the ESTIMATE from PROC MIXED?

Here is the code:

*multiple imputation;

proc mi data=XX seed=23456 nimpute=3 out=miout1;

mcmc;

var change baseline;

run;

*MMRM model;

proc mixed data=miout1 method=ml;

by _imputation_;

class trt visit usubjid country sex;

model change=trt visit trt*visit baseline country /ddfm=kr solution covb;;

repeated visit/ subject=usubjid type=vc;

lsmeans trt*visit/cl pdiff;

estimate 'Trt A vs Trt B at visit 2'  trt 1 -1 trt*visit 1 0 -1 0/cl;

estimate 'Trt A vs Trt B at visit 3'  trt 1 -1 trt*visit 0 1 0 -1/cl;

ods output solutionf=mixparms covb=mixcovb diffs=mixdiff estimates=mixestimates;

run;

quit;

*Mianalyze procedure;

proc mianalyze parms(classvar=full)=mixparms covb (effectvar=rowcol)=mixcovb edf=663;

class trt visit usubjid country;

2.  I am getting this in the log of the proc mianalyze.

WARNING:  The within-imputation covariance matrix is singular.  The total covariance matrix and related statistics in multivariate inference will be set to missing.

I am not sure why.

Thank you in advance for your help.

ns


1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

We are definitely beyond my abilities with that error.  Open up a ticket with Tech Support.  I know the last time we got stuck on this that Tech Support was the way to go.  When they give their feedback, please share it here.  I could really stand to learn how to fix this.

BTW, that looks like a good workaround over the estimates.

Steve Denham

View solution in original post

8 REPLIES 8
SteveDenham
Jade | Level 19

MIANALYZE and MIXED don't always play well with one another.  My first instinct would be to trust in the results obtained from PROC MIXED with the data treated as missing.  Unless the data are MNAR, the likelihood methods of mixed models are at least as good as any imputational method available in PROC MI (opinion only), as none of the imputational methods deal well with random effects, and especially nested random effects. Note that the PROC MIXED examples in the MIANALYZE documentation have neither a RANDOM or a REPEATED statement, so that strikes me as unusual.

Still, I believe that there was a paper presented at one of the last two SGF meetings that addressed how to get the necessary matrixes into MIANALYZE.  This was not straightforward, and I have yet to get it right (though I haven't tried in almost a year).  And, to get the equivalent of the ESTIMATE statements, you will have to specify a TEST statement in MIANALYZE. It will give an estimate and a standard error.

Steve Denham

nsns
Obsidian | Level 7

Thank you for your response.

I have noticed that there is not much information on MIANALYZE together with repeated statements.  I have also been researching this and have found pretty consistently that using the MMRM model without imputation is just as good as trying to impute the data.  In order to strengthen this idea, I wanted to show the results of the ESTIMATES in both ways.  I wanted to show that the pvalues are similar in the MMRM and then in the MIANALYZE.  I am just not having success with this in the mianalyze procedure (TEST statement).  Can you perhaps help with the syntax?

Also, until I resolve the WARNING, I cannot rely on the results. I am not sure why I am getting that warning.

Thanks for the reference to the SGF papers.  I will look them up and see how they can help.

Thanks,

ns 

SteveDenham
Jade | Level 19

To get TEST to work, you need the names of the variables from the mixparms dataset.  You can then plug them in to get an equivalent to the ESTIMATE statement.  The output will include the L matrix, so you could check to see that it is doing what you ask.

It may be that your G or R matrix is singular for one of the imputations.  I would suggest doing more imputations and selecting only those that avoid this.  If it keeps throwing this error, then I might think about opening a ticket with Tech Support.

Steve Denham

nsns
Obsidian | Level 7

Thank you again for your help.  I was not able to get the TEST statement to work the way I wanted. Instead I used this code:

proc mianalyze data=estimates;

     by label;

     modeleffects estimate;

     stderr stderr;

run;

Does this look correct?

I am still not able to fix the warning in the log of the MIANALYZE procedure regardng the within imputation covariance matrix being singular. I cannot figure out what is causing this.  Running more imputations and trying to choose a subset of these did not help.

ns

SteveDenham
Jade | Level 19

We are definitely beyond my abilities with that error.  Open up a ticket with Tech Support.  I know the last time we got stuck on this that Tech Support was the way to go.  When they give their feedback, please share it here.  I could really stand to learn how to fix this.

BTW, that looks like a good workaround over the estimates.

Steve Denham

RCarr
Calcite | Level 5

Hi all, I just figured out a fix for the MIANALYZE issue... You will need to recode the "Label" variable name in your "mixestimates" dataset to one of the suggested names that is listed in the error statement. I recoded "LABEL" as "ROWNAME" in the mixestimates2 dataset. From there you can run the MIANALYZE script below on the mixestimates2 dataset. Also, you will need to label your ESTIMATE statements in PROC MIXED using a one word variable name in between the quotes (see below). I hope this helps!

 

-Robert

 

*********************************************************

Recoding variables

*********************************************************;

DATA mixestimates2(RENAME = (LABEL=ROWNAME));

SET mixestimates;

PROC PRINT DATA= est2 (firstobs= 1 obs= 25);

VAR _IMPUTATION_ ROWNAME;

RUN;

 

PROC MIANALYZE parms=mixestimates2;

MODELEFFECTS Var1 Var2 Var3 Var4;

run;

 

 

*********************************************************

Estimate statements

*********************************************************;

ESTIMATE 'VAR1' EMOT 1 TK*EMOT -3;

ESTIMATE 'VAR2' EMOT 1 TK*EMOT -2;

ESTIMATE 'VAR3' EMOT 1 TK*EMOT -1;

ESTIMATE 'VAR4' EMOT 1 TK*EMOT  0;

Carole_LH
Calcite | Level 5

I think the warning about the singularity has to do with the fact that there is a 0 row in the COVB matrix for the reference level of class variables.  One possibility is to create dummy codes instead of using class variables and see if that helps.

Carole.

Pohto21
Calcite | Level 5

I got stuck into this 'old' problem with my repeated measurements data, and I really can't solve it with these instructions. Could somebody give me more detailed instructions how to get pooled p-values (time, group time*group) and estimates.

I've used SAS for several years as one of my tools, but I'm not an expert, far from it. So, if someone could give the answers at 'dummy level', I'd be very grateful 🙂

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 8 replies
  • 8163 views
  • 1 like
  • 5 in conversation