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

Hi,

i was just wondering if there is a statistical test for testing how for example body mass changed after drinking and pysical activity (they are repeated as well).

Model would be

Model body mass1 - body mass2 = alcohol1-alocohol2  PA1 - PA2;

is there any test for testing how body mass changed over repeated independent variables?

Thanks in advance for any help,

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

Let's see if I can conjure up a toy dataset that captures my thinking, and then you can compare it to what you are doing. For this, let response = food intake and the two variables measured at each time for each subject be bw = body weight and bcs =body condition score, on a Likert scale of 1 to 5, 1 being very thin, 3 normal, and 5 very fat.

 

data toy;
input subject_id time bw bcs response;
datalines;
1 1 100 3 2.4
1 2 100 2 1.6
1 3 95 2 1.8
1 4 110 2 2.0
2 1 66 2 1.5
2 2 68 3 1.6
2 3 70 3 1.7
2 4 72 2 1.6
3 1 145 4 3
3 2 150 4 3.5
3 3 155 5 3.1
3 4 155 4 2.8
4 1 112 3 2.6
4 2 112 3 2.5
4 3 110 2 2.8
4 4 115 4 3.1
;

run;

proc mixed data=toy;
class subject_id time;
model response = time bw bcs/solution;
repeated time/subject=subject_id type=ar(1);
run;

If you run this you should see that there is no statistically significant effect on food intake due to time or bcs, and a statistically significant linear increase in food intake due to bw. If there were more data, I would consider adding interactions between time and the other two covariates.  If this is not what you are looking for, please try again, but try to refer to the variables in this example.

 

SteveDenham

 

View solution in original post

4 REPLIES 4
SteveDenham
Jade | Level 19

First question, is the effect of any of your repeated predictors linked solely to the current response (this will have an easy response), or does the predictor at a previous timepoint affect the response as well (this gets into timeseries analysis)?

 

If it is the first case, then get your data in "long" format with each record having an entry for the subject_id, the timepoint, the response variable value at that timepoint, and each predictor variable value at that timepoint.

 

From there, questions like "Is this predictor continuous or categorical?" and "Is there a possibility of predictors interacting that could affect my interpretation?" and "What do I do if all my predictors are continuous, but have very different ranges of values?" become important.

 

In any case any of the linear modeling PROCs are capable of handling data of this sort.

 

SteveDenham

Skillside
Calcite | Level 5
Dear Steve, thank you for your quick response, your questions are crucial. However, I have a feeling that in this case we too much focus on a dependent variable, while the predictor can change over time as well. The predictor in this case is ordinal expressed on Lickert's scale, Is there any statistical test that focuses on the variability of the predictor as well? I hope you understood my idea.
SteveDenham
Jade | Level 19

Let's see if I can conjure up a toy dataset that captures my thinking, and then you can compare it to what you are doing. For this, let response = food intake and the two variables measured at each time for each subject be bw = body weight and bcs =body condition score, on a Likert scale of 1 to 5, 1 being very thin, 3 normal, and 5 very fat.

 

data toy;
input subject_id time bw bcs response;
datalines;
1 1 100 3 2.4
1 2 100 2 1.6
1 3 95 2 1.8
1 4 110 2 2.0
2 1 66 2 1.5
2 2 68 3 1.6
2 3 70 3 1.7
2 4 72 2 1.6
3 1 145 4 3
3 2 150 4 3.5
3 3 155 5 3.1
3 4 155 4 2.8
4 1 112 3 2.6
4 2 112 3 2.5
4 3 110 2 2.8
4 4 115 4 3.1
;

run;

proc mixed data=toy;
class subject_id time;
model response = time bw bcs/solution;
repeated time/subject=subject_id type=ar(1);
run;

If you run this you should see that there is no statistically significant effect on food intake due to time or bcs, and a statistically significant linear increase in food intake due to bw. If there were more data, I would consider adding interactions between time and the other two covariates.  If this is not what you are looking for, please try again, but try to refer to the variables in this example.

 

SteveDenham

 

Skillside
Calcite | Level 5
Thank you SteveDenham.
All the best,
Skillside

SAS Innovate 2025: Register Now

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!

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
  • 4 replies
  • 876 views
  • 0 likes
  • 2 in conversation