BookmarkSubscribeRSS Feed
LeneStod
Calcite | Level 5

I am trying to compare growth curves from an animal feeding trial and I am stuck. I have not been able to find an answer on my specific challenge. 

 

I have four diets (A,,B, C, and D), 12 animals on each diet. The animals have all be weighed once a week for a 6 week period. I would like to compare the growth of the animals on each diet and determine whether the diets affect the growth. But I want to exploit that I have data from each week, and not just use start/end weight.

 

My plan was to estimate and compare the slopes of a fitted line, but I don´t know how to make the comparison with four groups  and repeated measurements in the given period.

 

Can someone please help me with suggestions of the appropriate statistical procedure in SAS?   

 

 

12 REPLIES 12
koyelghosh
Lapis Lazuli | Level 10

@LeneStod Will you please post an example data based on which the curve will be generated?

Rick_SAS
SAS Super FREQ

There are examples like this in the PROC MIXED documentation.

You can also look at the paper "Repeated Measures Modeling With PROC MIXED" by Moser, starting on p. 7.

LeneStod
Calcite | Level 5

 I didn´t realise that the proc mixed could give me the answers. I will look into that, thanks.

LeneStod
Calcite | Level 5

Below is an example of data. I have 48 pigs on 4 different diets. The weight is measured every week. Included data from week 1 and 2, but I have data for week 1-6

 

I have fitted the following linear regression, and would like to compare the slopes.

 

 

Label Diet Intercept Slope
6.222 + 3.030 * WeekA6.222223.02976
6.214 + 3.205 * WeekB6.213893.20476
5.917 + 3.024 * WeekC5.916673.02381
5.842 + 3.343 * WeekD5.841673.34286

 

 

 

 

 

Gris_IDDietWeightWeek
1B101
2B131
3B9,51
4C11,51
5C8,51
6C11,51
7A12,51
8A91
9A10,51
10D121
11D11,51
12D9,51
13A13,51
14A10,51
15A7,51
16B12,51
17B9,51
18B10,51
19D14,51
20D8,51
21D9,51
22B111
23B121
24B91
25C13,51
26C9,51
27C91
28A9,51
29A10,51
30A121
31C8,51
32C12,51
33C11,51
34D131
35D101
36D91
37C81
38C121
39C10,51
40B9,51
41B10,51
42B12,51
43D13,51
44D91
45D101
46A121
47A9,51
48A111
1B12,52
2B152
3B11,52
4C142
5C102
6C132
7A142
8A10,52
9A12,52
10D122
11D11,52
12D11,52
13A152
14A112
15A8,52
16B15,52
17B11,52
18B112
19D16,52
20D92
21D122
22B12,52
23B13,52
24B10,52
25C15,52
26C112
27C10,52
28A12,52
29A12,52
30A142
31C92
32C11,52
33C12,52
34D14,52
35D11,52
36D11,52
37C82
38C12,52
39C112
40B112
41B12,52
42B12,52
43D13,52
44D112
45D11,52
46A122
47A11,52
48A132
koyelghosh
Lapis Lazuli | Level 10

I just went ahead and made up a data of 20 weeks with four types of diet (averaged for 12 cows into one variable/column). I have attached the dataset here (MadeUpCowsDiet.csv). This type of relationship between Week and Diet column can be described as below.

 

Growth_Diet = (Theta_1 * Week)/(Theta_2 + Week)

where Theta_1 and Theta_2 are the parameters that need to be estimated using regression.

The idea is to use PROC NLIN to do non-linear regression and get the Parameters (Theta_1 and Theta_2) for every Diet column and then use the predicted values to plot a regression line (using PROC SGPLOT). The code is as below.

 

PROC IMPORT DATAFILE="~/MadeUpCowsDiet.csv" DBMS=CSV OUT=MadeUpCowsDiet;
RUN;

%MACRO PredictAndPlot(Diet_Col_Name, Theta_1, Theta_2);
	%LET PredictedName=Predicted_&Diet_Col_Name;

/* 	PROC NLIN will do non-linear regression while PROC SGPLOT will utilize the results to fit a curve */
	PROC NLIN DATA=MadeUpCowsDiet;
		PARAMETERS Theta_1=&Theta_1 Theta_2=&Theta_2;
		MODEL &Diet_Col_Name=(Theta_1*Week)/(Theta_2+Week);
		OUTPUT Predicted=&PredictedName OUT=Predicted;
	RUN;
	
	PROC SGPLOT DATA=Predicted;
		SCATTER X=Week Y=&Diet_Col_Name;
		SERIES X=Week Y=&PredictedName;
	RUN;

%MEND;

/* Now you can call macro for every diet (column). Below is just one example. */
%PredictAndPlot(Gwth_Diet1,8,2);

When you run this, then you get the parameter estimates as below from PROC NLIN.

Parameters estimateParameters estimate

 

and you get the curve from PROC SGPLOT.

 

CurveCurve

Please let me know if this is what you wanted. There is a big possibility that I have underestimated your problem.

LeneStod
Calcite | Level 5

@koyelghosh Thanks. Will your analysis perform a comparison between the four diets you have or just construct four different curves?

I would like to determine whether the curves for my four diets differ (with a p value) 

koyelghosh
Lapis Lazuli | Level 10

@LeneStod It will construct four different curves but with little modification you can make all of them appear in one curve. 

Rick_SAS
SAS Super FREQ

To test for the difference in means due to the diet, use

lsmeans diet / pdiff;

The LSMEANS statement is supported in both GLM and MIXED procedures. Here is a link to the LSMEANS documentation.

LeneStod
Calcite | Level 5

@Rick_SAS Thank you for the suggestions. I am a little unsure whether using Proc mixed will give me the answers I need. I use proc mixed for many of my studies, however (and correct me if I am wong) I normally use proc mixed to compare means. So if I do as you suggest, wouldn´t that just give me a comparision of the weight means overall at the time points used? 

What I want is to compare the weekly increase, that is the slope of the growth curves. The important thing is not whether the absolute weight of animals on diet A is different from animals on diet B on so on, but I want to know whether the overall weekly increase differs. 

 

I have attached an example of the curves with the slopes I want to compare (I will propably end up log transforming the values due to increasing variation, so the curves are just to give you an idea )

 

 

 

 

koyelghosh
Lapis Lazuli | Level 10

@LeneStod I might be wrong but you already have the fit curve and the coefficients and all you want to know is whether the mean of different diets across different weeks is significantly different.

If that is true, I would have been tempted to do ANOVA test (to see if any combination is significantly different) and then post-hoc test to see which pair is significantly different. I would get the answer to the question. LSMEANS might also get the job done as suggested by Rick_SAS.

If you want to know, rather, whether linear regression coefficients of the fit are signjficant then p-value should be embedded in the regression results.

I am sorry if I am still reading your requirement as wrong. Please let me know.

LeneStod
Calcite | Level 5

@koyelghosh.I guess it is a variation of our last suggestion I am interested in. Is the indvidual linear regression coefficient for each of the four curves significantly different. I get these results from the proc reg, but do these curves differ?

 

Label Diet Intercept Slope
6.222 + 3.030 * WeekA6.222223.02976
6.214 + 3.205 * WeekB6.213893.20476
5.917 + 3.024 * WeekC5.916673.02381
5.842 + 3.343 * WeekD5.841673.34286

 

 

This is what I get from the curve for diet A, (I get similar information for the regression of diet B, ,C, and D) but no comparision between the four diets

 

Analysis of VarianceSource DF Sum ofSquares MeanSquare F Value Pr > FModelErrorCorrected Total
11927.686011927.68601189.68<.0001
70711.3938510.16277  
712639.07986   

Root MSER-SquareDependent MeanAdj R-SqCoeff Var 
3.187910.7304
16.826390.7266
18.94589 

Parameter EstimatesVariable Label DF ParameterEstimate StandardError t Value Pr > |t|Intercept1Week1
Intercept6.222220.856737.26<.0001
Week3.029760.2199913.77<.0001
koyelghosh
Lapis Lazuli | Level 10

@LeneStod I see the problem now. I think the question that if one curve equation is significantly different from the other is like asking if two numbers differ significantly. For example it will be hard to formulate what it means if I am asking if number 2 is significantly different from number 3. 

The significance (p value) comes into picture only if, at least, one side of the comparison operator has n number of members coming from a distribution.

Taking both points into account I find it hard to understand what it means by comparing the p values of two equations (and not members). However just because I can not understand does not mean that your stated problem can not be formulated and answer. Let's hope one of the SAS experts land on this page and shed much better light on this topic than me.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 12 replies
  • 2703 views
  • 0 likes
  • 3 in conversation