BookmarkSubscribeRSS Feed
Liz123
Obsidian | Level 7

Hello everyone, 

 

I am conducting a study looking at change in  average use of cigarettes from week to week in each unique user. The "y" is the number of cigarettes , hence it's continuous. The "X" is  week1, week 2, etc.  There are repeated measures for every individual and several timepoints that are different from one another. Can  I use  linear mixed model for the data analysis? If not, what type of analysis would you suggest? 

8 REPLIES 8
ballardw
Super User

Can you show an example of some cases of your data?

It is not clear to me exactly what your data may look like as regards "repeated measures" (does this mean multiple within a given "week"?)

 

If the data is actually an identifier, a numeric value for "week" and the count of cigarettes without multiple values for given weeks then a simple regression would give the "average change in cigarettes per week" as the parameter of the Week variable with something like:

data example;
  input id $ week y;
datalines;
a 1 100
a 2 98
a 3 99
a 4 94
a 5 93
b 1 44
b 2 42
b 3 40
b 4 38
b 5 36
;

proc reg data=example;
   by id;
   model y=week;
run;
Liz123
Obsidian | Level 7

Hello Ballardw,

 

Thanks so much for your reply. Highly appreciated. Each individual has multiple values of cigarette counts in a week. For example, someone may have 5 cigarettes in one day, then next day, 15, following day 7 etc. and the unique users all have different several timepoints. I hope that answers your question.

Ksharp
Super User

Yes . You should use Mixed Model.

Since your Y is count data, you should use PROC GLIMMIX with possion distribution.

 

proc glimmix data=counts method=quad;
class sub ;
model count = week / link=log s dist=poisson;
random int / subject=sub;

random week/ subject=sub residual ; run;

and @lvm  @StatDave   @SteveDenham   

could give you better code.

 

SteveDenham
Jade | Level 19

@Ksharp 's code has a residual option in one of the random statements. METHOD=QUAD doesn't accept R-side (residual side) effects. I would add week to the CLASS statement and try this:

 

proc glimmix data=counts method=quad;
class sub week ;
model count = week / link=log s dist=poisson;
random int / subject=sub;
random week/ subject=sub type=ar(1) ; /* You may want to consider other structures */
run;

I am going to call in @StatDave because I think this question might be addressed better using PROC GEE (and he is much more familiar with PROC GEE than I am), as I believe you are interested in the marginal effects of time, rather than subject-specific effects.

 

SteveDenham

 

 

Liz123
Obsidian | Level 7

Hello SteveDenham, 

 

Okay. Thanks so  much for your suggestion! Much appreciated! I will try this as well and I will let you know if I have any questions. 

Liz123
Obsidian | Level 7

Hello Ksharp, 

Thanks so much for this! I will try this and let you know whether it works. Thanks again!

Ksharp
Super User

Here you could find more example in the famous book "Applied Longitudinal Analysis, 2nd Edition".

Applied Longitudinal Analysis (harvard.edu)

E.X.

data seizure;
     infile 'epilepsy.dat';
     input id trt age y0 y1 y2 y3 y4;
          y=y0; visit=0; output;
          y=y1; visit=1; output;
          y=y2; visit=2; output;
          y=y3; visit=3; output;
          y=y4; visit=4; output;
          drop y0-y4;


proc sort;
by id visit;

data seizure;
     set seizure;
     if visit=0 then do; 
          time=0; 
          ltime=log(8); 
     end;
     else do; 
          time=1; 
          ltime=log(2); 
     end;



title1 Mixed Effects Log-linear Regression Model (Random Intercept and Slope);
title2 Clinical Trial of Epileptic Patients;


proc glimmix method=quad(qpoints=50);

     class id;

     model y = time trt trt*time / dist=poisson link=log offset=ltime solution;

     random intercept time / subject=id type=un g;   
run;
Liz123
Obsidian | Level 7

@Ksharp , thank you!!! This is helpful!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 8 replies
  • 1141 views
  • 6 likes
  • 4 in conversation