Hello,
I have a repeated-measures long-form dataset with moderate-to-vigorous physical activity (MVPA) minutes and happiness scores derived from a survey. Each person (ID
) has more than one row of data (i.e., long-form data) with the time point indicated by the variable Happiness_date
. MVPA_7DBF_mins_wkly
(MVPA minutes/week) and the outcome Happiness_score
are measured at each Happiness_date
per person (varying at each time point within each person; 9-12 Happiness_dates
/ rows per person). MVPA_7DBF_mins_wkly_btwn
represents the mean MVPA per person and is a between-person variable (the same within each subject). MVPA_7DBF_mins_wkly_wthn
represents a subject's deviation in MVPA from their own overall mean at a given date (i.e., MVPA_7DBF_mins_wkly
- MVPA_7DBF_mins_wkly_btwn
). The dataset has the between-person demographic variables sex
and age_years
. Below is a sample of my data (about 1% of the observations):
Data PA_happ;
Input ID Happiness_date date12. Happiness_score MVPA_7DBF_mins_wkly MVPA_7DBF_mins_wkly_wthn MVPA_7DBF_mins_wkly_btwn Sex $ age_years;
datalines;
1 05Mar2020 7 35.36 4.71 30.65 Female 59
1 04Apr2020 3 32.03 1.38 30.65 Female 59
1 04May2020 3 34.19 3.54 30.65 Female 59
1 03Jun2020 4 34.73 4.08 30.65 Female 59
1 06Jul2020 4 21.89 -8.77 30.65 Female 59
1 03Aug2020 9 39.18 8.52 30.65 Female 59
1 01Sep2020 8 30.02 -0.64 30.65 Female 59
1 01Oct2020 13 33.81 3.16 30.65 Female 59
1 31Oct2020 6 24.44 -6.21 30.65 Female 59
1 02Dec2020 8 24.16 -6.50 30.65 Female 59
1 30Dec2020 4 27.64 -3.01 30.65 Female 59
1 29Jan2021 12 30.40 -0.26 30.65 Female 59
2 17Mar2020 12 2.68 -11.44 14.61 Female 18
2 16Apr2020 6 18.11 3.99 14.61 Female 18
2 16May2020 5 18.63 4.51 14.61 Female 18
2 15Jun2020 7 1.12 -13.00 14.61 Female 18
2 15Jul2020 5 25.33 11.21 14.61 Female 18
2 15Aug2020 5 8.36 -5.76 14.61 Female 18
2 14Sep2020 5 19.69 5.57 14.61 Female 18
2 14Oct2020 5 8.07 -6.05 14.61 Female 18
2 13Nov2020 7 27.16 13.03 14.61 Female 18
2 12Dec2020 5 22.37 8.25 14.61 Female 18
2 12Jan2021 5 9.22 -4.90 14.61 Female 18
3 09Mar2020 5 49.27 1.75 47.52 Male 24
3 09Apr2020 7 49.85 2.33 47.52 Male 24
3 08May2020 8 45.64 -1.88 47.52 Male 24
3 07Jun2020 5 46.11 -1.41 47.52 Male 24
3 07Jul2020 5 52.47 4.96 47.52 Male 24
3 06Aug2020 3 51.83 4.31 47.52 Male 24
3 05Sep2020 7 50.60 3.09 47.52 Male 24
3 06Oct2020 7 43.23 -4.29 47.52 Male 24
3 04Nov2020 8 44.54 -2.98 47.52 Male 24
3 04Dec2020 7 40.76 -6.75 47.52 Male 24
3 03Jan2021 4 44.13 -3.39 47.52 Male 24
3 02Feb2021 9 51.79 4.27 47.52 Male 24
4 02Apr2020 3 22.31 -5.31 27.62 Male 40
4 01May2020 3 27.64 0.02 27.62 Male 40
4 31May2020 4 35.54 7.93 27.62 Male 40
4 30Jun2020 6 35.75 8.14 27.62 Male 40
4 28Sep2020 4 29.05 1.43 27.62 Male 40
4 29Oct2020 4 25.56 -2.05 27.62 Male 40
4 27Nov2020 5 19.71 -7.91 27.62 Male 40
4 28Dec2020 3 23.03 -4.59 27.62 Male 40
4 28Jan2021 6 29.96 2.34 27.62 Male 40
5 10Apr2020 13 24.35 7.09 17.26 Male 35
5 10May2020 6 19.39 2.14 17.26 Male 35
5 10Jun2020 9 23.42 6.17 17.26 Male 35
5 10Jul2020 10 22.16 4.91 17.26 Male 35
5 09Aug2020 6 20.33 3.07 17.26 Male 35
5 09Sep2020 6 19.34 2.08 17.26 Male 35
5 09Oct2020 9 19.92 2.66 17.26 Male 35
5 06Nov2020 12 5.65 -11.61 17.26 Male 35
5 06Dec2020 5 14.03 -3.23 17.26 Male 35
5 04Jan2021 5 3.97 -13.28 17.26 Male 35
;
Run;
data PA_happ; set PA_happ; format Happiness_date date9.;run;
I'm using PROC MIXED to examine the within- and between-person effects (linear and quadratic) of MVPA on happiness, adjusting for sex and age. Below is my model code:
Proc mixed data=PA_happ NOCLPRINT NOITPRINT COVTEST METHOD=ML namelen=70;
CLASS Sex(ref='Female');
model Happiness_score=MVPA_7DBF_mins_wkly_wthn MVPA_7DBF_mins_wkly_wthn*MVPA_7DBF_mins_wkly_wthn
MVPA_7DBF_mins_wkly_btwn MVPA_7DBF_mins_wkly_btwn*MVPA_7DBF_mins_wkly_btwn Sex age_years / SOLUTION CL;
RANDOM Intercept / TYPE=AR(1) Subject=ID;
Title 'MVPA (mins) 7-day predicting happiness score';run;title;run;
Unfortunately, PROC mixed only produces unstandardized measures of effect size and error (Estimate and Standard Error) and does not provide a standardized measure such as the standardized beta produced by PROC REG. From what I have read on this forum, a solution could be to standardize the predictors and outcomes in your model using PROC STDIZE and re-run the analysis, with the Estimate in this re-run model representing the standardized effect. I have used this strategy successfully in the past to obtain 95% CI of the standardized beta from PROC REG on between-persons data (i.e., where observations are not repeated per person and no RANDOM intercept is present).
As we know, standardization (typically) produces z-scores, which are dependent on other scores in the data. In a purely between-person dataset, the standardized variable should represent how many standard deviations away from the across-person mean that individual person's score is. However, using a standard PROC STDIZE on my dataset would not take into account the fact that my observations are nested within each person and therefore more correlated with one another - i.e., the observations are not independent. My question is whether there is a way to account for the repeated-measures nature of the data when performing PROC STDIZE, or if there is some better way to obtain values representing a standardized effect (and associated standard error / 95% confidence interval) from the PROC MIXED model I used with my data.
I hope that was clear; please let me know if you need more clarification. Thanks for your help.
Bump (I have an abstract deadline coming soon)
You might use PROC GLIMMIX to fit your model. There is a STDCOEF option in the MODEL statement in PROC GLIMMIX that might work for you.
https://go.documentation.sas.com/doc/en/pgmsascdc/v_040/statug/statug_glimmix_syntax18.htm
Thanks,
Jill
Hello,
Thanks, but this is not what I am looking for. I want the equivalent of STB in proc reg, i.e., a coefficient that represents how many standard deviations the outcome changes with an increase of one standard deviation in the predictor, with values ranging from -1 to 1. It appears that STDCOEF does not represent this.
The STDCOEF option in the MODEL statement in PROC GLIMMIX gives you standardized betas, but they are not the same as what you get from STB in PROC REG. STDCOEF centers the X's by subtracting the mean and dividing by the corrected sum of squares for that X (sum of (Xi - Xbar)**2). That is the default centering and scaling that GLIMMIX does for all columns of X to improve numerical stability when estimating the model.
The STDCOEFF in PROC GLIMMIX are computed differently than those in REG and it is okay that the standardized coefficients are greater than one. You can still look at the relative scale of the parameters to see what variables are important.
I am not aware of a way you requested for models fit in PROC MIXED that accounts for correlations in the data.
Thanks,
Jill
Thanks, but for reporting the effect sizes in my papers, I need a parameter that ranges from -1 to 1 for interpretation's sake. So this is unfortunately not useful. I appreciate your reply.
You could map it into [-1,1],like:
STDCOEFF-min X-(-1) ---------------- = ------- max-min 1-(-1)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.