I would like to analyse the effect of treatment and storage time on vitamin content of cheese. For this, I had made cheese with three different treatments (Treatment A, Treatment B and Treatment C). I stored all the experimental cheeses at 10°C for 90 d. During storage, I had taken cheese samples at 30, 60 and 90 d of storage for analysis of vitamin content. Now, I would like to analyse the effect of treatment and storage time on vitamin content of cheese. Moreover, I would also like to see the interaction effect between treatment and storage time. Note that I had repeated the same experiment two times (i.e. trial 1 and trail 2) with different materials; in another word, the sample size is 2. Which statistical analysis is appropriate for this?
Trial | treatment | storage time(day) | vitamin content (µg/100 cheese) |
1 | A | 30 | 90.17 |
2 | A | 30 | 88.22 |
1 | B | 30 | 106.94 |
2 | B | 30 | 129.93 |
1 | C | 30 | 127.99 |
2 | C | 30 | 120.74 |
1 | A | 60 | 49.72 |
2 | A | 60 | 45.70 |
1 | B | 60 | 67.48 |
2 | B | 60 | 96.57 |
1 | C | 60 | 91.41 |
2 | C | 60 | 104.38 |
1 | A | 90 | 45.19 |
2 | A | 90 | 37.63 |
1 | B | 90 | 63.23 |
2 | B | 90 | 71.03 |
1 | C | 90 | 78.26 |
2 | C | 90 | 84.34 |
Some of my college suggested me to do split-plot design and the code is:
proc mixed data=prabin;
class trial treat time;
model vitamin = treat time treat*time/ddfm=satterth;
random trial trial*treat;
lsmeans treat time treat*time/adjust=tukey pdiff;
run;
Is this a correct statistical analysis? What does the random trial trial*treat means in the code?
Thank you very much in advance!
I see what you mean now. I guess I have to think about this some more, but it seems like your earlier code works fine.
You can't do a split-plot analysis unless you created a split-plot design. But this doesn't seem to be a split plot design to me.
This is a one-factor (treatment) repeated measures design, replicated twice.
An example of analyzing a repeated measures design is here: https://documentation.sas.com/?cdcId=statcdc&cdcVersion=14.2&docsetId=statug&docsetTarget=statug_mix...
Hi Paige,
Many thanks for the quick response and great advice! Would you please kindly write code for repeated measure for me, if possible. I try to do myself but I am bit confused.
Thank you very much again!
Cheers,
Prabin
@Prabin_1988 wrote:
Would you please kindly write code for repeated measure for me, if possible.
I provided you with a link to an example of a repeated measures analysis. See if you can get that to work. If not, then show us what you tried.
Hi Paige,
Could you please kindly review the SAS code for repeated measure? I am not sure whether I am correct or not.
Thank you very much again!
Prabin
proc mixed data=prabin;
class trial treat time;
model vitamin = treat|time;
random trial;
repeated time / subject=trial*treat type=ar(1); lsmeans treat|time/adjust=tukey pdiff;
run;
You added type=ar(1), which may or may not be correct, but you haven't said anything about why you need this.
I don't think you want subject=trial*treat, I think you want subject=treat
@Prabin_1988 wrote:
Hi Paige,
I changed subject=treat instead of subject=trial*treat; however I didn't get the result.
It's hard to know what you mean with such a brief comment.
Hi Paige,
Please see the data and SAS code. You suggested me to do repeated measure on my data to find the effect of treatment and time ( interaction effect as well) on response variable. Once I ran this code in SAS, I got only few result (see attached for PrtScn of the result). Could you please figure it out what's wrong with it?
Thank you very much again!
data prabin;
input treat$ trial time vitamin;
datalines;
A 1 30 90.17
A 2 30 88.22
B 1 30 106.94
B 2 30 129.93
C 1 30 127.99
C 2 30 120.74
A 1 60 49.72
A 2 60 45.7
B 1 60 67.48
B 2 60 96.57
C 1 60 91.41
C 2 60 104.38
A 1 90 45.19
A 2 90 37.63
B 1 90 63.23
B 2 90 71.03
C 1 90 78.26
C 2 90 84.34
;
proc mixed data=prabin;
class trial treat time;
model vitamin = treat|time;
random trial;
repeated time / subject=treat; lsmeans treat|time/adjust=tukey pdiff;
run;
I see what you mean now. I guess I have to think about this some more, but it seems like your earlier code works fine.
I'd say that we don't yet know enough about your experimental design to say whether your code is correct.
In Trial 1 (and likewise in Trial 2), how many different (and independent) cheeses do you have that you made with Trt A?
Specifically, do you have only one Trt A cheese that you subsequently take three samples from at times 30, 60, and 90? If so, then your statistical model would be a split plot ("in time") with whole plots in blocks, in which you might choose to model the temporal autocorrelation among the repeated measurements.
Or do you have three Trt A cheeses, where cheese #1 is sampled at 30 d, cheese #2 is sampled at 60 d and cheese #3 is sampled at 90 d? If so, then your statistical model would be a two-way factorial in a randomized block design.
Hi Sld,
I have only one Trt A cheese that I subsequently take three samples from at times 30, 60, and 90 d. Then for split plot ("in time") with whole plots in blocks, in which you might choose to model the temporal autocorrelation among the repeated measurements, below SAS code is appropriate? I have attached the details flow chart of my experiment. Thank you very much!
proc mixed data=prabin;
class trial treat time;
model SN = treat time treat*time/ddfm=satterth;
random trial trial*treat;
lsmeans treat time treat*time/adjust=tukey pdiff;
run;
Here are three possible models:
/* Split plot in time */
proc mixed data=prabin;
class trial treat time;
model vitamin = treat|time;
random trial trial*treat;
lsmeans treat time / pdiff adjust=tukey;
lsmeans treat*time / slice=(treat time);
run;
/* Temporal autocorrelation as CS */
/* This model is a different parameterization of the model above,
and will give the same results */
proc mixed data=prabin;
class trial treat time;
model vitamin = treat|time;
random trial;
repeated time / subject=treat*trial type=cs r rcorr;
lsmeans treat time / pdiff adjust=tukey;
lsmeans treat*time / slice=(treat time);
run;
/* Temporal autocorrelation as AR(1) */
proc mixed data=prabin;
class trial treat time;
model vitamin = treat|time;
random trial;
repeated time / subject=treat*trial type=ar(1) r rcorr;
lsmeans treat time / pdiff adjust=tukey;
lsmeans treat*time / slice=(treat time);
run;
I have applied SLICEs to the interaction means because Tukey adjustment is excessively conservative: it controls for all pairwise comparisons, and typically you do not care about all of them. I recommend judicious use of contrasts. However, for your data, there is no support for interaction, so comparisons among interactions means are likely not warranted.
For your data, the variance among trials has been set to zero. To better understand why this happened and what to do about it, see for example:
http://support.sas.com/resources/papers/proceedings12/332-2012.pdf
http://homepage.stat.uiowa.edu/~rdecook/stat6220/Class_notes/variance_component_zero.pdf
You'll see that different people make different recommendations. You have to know enough to make the best choice for your analysis.
In the R world in particular, you'll see people incorporating block as a fixed effect, rather than random effect, especially if the number of blocks is "less than 5" (a rule of thumb with little basis, in my opinion); for example
model vitamin = trial treat|time;
random trial*treat;
This does, however, point out that having only two blocks (trials) is not a strong experimental design. It's obviously challenging to estimate a variance based on only two units.
In the future, please post attachments as text files (e.g., csv instead of xls, txt instead of doc). Several people in the Community hesitate to open files (e.g., MS Office) that might contain bad stuff.
I hope this helps.
Thank you very much Sld! much appreciated!
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 16. Read more here about why you should contribute and what is in it for you!
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.