I'm working with crossectional test data with a selection of test results (all continuous variables) in both a patient and healthy control (HC) group. I have made separate variables for the two groups' test results e.g. test1_controls, test1_patients, test2_controls, test2_patients etc. There are 95 patients and 48 healthy controls. I've attached the data for test 1.
In order to compare the patient group to the healthy control group I want to make a new variable for each test with z-scores; generating a new value for each patient comparing them to the mean of the HC group so I can see how far above or below the "normal" data they fall. So if the test 1 z-score for patient number 1 was -2.3 that would mean they were 2.3 standard deviations below the mean of the healthy control group data for that test. What code would you use for this?
I can do a generate a standardized value using egen test1_patients_z = std(test1_patients)
but these standardized values are only based on the mean and SD of the patient group and I haven't been able to find any options that give me the result I need comparing to the healthy control mean.
I tried egen test1_patients_z = std(test1_patients), mean(#) std(#)
with # being manually entered mean and SD of test1_controls (which I got by codebook) but that did not work (it just shifted the whole scale upwards by the HC mean rather than the normal z score mean of 0).
Thanks for your help!
Related Posts with Generating a new variable with standardized values compared to a healthy control group mean and SD (z scores)
Wald test: the whole interaction not significant but one level is signficantDear all, I am computing a multinomial logit on two outcomes (Marriage, Dissolution vs a reference …
Who do people rescale a weight variable?Dear all, I have a question on rescaling/transforming a variable, particularly a weight variable. I…
Data visualization - How to break a label on tline into multiple lines?Hello, Please see my current graph. I would like to split the "Arab Spring" label in two lines M…
Peer firm averageHi, I have a panel data (firm-year level). Anyone knows how to construct Peer firm average, which i…
Generating week IDs based on fiscal yearsI am quite new to stata and struggling to generate weeks based on fiscal year start and end dates. S…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a new variable with standardized values compared to a healthy control group mean and SD (z scores)
Post a Comment