Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • scatter plots from imputed data

    I have performed multiple imputation on some 70 continuous variables using mi imputed (regress) chained. it worked perfectly. what i want to do is to use a loop to create scatter plots of one independent variable against all the other variables (dependent). since mi estimate does not allow scatter plot i used mi xeq in a loop but i am not sure i do it the right way because when i run my code i got a message that says: graph graph1 already exists r(110).
    Code:
    local j = 1
    local names
    foreach var of varlist lnage lnbodyfatbmi lnwaisthipratio lnsalivaryamylaseuml lnsalivaryamylas_newuml lnplasmasalivaryamyalseul lntotalamyalseul lnpancreaticamylaseul lnalbumin lnalkalinephosphatasealp lnaltgpt lnastgot lncpeptideofinsulin lncalcium lnchloride lncholesterol lncorrectedcalcium lncreatinekinase lnestradiol lnferritin lnfolateserum lnfreethyroxine lnfreetriiodothyronine lnggt lnglucose lnhba1c lnhco3 lnhdl lnhomocysteine lninsulin lniron lnldl lnmagnesium lnphosphorus lnpotasium lnserumcreatinine lnSHBG lnsodium lntestosterone lnTSH lntotalbilirubin lnTIBC lntotalprotein lntriglycerides lnureanitrogen lnuricacid lnvitd lnvitaminb12 lnbodyfatbmr lnbodyfatfat lnbodyfatfatmass lnbodyfatffm lnbodyfatheight lnbodyfatleftarmfat lnbodyfatleftarmfatmass lnbodyfatleftarmffm lnbodyfatleftarm lnbodyfatleftlegfat lnbodyfatleftlegfatmass lnbodyfatleftlegffm lnbodyfatleftleg lnbodyfatrightarmfat lnbodyfatrightarmfatmass lnbodyfatrightarmffm lnbodyfatrightarm lnbodyfatrightlegfat lnbodyfatrightlegfatmass lnbodyfatrightlegffm lnbodyfatrightleg lnbodyfattbw lnbodyfattrunkfat lnbodyfattrunkfatmass lnbodyfattrunkffm lnbodyfatweight lnbodyfatwholebody lnwaist lnhip lnheight lndiastolicbp lnsystolicbp lnfastingdurationinminutes lnpulse  {
         mi xeq: scatter  lnsalivaryamylaseuml `var' || lfit lnsalivaryamylaseuml `var', name(graph`j')
         local names `names' graph`j'
         local ++j
    }
    
    graph combine `names'
    stata 15.1 on mac
    Last edited by abdelilah arredouani; 21 Jan 2019, 06:19.
Working...
X