Hello,
I am examining the longitudinal trajectories of various biomarkers, and I would like to standardize the biomarkers at each time point according to a baseline reference norm (formed from young, healthy participants) by sex. Thus far, I used the syntax below. However, the resulting ‘z scores’ are not true z scores as they do not have a mean of 0 and a sd of 1. How can I standardize in this way and obtain true z scores? Any thoughts would be much appreciated.
*generate norm means and standard deviations for females
foreach var of varlist biomarker0 biomarker0 biomarker0 biomarker0 {
sum `var' if age < 45 & gender == 0 & disease0 == 0
return list
gen nm_`var' = r(mean)
gen nsd_`var' = r(sd)
}
*generate norm means and standard deviations for females
foreach var of varlist biomarker0 biomarker0 biomarker0 biomarker0 {
sum `var' if age < 45 & gender == 1 & disease0 == 0
return list
replace nm_`var' = r(mean) if gender == 1
replace nsd_`var' = r(sd) if gender == 1
}
* generate zscores for biomarkers at baseline
foreach var of varlist clean_ biomarker0 biomarker0 biomarker0 biomarker0 {
gen z`var' = (`var'- nm_`var')/nsd_`var'
}
* generate zscores for biomarkers at follow-up 1 and follow-up 2
gen zbiomarker1 = (biomarker1 - nm_biomarker0) / nsd_biomarker0
gen zbiomarker2 = (biomarker2 - nm_biomarker0) / nsd_ biomarker0
Related Posts with Standardizing longitudinal data according to a baseline reference norm
Interpretation of long and short run coefficients in ARDL modelHi, I needed some help understanding how to interpret the short and long run coefficients of ARDL m…
Handling duplicatesHello, This is my first post here and I am generally new to Stata, but I'll try to formulate my con…
Number format which does not add zeros to natural numbersI want Stata to show decimals only for numbers which are not natural. For instance - I want the numb…
Turning numeric variable into stata time variableI have a dataset broken into date and time of the day. I want to break this time variable into hour …
Date formatHello, In the dataset, the date is in format : Code: 2015 - 07 - 01 00:00:00 2016 - 01 - 01 00:00…
Subscribe to:
Post Comments (Atom)
0 Response to Standardizing longitudinal data according to a baseline reference norm
Post a Comment