BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
palolix
Quartz | Level 8

Dear SAS Community,

 

I have some data that I want to anlalyze as repeated measures. Since I dont have blocks I didnt include the random intercept/subject=     line in my model so I just want to make sure that the model Im using is correct. I would greatly appreciate your input.

Harvest is the date the fruits were harvested (2 dates), and what I want to use as repeated measures. Variety is the fruit variety (3 different varieties), and weeks are the number of weeks the fruits were storaged in a coldroom before the measurements like FirmAvg were assesed (after 1 week, 3 weeks, and 6 weeks).  

 

proc glimmix data=one;

class harvest variety weeks;

model FirmAvg=harvest|variety|weeks/dist=lognormal ddfm=km;

random harvest/ residual type=cs;

run;

 

I would greatly appreciate your feedback.

 

Thank you very much

Caroline

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Yes. You could use PROC CATMOD to do ANOVA.
Use PROC CATMOD or PROC LOGISTIC to do logistic model (either ordinal or non-ordinal data.).

View solution in original post

20 REPLIES 20
jiltao
SAS Super FREQ

The syntax looks reasonable to me.

Thanks,

Jill

jiltao
SAS Super FREQ

Actually, I just noticed that you do not have subject. I wonder how your data looks like. Can you post some sample data? I am not sure why there is no subject...

 

palolix
Quartz | Level 8

Hi Jiltao, 

 

Thank you very much for your reply. Since I dont have blocks, that was my concern, not having the intercept/subject line in my model. I dont know what my subject should be and if I have one. I attached an excel sheet with the data that shows the independent var: harvest date, variety, and weeks in storage, and the dep var storage firm avg. To give you some context, the fruits (different varieties) were harvested at two different dates (day 1 and day 55), and stored in a coldroom during 1, 3, and 6 weeks. After that, they were assesed for firmness (firm avg). So I want to use harvest date as repeated measures, to see if the harvest date has an effect on the fruit firmness. I also want to know the effect of the variety and weeks in storage on the firmness. 

 

Thank you very much!

Caroline

jiltao
SAS Super FREQ

If you cannot identify subjects, that is, for the first 5 observations for  Variety BL516 at wk1 --

jiltao_0-1723750335412.png

They might not be the same subjects for the 5 observations appearing later for BL516 for wk 3 -- then you might not have repeated measures data. Just fit an ANOVA model.

If you can say that the first observation in the data (BL516 for wk1) is the same subject as the first BL516 for wk3, and so on so forth for other observations, then you have repeated measures data, and you can add a variable such as ID to identify these subjects. Then you would have a repeated measures data.

Hope this helps,

Jill

palolix
Quartz | Level 8

Thank you so much for your reply! Strictly speaking, the first 5 fruits for variety BL516 at week 1 are not the same fruits I used to do the measures at week 3, and so forth, but since the variety is the same for week1, 3, and 6, what if I treat variety as the subject?

 

Thanks

Caroline

Ksharp
Super User
If you don't have SUBJECT= cluster variable,that means you don't have RANDOM effect(a.k.a it is not MIXED model).
I guess you can fix GLM model instead.

proc genmod data=one;
class harvest variety weeks;
..............
or
proc glm data=one;
class harvest variety weeks;
..........
palolix
Quartz | Level 8

Thank you very much for your reply. Im thinking that maybe I could treat variety as subject? If not, I guess it woud be best to use genmod if my data has only fixed effects, and especially if some of my dependent variables can only take values that go on a scale from 1 to 5. That way I could use a beta or binomial distribution, right?

 

Thanks!

Caroline

Ksharp
Super User
If your dependent variable Y is always greater than zero, you could try GAMMA distribution.
palolix
Quartz | Level 8

Thank you Ksharp! So do think the gamma distribution will be more appropiate for values of 1 to 5  with half values like 1.5?

 

Thank you!

Caroline

Ksharp
Super User
Nope. Gamma distribution is for any positive Y value,no matter it is 1 or 1.5 .
And as Jiltao said if your Y has only 1-5 five value,you could also try fit a logistic/multinomial / ordinal regression.

proc logistic ....
model y=...../ link=clogit;
run;
palolix
Quartz | Level 8

Ok, thank you so much for your reply! What if my dependent var is an ordinal scale that goes from 0 to 5 but where I also have half values of 1.5 for example? Can I still use the multinomial distribution?

 

Thank you!

 

Ksharp
Super User

Yes. you can.

/*y has value 1 ,1.5, 2,3*/
proc logistic ....
model y=...../ link=clogit;
run;

 

I noticed that your data could be formed by contingency table, you also could try PROC CATMOD to do Ordianl Logtisc Model.

Ksharp_0-1724118103028.png

 

Ksharp_1-1724118126907.png

 

Ksharp_2-1724118155733.png

 

 

 

 

palolix
Quartz | Level 8

Thank you so much for your great suggestions!

 

So since I have different types of response variables, the most appropiate procedures will be as follow:

 

For continuous (measures) I would use proc genmod (normal or gamma dist).

For binary (0/1 or 0/100) I would use proc logistic.

For multinomial  (scales; 0, 1, 1.5, 2, 2.5, 3) I would use proc logistic. 

For ordinal (fruit browning; 0=no browning, 1=mild, 2=severe) I would use proc catmod (is this procedure only for ordinal data?).

 

Does it sounds reasonably to you? Also, how can I specify in proc logistic if my response var is binary or multinomial?

 

Thank you very much!

Caroline

Ksharp
Super User

"For multinomial (scales; 0, 1, 1.5, 2, 2.5, 3) I would use proc logistic.
For ordinal (fruit browning; 0=no browning, 1=mild, 2=severe) I would use proc catmod (is this procedure only for ordinal data?)."

Multinomial logistic model has two type of model.
One is for non-ordianl variable like : color: red,green,blue , you need to use link function GLOGIT.
/*y is non-ordinal*/
proc logistic ....
model color=...../ link=glogit;
run;

Another is for ordianl variable like : scale: 1,2,3, you need to use link function CLOGIT.
/*y is ordinal*/
proc logistic ....
model scale=...../ link=clogit;
run;


" I would use proc catmod (is this procedure only for ordinal data?)."
Nope. PROC CATMOD is specially designed for contingency table.
Sine your data can be formed by contingency table,you can use PROC CATMOD to model your data for LOGISTIC model or ANOVA model (check the code I showed above).


"how can I specify in proc logistic if my response var is binary or multinomial?"
That is easy ,just don't specify LINK function,SAS would automatically check Y and suite the right model for you. Like:
proc logistic ....
model y=.....;
run;

You will find out which model you are using in OUTPUT.

 

BTW,

If Y is binary variable like: 0,1 you need specify LINK=logit :

/*y is binary variable*/
proc logistic ....
model scale=...../ link=logit;
run;

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
  • 20 replies
  • 1817 views
  • 4 likes
  • 4 in conversation