BookmarkSubscribeRSS Feed
teuni
Calcite | Level 5

Dear all,

 

I would like to assess the relationship between time of day of (protein) intake and overall (protein) intake. Therefore, I want to calculate corelations between the proportion ingested during each hour of the day and the total amount ingested over the entire day. In the end I would like to create a graph such as the one shown in the attachment. In this example, however, time is divided into categories, whereas I want to handle time as a continuous variable.

 

The difficulty is that I am working with repeated measures (2 observations per participant). I do not know exactly how to handle this in my syntax.

 

My data looks as follows. So, for each participant I have 48 records (24 hours for each day). Since I want to correlate the proportion of protein ingested during each hour of the day, I created the variable (proportion_protein), by dividing protein_hour by protein_day and multiplying it by 100.

data test1;
input subject:12. day:12. hours:12. protein_day:12. protein_hour:12. proportion_protein:12.;
datalines;
1   1  8 99   0   0
1   1  9 99  11  11
1   1 10 99   0   0 
...
...
...
750 2 22 56   0   0
750 2 23 56 0.8 1.5
run;

 

 

I've thought about the following syntax (adapted from: http://www2.sas.com/proceedings/sugi29/198-29.pdf). However I do not know if I am correct. Do I have to add both proportion_protein and hour into the model, or is this not needed? I have the feeling that if I do not do it, SAS won't know which proportions belong to which hours of the day.

ods graphics on;

PROC mixed DATA=test method=reml covtest plots(maxpoints=none);

Class subject day (ref=first) hour (ref=first);

MODEL prot_day = proportion_protein hour proportion_protein*hour / solution ddfm=kr ;

Random prot_hour /type=un subject=subject v vcorr;

Repeated day / type=un subject=hour(subject) r rcorr;

run;

ods graphics off;

 

After running this syntax, log says the following:

NOTE: Convergence criteria met.

NOTE: PROCEDURE MIXED used (Total process time):

real time 9.96 seconds

cpu time 9.82 seconds

 

 

I do not exacly know if this is the outcome I needed. Also no graphics are shown. Is it even possible to translate this data into a graph as the one shown in the attachement. Or is this not possible? Can someone maybe help me with this? Many thanks in advance.

 


Correlation.png
1 REPLY 1
SteveDenham
Jade | Level 19

In order to treat day as a repeated effect, you need to include it in the model statement.  What happens with something like:

ods graphics on;
PROC mixed DATA=test method=reml  plots(maxpoints=none);
Class subject day (ref=first) hour (ref=first);
MODEL prot_day = proportion_protein|hour|day / solution ddfm=kr ;
Random prot_hour /type=un subject=subject v vcorr;
Repeated day / type=un subject=hour(subject) r rcorr;
lsmeans proportion_protein|hour|day/cl; run; ods graphics off;

Not quite sure about this, because I think you will have a LOT of values for prot_hour, and fitting an unstructured covariance structure may lead to convergence or estimation problems.

 

Also, this approach assumes that hour is not a repeated measure on a subject, which is probably not a good assumption.  You may need to recast day and hour into a single time variable, if you want to fully capture the repeated nature of the design.  Alternatively, you might consider day as a random effect, and look at marginal effects over day for proportion protein and hour.

 

Steve Denham

 

 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 1330 views
  • 0 likes
  • 2 in conversation