STANDARD MARITIME COMMUNICATION PHRASES - YouTube
Common wealth
https://www.globalatlantic.com/commonwealth/policyholders
#What works clearinghouse version of standardized program difference
#Hedges's g and Cox Index
#See page 15 and 16
#https://ies.ed.gov/ncee/wwc/Docs/referenceresources/WWC_Procedures_Handbook_V4_1_Draft.pdf
#Kaz has the web-based calculator -- to use for QC'ing my results here
#https://www.estat.us/file/calc_t_test1.php
CCC<-filter(match.data1,treat==0)
TTT<-filter(match.data1,treat==1)
#These are for raw database
#raw data
#CCC<-filter(studydata3,treatment==0)
#TTT<-filter(studydata3,treatment==1)
#CCC<-filter(psmdata,treat==0)
#TTT<-filter(psmdata,treat==1)
###############################################################################
#What works clearinghouse version of standardized program difference
#Hedges's g and Cox Index
#See page 15 and 16
#https://ies.ed.gov/ncee/wwc/Docs/referenceresources/WWC_Procedures_Handbook_V4_1_Draft.pdf
#Kaz has the web-based calculator -- to use for QC'ing my results here
#https://www.estat.us/file/calc_t_test1.php
#Hedges' g for continuous variables
#Kaz added the correct, sample size adjusted version of this while meeting with Samara for transition
kaz_macro_lin<-function(kaz1){
col_name <- deparse(substitute(kaz1))
C_mean<-mean(CCC[[col_name]])
T_mean<-mean(TTT[[col_name]])
C_sd<-sd(CCC[[col_name]])
T_sd<-sd(TTT[[col_name]])
C_n<-length(CCC[[col_name]])
T_n<-length(TTT[[col_name]])
total_n<-C_n+T_n
#linear
simple_gap=T_mean-C_mean
g1<- ((T_n-1)*(T_sd*T_sd))+((C_n-1)*(C_sd*C_sd))
g2= T_n + C_n -2
g3= sqrt(g1/g2)
wwc_effect= simple_gap/g3
#I didn't adjust for sample size
omega<-(1-3/( 4*total_n -9))
wwc_effect_n_adjusted= (omega*simple_gap)/g3
print(T_n)
print(C_n)
print(total_n)
print(T_mean)
print(C_mean)
print(T_sd)
print(C_sd)
print ("Hedges'g without sample size adjustment")
print(wwc_effect)
print ("Hedges'g with sample size adjustment (Use this)")
print(wwc_effect_n_adjusted)
print ("FYI: Adjustment factor")
print(omega)
}
#Cox Index
#Kaz added the correct, sample size adjusted version of this while meeting with Samara for transition
kaz_macro_bin<-function(kaz1){
col_name <- deparse(substitute(kaz1))
C_mean<-mean(CCC[[col_name]])
T_mean<-mean(TTT[[col_name]])
C_sd<-sd(CCC[[col_name]])
T_sd<-sd(TTT[[col_name]])
C_n<-length(CCC[[col_name]])
T_n<-length(TTT[[col_name]])
#binary
Odds_C<-(C_mean/(1-C_mean))
Odds_T<-(T_mean/(1-T_mean))
Odds_ratio<-Odds_T/Odds_C
LN_C<-log(Odds_C)
LN_T<-log(Odds_T)
LN_DIF<-LN_T-LN_C
# WWC_effect=(round(LN_DIF/1.65,0.001))
WWC_effect_binary<-(LN_DIF/1.65)
#sample size adjustment (Kaz is adding this on December 30 2022)
#I didn't use this for writing the report draft
total_n<-C_n+T_n
omega<-(1-3/( 4*total_n -9))
WWC_binary_effect_n_adjusted=(omega*LN_DIF)/1.65;
print(T_n)
print(C_n)
print(total_n)
print(T_mean)
print(C_mean)
print("Cox Index without sample size adjustment")
print(WWC_effect_binary)
print("Cox Index with sample size adjustment -- Use this")
print(WWC_binary_effect_n_adjusted)
print ("FYI: Adjustment factor")
print(omega)
}
###############################################################################
table(psmdata$treat)
kaz_macro_bin(male)
kaz_macro_bin(minority)
kaz_macro_bin(disadv)
kaz_macro_bin(binary_dualcredit)
kaz_macro_lin(GPA_12_GRADE)
kaz_macro_lin(SAT_TOTAL)
#Sam asked me to check this
kaz_macro_lin(TOTAL_DUALCREDIT)
kaz_macro_bin(enroll_FR_spring)
kaz_macro_bin(enroll_SP_fall)
kaz_macro_bin(enroll_SP_spring)
Odds ratio in SAS PROC LOGISTICS are just
exp(coefficient)
This is obvious for binary variables.
Even for continuous variables, it's just
exp(coefficient)
..which means that I think it is mot counterintuitive to standardize continuous variables.
So one easy way to get odds ratios is to run PROC LOGISTICS with continuous variables standardized and use exp(X) in Excel.
ods trace on;
proc logistic data=final DESCENDING;
model YA01_3_bin =
treat
male
age_log
CH_compass
/*R_compass*/
white
black
/*other_race*/;
ods output ParameterEstimates=kaz1;
run;
data kaz1b;
set kaz1;
if Variable="Intercept" or Variable="treat";
keep Variable Estimate;
run;
proc transpose data=kaz1b out=kaz1bt;
id Variable;
run;
data kaz1bt2;
set kaz1bt;
C_LOGIT=intercept;
T_LOGIT=intercept+treat;
C_EXP=exp(C_LOGIT)/(1+exp(C_LOGIT));
C_ODDS=C_EXP/(1-C_EXP);
C_STEP1=log(C_ODDS);
T_EXP=exp(T_LOGIT)/(1+exp(T_LOGIT));
T_ODDS=T_EXP/(1-T_EXP);
T_STEP1=log(T_ODDS);
STEP2=T_STEP1-C_STEP1;
wwc_effect_size=STEP2/1.65;
odds_ratio=T_ODDS/C_ODDS;
run;
https://ies.ed.gov/ncee/wwc/Docs/referenceresources/WWC_Procedures_Handbook_V4_1_Draft.pdf
See Page 16.
two_values<-view1b[3:4]
num<-view1b[2]
omega<-(1-3/(4*num-9))
C_LOGIT<-two_values[1]
C_EXP<-exp(C_LOGIT)/(1+exp(C_LOGIT))
C_ODDS<-C_EXP/(1-C_EXP)
C_STEP1<-log(C_ODDS)
T_LOGIT<-two_values[1]+two_values[2]
T_EXP<-exp(T_LOGIT)/(1+exp(T_LOGIT))
T_ODDS<-T_EXP/(1-T_EXP)
T_STEP1<-log(T_ODDS)
STEP2<-T_STEP1-C_STEP1
wwc_effect_size<-STEP2/1.65
wwc_effect_size_omega<-(omega*STEP2)/1.65
odds_ratio<-T_ODDS/C_ODDS
This is how you can create a graph comparing the treatment group and the comparison group's %s -- based on findings from the logistic regression model.
Based on the final multivariate model, you get the program effect in logit. For example:
-0.223
You also run the simpler model with the treatment program indicator only. Get the intercept value. For example:
1.7081
When this logic is converted into a %, it will be the unadjusted % of the comparison group.
Use these two numbers to derive %s for the treatment group and comparison group.
The resulting graph fixes the % of the comparison group to the simple % of the comparison group and shows the % of the treatment group based on the program effect adjusted for covariates.
If you use the intercept value and the program effect value from the final multivariate model, the meaning of percentages become non-intuitive. If you center predictors (except for the treatment indicator), the intercept will represent a typical person in the dataset. But this is a bit difficult to undestand.
Without centering, the intercept value will represent someone who is, for example, female, white, etc., depending on omitted categories of the variables. If continuous variables are included and if the value of 0 in that variable is not intuitive, the meaning of the intercept is a difficult to interpret.
I recommend using the intercept from the simple model (only the treatment group is the predictor), so the comparison group % will be fixed at a simple descriptive % of the comparison group.