*! (SJ3-1: st0032) capture program drop geipower program define geipower quietly { clear syntax using/ global using=`"`using'"' version 7 set more off use `using' count local scenar=r(N) cap which vars1 if _rc~=0 { di in red "YOU MUST INSTALL vars1.ado to run this" di "This function calulates the risk factor frequencies" exit } count if pg<=0 | pg>=1 | pe<=0 | pe>=1 | pd<=0 | pd>1 | rrg1e0<=0 | rrg0e1<=0| rrint<=0 |rrsibm<=0 | sibore<=0 | alpha_1 <=0 |alpha_1 >=1 |power<5 |power>99 if r(N)~=0 { noisily { display "one or more of the parameter values entered is outside permitted ranges" display "please check and change your initial dataset, and re-save it." display "type h geipower for a description of the input variables needed" } exit } count if ssize<30 if r(N)~=0 { noisily { display "you have entered one or more values for sample size that are less than 30" display "this program is based on a large sample approximation and so results may not be accurate" display } } drop _all vars1 local loop3=0 while `loop3'~=`scenar' { local loop3=`loop3'+1 if mod(`loop3', 10)==0 { noisily { display "calculating observation `loop3' out of `scenar'" } } local error1=pop_error in `loop3' local error2=sib_error in `loop3' use `using' local ssize=ssize in `loop3' local power=power in `loop3' local power=`power'/100 local alpha_1=alpha_1 in `loop3' local alpha_1=invchi2(1, (1-`alpha_1')) if `error1'==0 & `error2'==0 { local a1=dom_a in `loop3' local b1=dom_b in `loop3' local c1=dom_c in `loop3' local d1=dom_d in `loop3' local e1=dom_e in `loop3' local f1=dom_f in `loop3' local g1=dom_g in `loop3' local h1=dom_h in `loop3' local i1=dom_i in `loop3' local j1=dom_j in `loop3' local k1=dom_k in `loop3' local l1=dom_l in `loop3' local m1=dom_m in `loop3' local n1=dom_n in `loop3' local o1=dom_o in `loop3' local p1=dom_p in `loop3' drop _all set obs 16 gen id=_n gen g0=0 replace g0=1 in 3/4 replace g0=1 in 7/8 replace g0=1 in 11/12 replace g0=1 in 15/16 gen e0=0 replace e0=1 in 2 replace e0=1 in 4 replace e0=1 in 6 replace e0=1 in 8 replace e0=1 in 10 replace e0=1 in 12 replace e0=1 in 14 replace e0=1 in 16 gen gei0=g0*e0 gen g1=0 replace g1=1 in 9/16 gen e1=0 replace e1=1 in 5/8 replace e1=1 in 13/16 gen gei1=g1*e1 gen weight=. replace weight=`a1' in 1 replace weight=`b1' in 2 replace weight=`c1' in 3 replace weight=`d1' in 4 replace weight=`e1' in 5 replace weight=`f1' in 6 replace weight=`g1' in 7 replace weight=`h1' in 8 replace weight=`i1' in 9 replace weight=`j1' in 10 replace weight=`k1' in 11 replace weight=`l1' in 12 replace weight=`m1' in 13 replace weight=`n1' in 14 replace weight=`o1' in 15 replace weight=`p1' in 16 replace weight=round(weight*`ssize'*10000,1) reshape long g e gei, i(id) j(case) clogit case g e [w=weight], group(id) or local temp1=e(ll) clogit case g e gei [w=weight], group(id) or matrix A=e(b) local temp2=e(ll) local temp3=2*(`temp2'-`temp1')/10000 local dom_m_sib= 1-nchi(1, `temp3', `alpha_1') local or_dom_m_sib=exp(el(A, 1, 3)) local ss_dom_m_sib=npnchi2(1, `alpha_1', (1-`power')) local ss_dom_m_sib=`ss_dom_m_sib'*(`ssize')/`temp3' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. local aff1=(`a1'+`b1'+`c1'+`d1') local tot1=(`a1'+`b1'+`c1'+`d1')+(`a1'+`e1'+`i1'+`m1') local aff2=(`e1'+`f1'+`g1'+`h1') local tot2=(`e1'+`f1'+`g1'+`h1')+(`b1'+`f1'+`j1'+`n1') local aff3=(`i1'+`j1'+`k1'+`l1') local tot3=(`i1'+`j1'+`k1'+`l1')+(`c1'+`g1'+`k1'+`o1') local aff4=(`m1'+`n1'+`o1'+`p1') local tot4=(`m1'+`n1'+`o1'+`p1'+`d1'+`h1'+`l1'+`p1') replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*10000, 1) replace tot=round(tot*`ssize'*10000, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/10000 local dom_u_sib= 1-nchi(1, `temp7', `alpha_1') local ss_dom_u_sib=npnchi2(1, `alpha_1', (1-`power')) local ss_dom_u_sib=`ss_dom_u_sib'*(`ssize')/`temp7' matrix A=e(b) local or_dom_u_sib=exp(el(A, 1, 3)) drop _all use `using' local a1=rec_a in `loop3' local b1=rec_b in `loop3' local c1=rec_c in `loop3' local d1=rec_d in `loop3' local e1=rec_e in `loop3' local f1=rec_f in `loop3' local g1=rec_g in `loop3' local h1=rec_h in `loop3' local i1=rec_i in `loop3' local j1=rec_j in `loop3' local k1=rec_k in `loop3' local l1=rec_l in `loop3' local m1=rec_m in `loop3' local n1=rec_n in `loop3' local o1=rec_o in `loop3' local p1=rec_p in `loop3' drop _all set obs 16 gen id=_n gen g0=0 replace g0=1 in 3/4 replace g0=1 in 7/8 replace g0=1 in 11/12 replace g0=1 in 15/16 gen e0=0 replace e0=1 in 2 replace e0=1 in 4 replace e0=1 in 6 replace e0=1 in 8 replace e0=1 in 10 replace e0=1 in 12 replace e0=1 in 14 replace e0=1 in 16 gen gei0=g0*e0 gen g1=0 replace g1=1 in 9/16 gen e1=0 replace e1=1 in 5/8 replace e1=1 in 13/16 gen gei1=g1*e1 gen weight=. replace weight=`a1' in 1 replace weight=`b1' in 2 replace weight=`c1' in 3 replace weight=`d1' in 4 replace weight=`e1' in 5 replace weight=`f1' in 6 replace weight=`g1' in 7 replace weight=`h1' in 8 replace weight=`i1' in 9 replace weight=`j1' in 10 replace weight=`k1' in 11 replace weight=`l1' in 12 replace weight=`m1' in 13 replace weight=`n1' in 14 replace weight=`o1' in 15 replace weight=`p1' in 16 replace weight=round(weight*`ssize'*10000,1) reshape long g e gei, i(id) j(case) clogit case g e [w=weight], group(id) or local temp1=e(ll) clogit case g e gei [w=weight], group(id) or matrix A=e(b) local temp2=e(ll) local temp3=2*(`temp2'-`temp1')/10000 local rec_m_sib= 1-nchi(1, `temp3', `alpha_1') local or_rec_m_sib=exp(el(A, 1, 3)) local ss_rec_m_sib=npnchi2(1, `alpha_1', (1-`power')) local ss_rec_m_sib=`ss_rec_m_sib'*(`ssize')/`temp3' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. local aff1=(`a1'+`b1'+`c1'+`d1') local tot1=(`a1'+`b1'+`c1'+`d1')+(`a1'+`e1'+`i1'+`m1') local aff2=(`e1'+`f1'+`g1'+`h1') local tot2=(`e1'+`f1'+`g1'+`h1')+(`b1'+`f1'+`j1'+`n1') local aff3=(`i1'+`j1'+`k1'+`l1') local tot3=(`i1'+`j1'+`k1'+`l1')+(`c1'+`g1'+`k1'+`o1') local aff4=(`m1'+`n1'+`o1'+`p1') local tot4=(`m1'+`n1'+`o1'+`p1'+`d1'+`h1'+`l1'+`p1') replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*10000, 1) replace tot=round(tot*`ssize'*10000, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/10000 display `temp7' local rec_u_sib= 1-nchi(1, `temp7', `alpha_1') local ss_rec_u_sib=npnchi2(1, `alpha_1', (1-`power')) local ss_rec_u_sib=`ss_rec_u_sib'*(`ssize')/`temp7' matrix A=e(b) local or_rec_u_sib=exp(el(A, 1, 3)) drop _all use `using' local aff1=p_g0e0_d in `loop3' local tot1=p_g0e0_not_d in `loop3' local tot1=`tot1'+`aff1' local aff2=p_g0e1_d in `loop3' local tot2=p_g0e1_not_d in `loop3' local tot2=`tot2'+`aff2' local aff3=p_g1e0_d in `loop3' local tot3=p_g1e0_not_d in `loop3' local tot3=`tot3'+`aff3' local aff4=p_g1e1_d in `loop3' local tot4=p_g1e1_not_d in `loop3' local tot4=`tot4'+`aff4' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*10000, 1) replace tot=round(tot*`ssize'*10000, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/10000 local cc_u= 1-nchi(1, `temp7', `alpha_1') local ss_cc_u=npnchi2(1, `alpha_1', (1-`power')) local ss_cc_u=`ss_cc_u'*(`ssize')/`temp7' matrix A=e(b) local or_cc_u=exp(el(A, 1, 3)) drop _all use `using' local aff1=dom_p_g0e0_soc_d in `loop3' local tot1=p_g0e0_not_d in `loop3' local tot1=`tot1'+`aff1' local aff2=dom_p_g0e1_soc_d in `loop3' local tot2=p_g0e1_not_d in `loop3' local tot2=`tot2'+`aff2' local aff3=dom_p_g1e0_soc_d in `loop3' local tot3=p_g1e0_not_d in `loop3' local tot3=`tot3'+`aff3' local aff4=dom_p_g1e1_soc_d in `loop3' local tot4=p_g1e1_not_d in `loop3' local tot4=`tot4'+`aff4' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*10000, 1) replace tot=round(tot*`ssize'*10000, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/10000 local dom_asp= 1-nchi(1, `temp7', `alpha_1') local ss_dom_asp=npnchi2(1, `alpha_1', (1-`power')) local ss_dom_asp=`ss_dom_asp'*(`ssize')/`temp7' matrix A=e(b) local or_dom_asp=exp(el(A, 1, 3)) drop _all use `using' local aff1=dom_p_g0e0_soc_d in `loop3' local tot1=dom_p_g0e0_soc_nd in `loop3' local tot1=`tot1'+`aff1' local aff2=dom_p_g0e1_soc_d in `loop3' local tot2=dom_p_g0e1_soc_nd in `loop3' local tot2=`tot2'+`aff2' local aff3=dom_p_g1e0_soc_d in `loop3' local tot3=dom_p_g1e0_soc_nd in `loop3' local tot3=`tot3'+`aff3' local aff4=dom_p_g1e1_soc_d in `loop3' local tot4=dom_p_g1e1_soc_nd in `loop3' local tot4=`tot4'+`aff4' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*10000, 1) replace tot=round(tot*`ssize'*10000, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/10000 local dom_coh= 1-nchi(1, `temp7', `alpha_1') local ss_dom_coh=npnchi2(1, `alpha_1', (1-`power')) local ss_dom_coh=`ss_dom_coh'*(`ssize')/`temp7' matrix A=e(b) local or_dom_coh=exp(el(A, 1, 3)) drop _all use `using' local aff1=rec_p_g0e0_soc_d in `loop3' local tot1=p_g0e0_not_d in `loop3' local tot1=`tot1'+`aff1' local aff2=rec_p_g0e1_soc_d in `loop3' local tot2=p_g0e1_not_d in `loop3' local tot2=`tot2'+`aff2' local aff3=rec_p_g1e0_soc_d in `loop3' local tot3=p_g1e0_not_d in `loop3' local tot3=`tot3'+`aff3' local aff4=rec_p_g1e1_soc_d in `loop3' local tot4=p_g1e1_not_d in `loop3' local tot4=`tot4'+`aff4' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*10000, 1) replace tot=round(tot*`ssize'*10000, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/10000 local rec_asp= 1-nchi(1, `temp7', `alpha_1') local ss_rec_asp=npnchi2(1, `alpha_1', (1-`power')) local ss_rec_asp=`ss_rec_asp'*(`ssize')/`temp7' matrix A=e(b) local or_rec_asp=exp(el(A, 1, 3)) drop _all use `using' local aff1=rec_p_g0e0_soc_d in `loop3' local tot1=rec_p_g0e0_soc_nd in `loop3' local tot1=`tot1'+`aff1' local aff2=rec_p_g0e1_soc_d in `loop3' local tot2=rec_p_g0e1_soc_nd in `loop3' local tot2=`tot2'+`aff2' local aff3=rec_p_g1e0_soc_d in `loop3' local tot3=rec_p_g1e0_soc_nd in `loop3' local tot3=`tot3'+`aff3' local aff4=rec_p_g1e1_soc_d in `loop3' local tot4=rec_p_g1e1_soc_nd in `loop3' local tot4=`tot4'+`aff4' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*10000, 1) replace tot=round(tot*`ssize'*10000, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/10000 local rec_coh= 1-nchi(1, `temp7', `alpha_1') local ss_rec_coh=npnchi2(1, `alpha_1', (1-`power')) local ss_rec_coh=`ss_rec_coh'*(`ssize')/`temp7' matrix A=e(b) local or_rec_coh=exp(el(A, 1, 3)) drop _all use `using' display `loop3' replace dom_m_sib=`dom_m_sib' in `loop3' replace dom_u_sib=`dom_u_sib' in `loop3' replace rec_m_sib=`rec_m_sib' in `loop3' replace rec_u_sib=`rec_u_sib' in `loop3' replace cc_u=`cc_u' in `loop3' replace dom_asp=`dom_asp' in `loop3' replace dom_coh=`dom_coh' in `loop3' replace rec_asp=`rec_asp' in `loop3' replace rec_coh=`rec_coh' in `loop3' replace or_dom_m_sib=`or_dom_m_sib' in `loop3' replace or_dom_u_sib=`or_dom_u_sib' in `loop3' replace or_rec_m_sib=`or_rec_m_sib' in `loop3' replace or_rec_u_sib=`or_rec_u_sib' in `loop3' replace or_cc_u=`or_cc_u' in `loop3' replace or_dom_asp=`or_dom_asp' in `loop3' replace or_dom_coh=`or_dom_coh' in `loop3' replace or_rec_asp=`or_rec_asp' in `loop3' replace or_rec_coh=`or_rec_coh' in `loop3' replace ss_dom_m_sib=`ss_dom_m_sib' in `loop3' replace ss_dom_u_sib=`ss_dom_u_sib' in `loop3' replace ss_rec_m_sib=`ss_rec_m_sib' in `loop3' replace ss_rec_u_sib=`ss_rec_u_sib' in `loop3' replace ss_cc_u=`ss_cc_u' in `loop3' replace ss_dom_asp=`ss_dom_asp' in `loop3' replace ss_dom_coh=`ss_dom_coh' in `loop3' replace ss_rec_asp=`ss_rec_asp' in `loop3' replace ss_rec_coh=`ss_rec_coh' in `loop3' save `using', replace } else if `error2'==float(1) & `error1'==float(0) { drop _all use `using' local aff1=p_g0e0_d in `loop3' local tot1=p_g0e0_not_d in `loop3' local tot1=`tot1'+`aff1' local aff2=p_g0e1_d in `loop3' local tot2=p_g0e1_not_d in `loop3' local tot2=`tot2'+`aff2' local aff3=p_g1e0_d in `loop3' local tot3=p_g1e0_not_d in `loop3' local tot3=`tot3'+`aff3' local aff4=p_g1e1_d in `loop3' local tot4=p_g1e1_not_d in `loop3' local tot4=`tot4'+`aff4' drop _all set obs 4 gen g=0 gen e=0 replace g=1 in 3/4 replace e=1 in 2 replace e=1 in 4 gen gei=g*e gen aff=. gen tot=. replace aff=`aff1' in 1 replace tot=`tot1' in 1 replace aff=`aff2' in 2 replace tot=`tot2' in 2 replace aff=`aff3' in 3 replace tot=`tot3' in 3 replace aff=`aff4' in 4 replace tot=`tot4' in 4 replace aff=round(aff*`ssize'*100, 1) replace tot=round(tot*`ssize'*100, 1) blogit aff tot g e, or local temp5=e(ll) blogit aff tot g e gei, or local temp6=e(ll) local temp7=2*(`temp6'-`temp5')/100 local cc_u= 1-nchi(1, `temp7', `alpha_1') local ss_cc_u=npnchi2(1, `alpha_1', (1-`power')) local ss_cc_u=`ss_cc_u'*(`ssize')/`temp7' matrix A=e(b) local or_cc_u=exp(el(A, 1, 3)) drop _all use `using' replace cc_u=`cc_u' in `loop3' replace or_cc_u=`or_cc_u' in `loop3' replace ss_cc_u=`ss_cc_u' in `loop3' save `using', replace } else { } } drop _all use `using' replace dom_m_sib=round(dom_m_sib*100, 0.01) replace dom_u_sib=round(dom_u_sib*100, 0.01) replace rec_m_sib=round(rec_m_sib*100, 0.01) replace rec_u_sib=round(rec_u_sib*100, 0.01) replace cc_u=round(cc_u*100, 0.01) replace dom_asp=round(dom_asp*100, 0.01) replace dom_coh=round(dom_coh*100, 0.01) replace rec_asp=round(rec_asp*100, 0.01) replace rec_coh=round(rec_coh*100, 0.01) replace or_dom_m_sib=round(or_dom_m_sib, 0.01) replace or_dom_u_sib=round(or_dom_u_sib, 0.01) replace or_rec_m_sib=round(or_rec_m_sib, 0.01) replace or_rec_u_sib=round(or_rec_u_sib, 0.01) replace or_cc_u=round(or_cc_u, 0.01) replace or_dom_asp=round(or_dom_asp, 0.01) replace or_dom_coh=round(or_dom_coh, 0.01) replace or_rec_asp=round(or_rec_asp, 0.01) replace or_rec_coh=round(or_rec_coh, 0.01) replace ss_dom_m_sib=round(ss_dom_m_sib, 1) replace ss_dom_u_sib=round(ss_dom_u_sib, 1) replace ss_rec_m_sib=round(ss_rec_m_sib, 1) replace ss_rec_u_sib=round(ss_rec_u_sib, 1) replace ss_cc_u=round(ss_cc_u, 1) replace ss_dom_asp=round(ss_dom_asp, 1) replace ss_dom_coh=round(ss_dom_coh, 1) replace ss_rec_asp=round(ss_rec_asp, 1) replace ss_rec_coh=round(ss_rec_coh, 1) save `using', replace keep pg pe rrg0e0 rrg0e1 rrg1e0 rrint orge pd sibore rrsibm dom_m_sib dom_u_sib rec_m_sib rec_u_sib cc_u dom_asp dom_coh rec_asp rec_coh or_dom_m_sib or_rec_m_sib or_dom_u_sib or_rec_u_sib or_cc_u or_dom_asp or_rec_asp or_dom_coh or_rec_coh ssize power ss_dom_m_sib ss_rec_m_sib ss_dom_u_sib ss_rec_u_sib ss_cc_u ss_dom_asp ss_rec_asp ss_dom_coh ss_rec_coh alpha_1 pop_error sib_error label var pg "P(G)" label var pe "P(E)" label var rrg0e0 "RR(G0E0)" label var rrg0e1 "RR(G0E1)" label var rrg1e0 "RR(G1E0)" label var rrint "RR(INT)" label var orge "OR(GE)" label var sibore "Sib OR(E)" label var rrsibm "RR Sib(M)" label var alpha_1 "significance level" label var pd "disease frequency" label var dom_m_sib "Power (%) sib control, matched analysis" label var dom_u_sib "Power (%) sib control, unmatched analysis" label var rec_m_sib "Power (%) sib control, matched analysis" label var rec_u_sib "Power (%) sib control, unmatched analysis" label var cc_u "Power (%) unmatched case-control study" label var dom_asp "Power (%) case from ASP" label var rec_asp "Power (%) case from ASP" label var dom_coh "Power (%) 'cohort of sibs of cases'" label var rec_coh "Power (%) 'cohort of sibs of cases'" label var or_dom_m_sib "Interaction odds ratio, sibling control (matched)" label var or_dom_u_sib "Interaction odds ratio, sibling control (unmatched)" label var or_rec_m_sib "Interaction odds ratio, sibling control (matched)" label var or_rec_u_sib "Interaction odds ratio, sibling control (unmatched)" label var or_cc_u "Interaction odds ratio, population based" label var or_dom_asp "Interaction odds ratio, case from ASP" label var or_rec_asp "Interaction odds ratio, case from ASP" label var or_dom_coh "Interaction odds ratio, 'cohort of sibs of cases'" label var or_rec_coh "Interaction odds ratio, 'cohort of sibs of cases'" label var ss_dom_m_sib "sample size, matched sib design" label var ss_dom_u_sib "sample size, unmatched sib design" label var ss_rec_m_sib "sample size, matched sib design" label var ss_rec_u_sib "sample size, unmatched sib design" label var ss_cc_u "sample size, population based case control study" label var ss_dom_asp "sample size, case from ASP" label var ss_rec_asp "sample size, case from ASP" label var ss_rec_coh "sample size, cohort of sibs of cases" label var ss_dom_coh "sample size, case and control from cohort of sibs of cases" save `using', replace } if `scenar'==1 { foreach temp of varlist _all { local `temp'=`temp' } local alpha_1=round(`alpha_1', 0.01) di di as txt "parameter file:" _col(30) as res "`using'" di in gr "observations:" in ye _col(30) 1 di di in gr "------------------------------------------------------------------------------- di in gr "PARAMETERS di in gr "------------------------------------------------------------------------------- di di in gr "Power to detect interaction (%), interaction odds ratios and required sample di in gr "sizes have been calculated from an exemplary dataset for the following di in gr "population risk factor frequencies and effects: di di in gr "suscpetibility genotype frequency (pg):" in ye _col(70) pg di in gr "environmental risk factor frequency (pe):" in ye _col(70) pe di in gr "genetic risk factor main effect (rrg1e0):" in ye _col(70) rrg1e0 di in gr "environmental risk factor main effect (rrg0e1):" in ye _col(70) rrg0e1 di in gr "interaction relative risk (rrint):" in ye _col(70) rrint di in gr "disease prevalence (pd):" in ye _col(70) pd display in gr "odds ratio for the association of risk factors among siblings (sibore):" in ye _col(70) sibore display in gr "relative risk of disease to sibs of cases (rrsibm):" di in ye _col(70) rrsibm display di in gr "------------------------------------------------------------------------------- di in gr "POWER di in gr "------------------------------------------------------------------------------- di di in gr "Power to detect an interaction for a sample size of `ssize' cases and `ssize' di in gr "controls with a two-sided significance level (alpha=`alpha_1') di di in gr "for a case-control design with " in ye `ssize' in gr " cases and " in ye `ssize' in gr " controls" display in gr "1) matched sib design (dominant genetic inheritance), power (%):" in ye _col(70) dom_m_sib display in gr "2) matched sib design (recessive genetic inheritance), power (%):" in ye _col(70) rec_m_sib display in gr "3) unmatched sib design (dominant genetic inheritance), power (%):" in ye _col(70) dom_u_sib display in gr "4) unmatched sib design (recessive genetic inheritance), power (%):" in ye _col(70) rec_u_sib display in gr "5) case from ASP, population control (dom inheritance), power (%):" in ye _col(70) dom_asp display in gr "6) case from ASP, population control (rec inheritance), power (%):" in ye _col(70) rec_asp display in gr "7) unmatched design, case and control both have affected sibling" di in gr _col(5) "(dominant genetic inheritance), power (%):" in ye _col(70) dom_coh display in gr "8) unmatched design, case and control both have affected sibling" di in gr _col(5) "(recessive genetic inheritance), power (%):" in ye _col(70) rec_coh display in gr "9) population based case-control study, power (%):" in ye _col(70) cc_u display di in gr "------------------------------------------------------------------------------- di in gr "INTERACTION ODDS RATIOS di in gr "------------------------------------------------------------------------------- di di in gr "The interaction odds ratio calculated from the exemplary dataset: di display in gr "1) matched sib design, interaction odds ratio (dom):" in ye _col(70) or_dom_m_sib display in gr "2) matched sib design, interaction odds ratio (rec):" in ye _col(70) or_rec_m_sib display in gr "3) unmatched sib design, interaction odds ratio (dom):" in ye _col(70) or_dom_u_sib display in gr "4) unmatched sib design, interaction odds ratio (rec):" in ye _col(70) or_rec_u_sib display in gr "5) case from ASP, population control," display in gr _col(5) "interaction odds ratio (dominant genetic inheritance):" in ye _col(70) or_dom_asp display in gr "6) case from ASP, population control," display in gr _col(5) "interaction odds ratio (recessive genetic inheritance):" in ye _col(70) or_rec_asp display in gr "7) unmatched design, case and control both have affected sibling," display in gr _col(5) "interaction odds ratio (dominant genetic inheritance):" in ye _col(70) or_dom_coh display in gr "8) unmatched design, case and control both have affected sibling," display in gr _col(5) "interaction odds ratio (recessive genetic inheritance):" in ye _col(70) or_rec_coh display in gr "9) population based case-control study:" in ye _col(70) or_cc_u di di in gr "------------------------------------------------------------------------------- di in gr "REQUIRED SAMPLE SIZE di in gr "------------------------------------------------------------------------------- di di in gr "for a power of `power'% and a two-sided significance level (alpha=`alpha_1') the di in gr "required number of cases (with equal numbers of controls) di display in gr "1) matched sib design (dom):" in ye _col(70) ss_dom_m_sib display in gr "2) matched sib design (rec):" in ye _col(70) ss_rec_m_sib display in gr "3) unmatched sib design (dom):" in ye _col(70) ss_dom_u_sib display in gr "4) unmatched sib design (rec):" in ye _col(70) ss_rec_u_sib display in gr "5) case from ASP, population control (dom):" in ye _col(70) ss_dom_asp display in gr "6) case from ASP, population control (rec):" in ye _col(70) ss_rec_asp display in gr "7) unmatched design, case and control both have affected sibling," display in gr _col(5) "(dominant genetic inheritance) " in ye _col(70) ss_dom_coh display in gr "8) unmatched design, case and control both have affected sibling," display in gr _col(5) "(recessive genetic inheritance) " in ye _col(70) ss_rec_coh display in gr "9) population based case-control study:" in ye _col(70) ss_cc_u display di in gr "------------------------------------------------------------------------------- di in gr "NOTES di in gr "------------------------------------------------------------------------------- di di in gr "The power, required sample sizes and calculated interaction odds ratio for the di in gr "these designs have been saved into file - " in ye "`using'" di in gr "Type d for details of the output variables if pop_error==1 { display display in gr "All results are missing because the parameters specified in " in ye "`using'" display in gr "lead to disease probabilities greater than one;" display in gr "try specifying a lower disease frequency, or smaller effects." } else if pop_error==0 & sib_error==1 { display display "No results are given for the sibling designs because the values in " display in ye "`using'" in gr " lead to the probability of disease in siblings of cases" di in gr "being greater than one." display "try using a lower disease frequency or a smaller value for rrsibm" } drop sib_error pop_error quietly { save `using', replace } } else { di di in gr "parameter file:" in ye _col(30) "`using'" di in gr "observations:" in ye _col(30) `scenar' display di in gr "------------------------------------------------------------------------------- di in gr "NOTES di in gr "------------------------------------------------------------------------------- di display "The power, required sample sizes and calculated interaction odds ratio di in gr "for these designs have been saved into file - " in ye "`using'" display in gr "Type d for details of the output variables" di di in gr "If you want output written to the results window please just use one di in gr "observation in the initial dataset quietly { sum sib_error } if r(mean)~=0 { display di in gr "One or more or the sets of parameters (observations) that you entered, resulted di in gr "in disease probabilities being greater than one in some or all situations. For di in gr "these observations the results are posted as missing and variables pop_error di in gr "(population error) or sib_error (error in the sibling parameters will equal 1" di in gr "rather than 0" } else { drop pop_error sib_error quietly { save `using', replace } } } end