Sei sulla pagina 1di 5

**Generando nuevas variables**

******************************
generate outcome = 0 if cond_final==1
replace outcome = 1 if cond_final==0
la var outcome "Final outcome"
la define outcome 0 "Alive (cured)" 1 "Dead"
la values outcome outcome
***
generate haart = 0 if inicio_tto_targa>=1 & inicio_tto_targa<4
replace haart = 1 if inicio_tto_targa==4
la var haart "Receiving HAART at baseline"
la values haart noyes
***
generate codisease = 0 if comorbilidad==0
replace codisease = 1 if comorbilidad>0 & comorbilidad!=.
la var codisease "Co-morbidity (categorized)"
la values codisease noyes
***
generate cd4cat = 0 if cd4<200
replace cd4cat = 1 if cd4>=200 & cd4!=.
la var cd4cat "CD4 categorized"
la define cd4cat 0 "<200" 1 "200+"
la values cd4cat cd4cat
***
generate mdr = 0 if resistencia==0 | resistencia==2
replace mdr = 1 if resistencia==1
la var mdr "MDR-TB"
la define mdr 0 "No MDR" 1 "MDR"
la values mdr mdr
***
generate lcv = ln(cv)
la var lcv "Viral load (ln)"

****************************

**Resultados para el texto**


tab sexo
summ edad
tab outcome
ci outcome

**Tabla 1**
***********
tab sexo outcome, row e
ttest edad, by(outcome)
tab cd4cat outcome, row e
ttest cd4, by(outcome)
ttest cv, by(outcome)
ttest lcv, by(outcome)
tab mdr outcome, row e
tab haart outcome, row e
tab profilaxis_h outcome, row e
tab codisease outcome, row e

**Tabla 2**
***********
tabstat peso0 peso1 peso2, stat(n mean sd) col(stat) by(outcome)
tabstat act0 act1 act2, stat(n mean sd) col(stat) by(outcome)
tabstat masagrasa0 masagrasa1 masagrasa2, stat(n mean sd) col(stat)
by(outcome)
tabstat ff0 ff1 ff2, stat(n mean sd) col(stat) by(outcome)
tabstat imc0 imc1 imc2, stat(n mean sd) col(stat) by(outcome)

**Tabla 3**
***********
reshape long peso act masagrasa ff imc, i(codigo) j(time)
***
xtset codigo time
***
xi: xtreg peso i.outcome*i.time, robust
xi: xtreg peso i.outcome*i.time edad i.sexo i.mdr cd4cat, robust
***
xi: xtreg masagrasa i.outcome*i.time, robust
xi: xtreg masagrasa i.outcome*i.time edad i.sexo i.mdr cd4cat, robust
***
xi: xtreg ff i.outcome*i.time, robust
xi: xtreg ff i.outcome*i.time edad i.sexo i.mdr cd4cat, robust

**E-Tabla 1**
*************
xi: xtreg act i.outcome*i.time, robust
xi: xtreg act i.outcome*i.time edad i.sexo i.mdr cd4cat, robust
***
xi: xtreg imc i.outcome*i.time, robust
xi: xtreg imc i.outcome*i.time edad i.sexo i.mdr cd4cat, robust
**Figures**
***********
**Grfico: Peso**
xi: xtreg peso i.outcome*i.time edad i.sexo i.mdr cd4cat, robust
predict yhat
bysort outcome time: egen mean = mean(yhat)
la var mean "Predicted weight by month and outcome"
twoway (scatter mean time if outcome==0, c(L) lcolor(green) mcolor(green)
msize(small) ///
xlabel(0 "0" 1 "1" 2 "2") xtitle(Time in months) ytitle(Average weight
during follow-up (kg)) ///
legend(order(1 "Cured patients" 2 "Dead patients"))) (scatter mean time
if outcome==1, c(L) lcolor(red) mcolor(red) msize(vsmall))
drop yhat-mean

**Grfico: Masa grasa**


xi: xtreg masagrasa i.outcome*i.time edad i.sexo i.mdr cd4cat, robust
predict yhat
bysort outcome time: egen mean = mean(yhat)
la var mean "Predicted fat mass by month and outcome"
twoway (scatter mean time if outcome==0, c(L) lcolor(green) mcolor(green)
msize(small) ///
xlabel(0 "0" 1 "1" 2 "2") xtitle(Time in months) ytitle(Average fat mass
during follow-up (kg)) ///
legend(order(1 "Cured patients" 2 "Dead patients"))) (scatter mean time
if outcome==1, c(L) lcolor(red) mcolor(red) msize(vsmall))
drop yhat-mean

**Grfico: Masa magra**


xi: xtreg ff i.outcome*i.time edad i.sexo i.mdr cd4cat, robust
predict yhat
bysort outcome time: egen mean = mean(yhat)
la var mean "Predicted lean mass by month and outcome"
twoway (scatter mean time if outcome==0, c(L) lcolor(green) mcolor(green)
msize(small) ///
xlabel(0 "0" 1 "1" 2 "2") xtitle(Time in months) ytitle(Average lean mass
during follow-up (kg)) ///
legend(order(1 "Cured patients" 2 "Dead patients"))) (scatter mean time
if outcome==1, c(L) lcolor(red) mcolor(red) msize(vsmall))
drop yhat-mean

Potrebbero piacerti anche