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

Hi, I am exploring the slope of two measures (e.g., weight and height) z score.

 

Then I got the slope for each measure. I want to know whether the coefficient was different significantly.

Though I could see their 95%CI was not overlapped.

 

 

 EstimateStandard ErrorDFt ValuePr > |t|AlphaLowerUpper
weight-0.020.0021440-12.79<.00010.05-0.023-0.017
height-0.0310.0021546-17.22<.00010.05-0.034-0.027

 

which procedure could I use?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Based on what you've told me, I don't think comparing your analyses is meaningful. If I understand you correctly, you have the same subjects in two different data sets. In each data set, you rescale the response variable before you perform a regression, based only on the values in that data set.

 

I think the standard way to analyze the longitudinal data is to have one data set with variables

SubjectID, Y, timepoint, weight, height, ...

 

View solution in original post

16 REPLIES 16
PaigeMiller
Diamond | Level 26

Are these two different models you fit, or one model with two x-variables?

 

Did you do this in PROC REG, or PROC GLM, or elsewhere?

 

Assuming this is one model with two x-variables:

 

In PROC REG, you can use the TEST statement

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

 

In PROC GLM, there is a TEST statement, but it does different things than PROC REG. In PROC GLM, you want the CONTRAST statement: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

 

Also, comparing confidence intervals to see if they overlap isn't the correct thing to do.

 

 

--
Paige Miller
Jie111
Quartz | Level 8

They are from different models. I got the results from the mixed-effect model.

PaigeMiller
Diamond | Level 26

If these are slopes from two different models, I am not aware of any way to statistically compare the slopes. In fact, the idea of statistically comparing slopes from two different variables from two different fitted models doesn't really make sense to me.

--
Paige Miller
Jie111
Quartz | Level 8

Thanks for the quick reply.

 

Since we used the Z score, we thought they might be comparable.

Rick_SAS
SAS Super FREQ

You say you "use the Z score." What does that mean? Did you standardize each variable by subtracting the mean and then divide by the standard deviation?

 

Please post your SAS code and we'll be able to answer your questions with more confidence.

Jie111
Quartz | Level 8

data atl_two_bmi_3; set atl_two_bmi_3; if sex=0 then zscore=(col1-26.208)/3.320; if sex=1 then zscore=(col1-25.552)/4.143; run; proc mixed data=atl_two_bmi_3 order=formatted; class t; model zscore=timepoint/ outp=predbmi solution ddfm=kr; repeated t /subject=l_pnr type=un; estimate "slope for the total population" timepoint 1 /cl; run; data atl_two_measure2_3; set atl_two_measure2_3; if sex=0 then zscore=(col1-37.226)/3.086; if sex=1 then zscore=(col1-35.878)/3.356; run; proc mixed data=atl_two_measure2_3 order=formatted; class t; model zscore=timepoint/ outp=predmeasure2 solution ddfm=kr; repeated t /subject=l_pnr type=un; estimate "slope for the total population" timepoint 1 /cl; run;

Hi, I did the z score using the mean and std of each measure.

 

Then I used the mixed effect model to get the slope.

 

 

Thanks.

PaigeMiller
Diamond | Level 26

So this is not what you described earlier, this is the same variable in two different models using two different data sets (earlier you had two different variables).

 

In that case, I would combine the data sets into one (if that makes sense from a subject matter expertise standpoint), create an indicator variable to indicate which data set it comes from, then test the slopes in one model.

 

Something like this:

 

   proc mixed data=combined_data_set;
     class t indicator_variable;
     model zscore=indicator_variable timepoint 
         indicator_variable*timepoint/ outp=predbmi solution ddfm=kr;
     repeated t /subject=l_pnr type=un;
   run;

Then the interaction indicator_variable*timepoint tests whether or not the slopes of timepoint are the same across the two data sets.

--
Paige Miller
Rick_SAS
SAS Super FREQ

According to your code, the data used for the first model is from a different data set than the second model.

 

Are the data from the same subjects at the same time points in the same order?  In other words, does the i_th row in DataSet1 correspond to the i_th row of DataSet2 for every row?

Jie111
Quartz | Level 8

Hi,

 

Thanks for the reply.

 

The datasets are from the same population. But for the same subject, one might have BMI at time1 but not have Muscle measure at time1.

 

I provided the datasets first 10 lines for BMI and Muscle.

 

 

Dataset for BMI z score  Dataset for muscle mass z score
IDBMIzscoretimepoint  IDMuscle masszscoretimepoint
          
124.7409-0.195770  1360.036350
124.7409-0.195776  1390.930276
125.71170.0385412  127-2.6454112
324.8016-0.181130  3380.63230
      3360.036356
321.6128-0.9508112  3370.3343312
422.8625-0.649160  4370.334330
423.6652-0.455416      
424.2424-0.3160912  4380.632312
626.50210.229330  635-0.261620
PaigeMiller
Diamond | Level 26

So again this is different than the anything you have described above. Now you have the same X variable each time (timepoint) but two different Y variables, despite the fact that you call them by the same variable name ZSCORE. 

 

As far as I know, you would have to do this with two different models, and I go back to my earlier statement, there is no statistically meaningful way to do this comparison.

--
Paige Miller
ballardw
Super User

@Jie111 wrote:

Hi, I did the z score using the mean and std of each measure.

 

Then I used the mixed effect model to get the slope.

 

 

Thanks.


Depending on exactly how you got the values to create the z-score in this code:

data atl_two_bmi_3;
  set atl_two_bmi_3;
  if sex=0 then zscore=(col1-26.208)/3.320;
  if sex=1 then zscore=(col1-25.552)/4.143;
run;

You may have been able to accomplish the same thing from your raw data by 1) sorting by sex (as a BY statement is involved) and use something like:

proc stdize data=have out=standardized;
   by sex;
   var <variables of interest>;
run;

By default Proc Stdize will use METHOD=STD to standardize the variables, which will use the Mean and Standard Deviation as the data set does without having to use another procedure to the mean and std deviation then use a data step. Also there may be less "error" in the standardization based on rounding of the mean and std values.

 

I also suggest that you do not use the

 

Data  somesetname;

    set somesetname;

 

until you are pretty experienced with SAS. Using the same set name as source and output completely overwrites the data set. So if you have an error, like misspelling a variable, or using the wrong variable because of similar names, you can effectively either destroy your values or create errors that may take hours if not days to trace down as to the exact cause.

Jie111
Quartz | Level 8
Hi,

Thanks for the reply and kind reminding.
Rick_SAS
SAS Super FREQ

Based on what you've told me, I don't think comparing your analyses is meaningful. If I understand you correctly, you have the same subjects in two different data sets. In each data set, you rescale the response variable before you perform a regression, based only on the values in that data set.

 

I think the standard way to analyze the longitudinal data is to have one data set with variables

SubjectID, Y, timepoint, weight, height, ...

 

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 Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 16 replies
  • 1151 views
  • 9 likes
  • 4 in conversation