Caros colegas, sou neurocientista e passei as últimas semanas lutando para construir contrastes de interações num estudo com medidas repetidas. Brevemente, estou investigando se o isolamento social neonatal (ISN) em ratos produz depressão na vida adulta. Para isso, usamos 2 modelos de ISN. No primeiro o filhote é separado da mãe e dos irmãos por por 24 h, no 9º dia pós-natal (PN9). No segundo o filhote é isolado por 3 h diárias entre o 2º e o 21º dias pós-natais (PN2-PN21). Os controles (MAN) são brevemente manipulados (em PN9 ou de PN2 a PN21) e devolvidos às mães. Portanto, temos 2 procedimentos para a variável SEPARA (ISN ou MAN) e 2 durações para a variável PERIODO (20D ou 24H). Quando adultos (PN60) os ratos são submetidos ao teste de preferência por sacarose. Para isso, eles são privados de água por 24 h e, em seguida, expostos por 15 min a dois bebedouros contendo água ou solução de sacarose. Acredita-se que a redução da ingestão de sacarose seja um sinal de depressão (falta de prazer ou anedonia). Como a mesma unidade experimental é exposta aos dois bebedouros, tenho analisado as ingestas de água (RESP1) e sacarose (RESP2) por ANOVA para medidas repetidas (sou o único a fazê-lo). Por fim, temos 2 tipos de mães (MC=zelosa, MA=negligente) que são analisadas separadamente pelo comando 'BY MAE'. Seguem anexos o programa (versão do SAS de 1994) e a planilha de dados, ambos em formato texto (CONTRST1.txt e TPS_2rep.txt, respectivamente). Os contrastes com as interações SEPARA*PERIODO geraram sempre a mensagem 'contrast is not estimable', com qualquer sintaxe empregada. Serei muito grato se alguém puder resolver esse problema. Luiz Carlos Schenberg
See my response in the recent post titled "NOTE: CONTRAST one is not estimable" which recommends avoiding CONTRAST (and ESTIMATE) statements whenever statements that don't require contrast coefficients (LSMEANS, SLICE) can be used. As I mentioned in that post, you can test for simple effects within an interaction using the SLICE statement. Since you have repeated measures data, you can use the GENMOD (or GEE) procedure rather than GLM. These statements rearrange the data to long form as required for repeated measures analysis in procedures other than GLM. The GENMOD step then fits the models (where are Generalized Estimating Equations models) and uses the SLICE statement to do the tests within the interaction.
data rep; set tps_2rep;
y=resp1; ingesta=1; output;
y=resp2; ingesta=2; output;
run;
proc sort data=rep; by mae; run;
PROC genmod data=rep;
by mae;
CLASS PERIODO SEPARA rato;
MODEL y = PERIODO|SEPARA;
repeated subject=rato;
slice SEPARA*PERIODO / sliceby=separa;
RUN;
Dear Dave, I was unable to run either PROC GENMODE or SLICEBY statement. I will need some time to learn how to use them. Could you please send me your output so that I can check whether it is in accordance with our data?
Yes, I understood your DATA procedure. However, my old SAS version don't have GENMODE and SLICEBY. I will try to do it with SAS cloud version. This will take some time, I'm not used with the new procedures and statements. Best.
Dear Dave, please find attached the graph of my results and the purpose of the analysis (vertical bars are LSM standard errors). Although I had success in running your code, I was unable to upload TPS_2rep correctly. Accordingly, I'm trying to get some help from local statisticians. Anyway, are your results compatible with data showed in this graph?
Try recreating the data set instead of uploading/importing it. Simply copy the data lines from your original post and paste them, where indicated, in the following DATA step code.
DATA TPS_2rep;
INPUT RATO $ MAE $ PERIODO $ SEPARA $ GRUPO $ RESP1 RESP2;
datalines;
<paste your data lines here>
;
That should create the data set. You can then run the following code which includes your INGESTA (water or sucrose) predictor in the model and allows it to interact with the other two predictors. The comparison that you state in your attached plot is essentially a difference in difference comparison as is discussed generally in this note. In your case, three predictors are involved, but you can still use the LSMESTIMATE statement as suggested in the first section of that note. The following statements do that for the difference of differences that you indicate in your attached plot. Note that the LSMESTIMATE statement tests specified combinations of the LSMEANS. The coefficients apply to the LSMEANS not to the model parameters and are specified using the order of the LSMEANS shown in the table produced by the LSMEANS statement. The EFFECTPLOT statement draws the plot similar to what you showed.
data rep; set tps_2rep;
y=resp1; ingesta='water '; output;
y=resp2; ingesta='sucrose'; output;
run;
proc sort data=rep; by mae; run;
PROC genmod data=rep;
by mae;
CLASS PERIODO SEPARA rato ingesta(order=data);
MODEL y = PERIODO|SEPARA|ingesta;
repeated subject=rato;
lsmeans SEPARA*PERIODO*ingesta / plots=none;
lsmestimate SEPARA*PERIODO*ingesta
"20D-24H in ISN Water - 20D-24H in ISN Sucrose" 1 -1 0 0 -1 1 0 0,
"20D-24H in MAN Water - 20D-24H in MAN Sucrose" 0 0 1 -1 0 0 -1 1;
effectplot interaction(x=ingesta sliceby=separa*periodo);
RUN;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.