Hi ,
I have a parameter with lab test values(aval) at two different visits(day1, week4). So i need calculate a Geometric Mean Ratio for (Week 4 Antibody Level / Day 1 Antibody Level). for a parameter by vaccine group at week 4
Below is the example:
subject paramcd avisit aval GMR
101 aaa day1 1.3 ?
101 aaa week4 2.2
102 aaa day1 1.1
102 aaa week4 3.3
103 aaa day1 2.8
103 aaa week4 4.7
How to calculate GMR varaible and also a 95%cI
Please provide your insights with an example . so it would be helpful to me .. Thanks in Advance
Thanks for the improved code and the explanations.
@mounikag wrote:
5. We need to calculate 95% CI using clopper pearson method for particular geometric ratio
The geometric means are calculated from antibody levels (measured on a continuous scale). As I said, the "Clopper-Pearson method" I know is applicable to binomial proportions (see PROC FREQ documentation), which I don't see in your data or code.
6. what i meant is i need to keep the value of geometric mean ratio between day1 / week 4. so i need to calculate GMR across two visists for each parameter. so how i have to calculate to get the value of GMR? Please take the example of 101 subject at day1 the avla value is 1.3 and week 4 value is 2.2 so what will be the GMR value between these two aval values? could you please let me know your inputs with a code
Geometric means (and means in general) are calculated as a summary of two or more values, not for a single value of one subject. So I would expect these to be calculated from the AVAL values of several subjects (as shown in my first reply). The GMR would serve as a summary measure of all the individual ratios (like 2.2/1.3 for subject 101), e.g., within a treatment group.
Hi @mounikag,
Following Example 127.5 Equivalence Testing with Lognormal Data from the PROC TTEST documentation I suggest this -- assuming that your dataset is already sorted by PARAMCD SUBJECT:
/* Create sample data */
data have;
input subject $ paramcd $ avisit $ aval;
cards;
101 aaa day1 1.3
101 aaa week4 2.2
102 aaa day1 1.1
102 aaa week4 3.3
103 aaa day1 2.8
103 aaa week4 4.7
;
/* Get Day 1 and Week 4 values into separate variables */
proc transpose data=have out=trans(drop=_name_);
by paramcd subject;
var aval;
id avisit;
run;
/* Compute the GMR Week 4 / Day 1 for AVAL (for each PARAMCD) */
ods select none;
ods output conflimits=want(keep=paramcd ratio--UpperCLGeomMean
rename=(GeomMean=GMR LowerCLGeomMean=LowerCL_GMR UpperCLGeomMean=UpperCL_GMR));
proc ttest data=trans dist=lognormal;
by paramcd;
paired week4*day1;
run;
ods select all;
proc print data=want;
run;
Result:
LowerCL_ UpperCL_ Obs paramcd Ratio GMR GMR GMR 1 aaa week4 / day1 2.0426 0.8933 4.6704
Hi reinhard,
Thanks for quick reply.. *Below is the sample code i am using to generate the output to pass the GMR variable value into the below aval value.
I am using proc means procedure dataset to generate 95%CI. Could you please use below code and i need to pass the GMR value of week4/day1
instead of aval value. I will provide the sample output how i need. As you suggested, I am using the proc ttest but i am not getting the answer.
Basically i need to pass GMR value between the visits instead of aval value
* Create sample data */;
data have;
input subject $ paramcd $ avisit $ aval;
cards;
101 aaa day1 1.3
101 aaa week4 2.2
102 aaa day1 1.1
102 aaa week4 3.3
103 aaa day1 2.8
103 aaa week4 4.7
104 aaa day1 3.8 2
104 aaa week4 4.8 2
105 aaa day1 2.8 3
105 aaa week4 5.7 3
106 aaa day1 3.7 3
106 aaa week4 4.8 3
;
run;
proc sort data=have ;
by avisit trt01pn ;
run ;
proc means data=have;
class avisit trt01pn;
var aval;
output out=mean n=n nmiss=nmiss mean=mean lclm=lclm uclm=uclm;
run;
data gma;
set mean;
keep avisit n1 gmc1 lcl1 ucl1;
where _type_=7 and &tgroup.=1.;
n1=n;
gmc1=10**mean;
lcl1=10**lclm;
ucl1=10**uclm;
run;
data gmb;
set mean;
keep avisit n2 gmc2 lcl2 ucl2;
where _type_=7 and &tgroup.=2.;
n2=n;
gmc2 =10**mean;
lcl2=10**lclm;
ucl2=10**uclm;
run;
proc glm data=have PLOTS(MAXPOINTS= 10000);
by avisit ;
class trt01pn;
model aval = trt01pn ;
means trt01pn / t cldiff clm;
ods output cldiffs=dmean ModelAnova=anova;
run;
data rgm ;
set dmean;
where comparison="1 - 2";
keep avisit rgmc rlcl rucl;
rgmc=10**difference;
rlcl=10**lowercl;
rucl=10**uppercl;
run;
proc sort data=gma;
by avisit ;
proc sort data=gmb;
by avisit ;
proc sort data=rgm;
by avisit ;
run;
data final;
merge gma gmb rgm ;
by avisit ;
run;
Thanks for providing code and a sample output. I'm not sure I understand what you're trying to do, partly because of inconsistencies in your code:
Thanks for the improved code and the explanations.
@mounikag wrote:
5. We need to calculate 95% CI using clopper pearson method for particular geometric ratio
The geometric means are calculated from antibody levels (measured on a continuous scale). As I said, the "Clopper-Pearson method" I know is applicable to binomial proportions (see PROC FREQ documentation), which I don't see in your data or code.
6. what i meant is i need to keep the value of geometric mean ratio between day1 / week 4. so i need to calculate GMR across two visists for each parameter. so how i have to calculate to get the value of GMR? Please take the example of 101 subject at day1 the avla value is 1.3 and week 4 value is 2.2 so what will be the GMR value between these two aval values? could you please let me know your inputs with a code
Geometric means (and means in general) are calculated as a summary of two or more values, not for a single value of one subject. So I would expect these to be calculated from the AVAL values of several subjects (as shown in my first reply). The GMR would serve as a summary measure of all the individual ratios (like 2.2/1.3 for subject 101), e.g., within a treatment group.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.