Programming the statistical procedures from SAS

multivariate multiple regression repeated measures

Reply
Contributor
Posts: 30

multivariate multiple regression repeated measures

Hi guys,

I'm working on this project analyzing if different exercises (ie squats, shoulder press....) can explain spine angle and loading with different lift combinations...symmetry  (symmetric & asymmetric) and loads (heavy and light).

20 subjects are to perform 2 different types of lifts (symmetric and asymetric) with 2 loads (heavy weight and light weight).  Spine angle (bend, twist, flex) and spine load (comp, ap, ml) are measured for each type/load (symmetric/heavy, symmetric/light, asym/heavy, asym/light).

7 exercises (dsqt, hstp, ilng, shld, aslr, pshp, rtry) were also performed for each type/load, the subjects report the feeling (scale from 1 to 4, 1 is painful and 4 is comfortable) they experienced while doing each of these exercises.

I would like to see which (if any) of the 7 exercises explains the spine angle and load.  Also comparing the results between symmetric/asymmetric.

I'm not sure how exactly to do this with either PROC MIXED or PROC GLM.  Here is my attempt at it, but I'm sure it's not right.  Can someone give me a pointer?

data wide;

input subject age height mass group symmetry$ load$ bend twist flex comp ap ml dsqt hstp ilng shld aslr pshp rtry;

datalines;

s01     28     1.81     77.1     hi     asym     heavy     2.3     1.1     88     9.2     .32     .12     2     2     3     3     3     2     2

s02     34     1.57     67.1     lo     asym     heavy     4.3     2.1     98     4.2     .36     .22     3     2     4     3     2     4     2

.

.

s01     28     1.81     77.1     hi     asym     light     2.3     1.1     88     9.2     .32     .12     2     2     3     3     3     2     2

s02     34     1.57     67.1     lo     asym     light     4.3     2.1     98     4.2     .36     .22     3     2     4     3     2     4     2

.

.

s01     28     1.81     77.1     hi     sym     heavy     8.3     7.1     58     2.2     .92     .13     1     2     1     3     4     2     4

s02     34     1.57     67.1     lo     sym     heavy     4.6     2.8     91     4.4     .96     .72     3     1     4     2     2     4     4

.

.

s01     28     1.81     77.1     hi     sym     light     3.3     1.9     68     3.2     .32     .12     2     2     1     1     3     4     2

s02     34     1.57     67.1     lo     sym     light     2.3     5.1     28     4.2     .36     .22     3     2     1     2     2     1     2

.

.

;

data long;

length var$12;

length var2$12;

set data wide;

response=bend; var='bend';output;

response=twist; var='twist';output;

response=flex; var='flex';output;

response=comp; var='comp';output;

response=ap; var='ap';output;

response=ml; var='ml';output;

exercise=dsqt; var2='dsqt'; output;

exercise=hstp; var2='hstp'; output;

exercise=ilng; var2='ilng'; output;

exercise=shld; var2='shld';output

exercise=aslr; var2='aslr';output;

exercise=pshp; var2='pshp';output;

exercise=rtry; var2='rtry';output;

drop bend twist flex comp ap ml dsqt hstp ilng shld aslr pshp try;

proc mixed data=long;

class subject age height mass group symmetry load var var2;

model response = age|height|mass|group|symmetry|load|var|var2|exercise;

repeated var var2 / type=un@ar(1) subject=subject;

run;

thanks.

ming

Respected Advisor
Posts: 2,655

Re: multivariate multiple regression repeated measures

The first thing you probably should change is the type= option in your repeated statement. AR(1) specifies an autoregressive error, where measurements closer in time (or space) are more correlated than those farther apart.  Unless the exercises were always done in the same order, separated by the same amount of time, this probably is not a good assumption for the error structure.  Since you only have 20 subjects, I can't recommend an unstructured error either, which leaves type=un@cs.

Next, with only 20 subjects, that class statement has to produce a lot of empty cells with 7 non-repeated classes.  Can any be considered continous (age, height, mass)?  Using them as continuous covariates may help with any convergence and estimation problems.

For a first step, though, this is good, but overly complicated for the amount of available data.

Steve Denham

Contributor
Posts: 30

Re: multivariate multiple regression repeated measures

Hi Steve,

I just realized the 7 exercises are IVs for all the 6 DVs.  So here is my revised code...

data long;

length var$12;

length var2$12;

set data wide;

response=bend; var='bend';output;

response=twist; var='twist';output;

response=flex; var='flex';output;

response=comp; var='comp';output;

response=ap; var='ap';output;

response=ml; var='ml';output;

drop bend twist flex comp ap ml;

proc mixed data=long;

class subject group symmetry load var ;

model response = age height mass symmetry|load var dsqt hstp ilng shld aslr pshp rtry;

repeated var / type=cs subject=subject;

run;

When I ran type=un, it gave me error "hessian is not positive" and when I use type=ar(1), the AIC is much higher than type=cs, so I chose cs model.

does this look right?  If the type 3 tests is significant for the IV, do I then perform univariate ANOVA for relevant contrasts?  is there a command for that in proc mixed?

thanks.

ming

Contributor
Posts: 30

Re: multivariate multiple regression repeated measures

Hi Steve,

I tried your suggestion and revised the code,

data wide;

   infile 'fire.csv' firstobs=2 delimiter=',';

   input subject$ age ht mass grp$ trial bend twist flex compr ap ml dsqt hstp ilng shld aslr pshp rtry comp;

   drop comp;

data long;

length spine $12;

set wide;

response=bend; spine='bend';output;

response=twist; spine='twist';output;

response=flex; spine='flex'; output;

response=compr; spine='compr'; output;

response=ap; spine='ap'; output;

response=ml; spine='ml'; output;

drop bend twist flex compr ap ml;

proc mixed data=long;

   class subject grp trial spine;

   model response = age ht mass trial spine dsqt hstp ilng shld aslr pshp rtry;

   repeated spine trial  / type=un@cs subject=subject ;

run;

this gave me an error of "stopped because of infinite likelihood".  Is it because of not enough power?

thanks.

ming

Respected Advisor
Posts: 2,655

Re: multivariate multiple regression repeated measures

No.  It is most likely that there are multiple records for each subject/spine/trial combination.  A quick PROC FREQ will answer that.  Then you will need to change the subject= so that each instance of subject is unique, save for spine and trial.

Steve Denham

Contributor
Posts: 30

Re: multivariate multiple regression repeated measures

Hi Steve,

I have a similar problem as the one that you were helping me.  Just wondering if you check where I made the mistake in my code, since it is telling me that "did not converge" when I set type = un@ar(1), and if I change it to un@cs the error message is "hessian is not positive".

my experiment is:

50 subjects total, each subject is categorized into 3 groups (control/mov/fit) and did 20 different types of exercise (vertical jump, hand grip strength, ....) to be used to explain the variables in experiment 2.

once each subject have completed the 20 initial exercises, they proceed to experiment 2 where each subject will perform 8 different tasks (symmetric pull, asymmetric pull,....) and 3 spine measurements (compression and 2 shears) are recorded.  The I want to see which of these 20 exercises explain the 3 spine measurements well?  so it might shake out only 7 of these exercises do or maybe 12???

here is my proc mixed code:

data wide;

   input task$ subject$ group$ time$ height weight comp shear1 shear2 exerc1-exerc20;

data long; set wide;

   length var $12.;

   response = comp; var = 'comp'; output;

   response = shear1; var = 'shear1'; output;

   response = shear2; var = 'shear2'; output;

   drop comp shear1 shear2;

proc mixed data=univariate;

   class task var subject group;

   model response = task group height weight exerc1-exerc20;

   repeated var task / type=un@ar(1) subject=subject;


run;

quit;

should I change the 20 exercises into a long format?  wouldn't that make it a triply repeated measure??? 

Really appreciated if you have the time to give me some pointers on this.

thanks.

ming

Respected Advisor
Posts: 2,655

Re: multivariate multiple regression repeated measures

This is a bit confusing.  An autoregressive structure implies some sort of time ordering, and I don't see that for task, unless the tasks are always completed in the same order.  If the latter is the case, are comp, shear1 and shear2 measured after each of the tasks?  If not, then an ar(1) type covariance is not appropriate.  I think you have 3 response variables, 20 training exercises, and (I hope this is the case) 8 different test exercises that every subject must perform--such as 10 symmetric pulls, 15 asymmetric pulls and so on.  If this is the case, then it is not really a doubly repeated measure.  Only the var is measured repeatedly, with different names.

Once we correctly identify the role of the task variable, this should come together fairly quickly.

Steve Denham

Contributor
Posts: 30

Re: multivariate multiple regression repeated measures

Yeah, this experiment is a little confusing.  Each subject completes 20 exercise tests initially.  Then they go and do the 8 tasks (in random order - asymmetric, symmetric, cbreach, chop, cpull, fe, hoh, pull, push) and the 3 DVs (compression, shear1 and shear2) were measured during each task. 

so I'm trying to see how the 20 exercises explains the 3 DVs.

hope that's more clear.

thanks.

ming

Respected Advisor
Posts: 2,655

Re: multivariate multiple regression repeated measures

See 's answer elsewhere in this forum https://communities.sas.com/message/178512.  He covered everything.

Steve Denham

Contributor
Posts: 30

Re: multivariate multiple regression repeated measures

Hi Steve,

I tried the PROC MIXED doubly multivariate repeated measures approach that Matthew Zack suggested and I get "insufficient memory" after 20min of SAS computation.  Here is the code:

data multivariate;

   infile 'fire_fitness.csv" firstobs=2 delimiter=',';

   input task$ subject$ group$ time$ height weight comp shear1 shear2 exerc1-exerc20;

data univariate;

   length var $12;

   set multivariate;

   array e(20) exerc1-exerc20;

   array dv(3) comp shear1 shear2;

   array varlist(3) $12 _temporary_ ("comp" "shear1" "shear2");

   do i=1 to 20;

      exercise=e(i);

      do j=1 to 3;

         response=dv(j);

         var=varlist(j);

         output univariate;

      end;

  end;

  drop i j comp shear1 shear2 exerc1-exerc20;

run;

proc sort data=univariate;

   by subject exercise task var;

proc mixed data=univariate;

   class subject exercise task var;

   model response = var|task|exercise /solution ddfm=kenwardroger;

   repeated var task / type=un@un subject=subject;

run;

quit;


the output showed this:

mixed.png

the "exercise" is being used as nominal variable and that's why I have 526 levels.  however, I only have 20 exercises for each person... not sure I can rewrite the code so I can have exercise as 20 levels but use the values in the analysis.

thanks for your help.

ming

Ask a Question
Discussion stats
  • 9 replies
  • 310 views
  • 3 likes
  • 2 in conversation