Announcement

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

  • Obtaining Predictions from Models Fit to Multiply Imputed Data

    Hi there,
    I am trying to obtain predictions from generalise linear regression to multiply imputed data.
    I found the codes in 'family(gamma) link(log) ' works
    but in 'family(gaussian) link(log)' not works
    could i ask about the reason and how to deal with it, thank you

    here are the codes:
    ///////////////////////////////////////////////////////////////////////////////////////////////
    *Calculate the predict mean cost of part0*
    mi estimate, dots post: glm Total_public_costs_w26 i.Treatment_success_w16 i.Treatment_success_w26 i.Treatment age i.Gender i.site_num i.ethnicity_BAME i.Baseline_HDRS17_Severe if Treatment_path_w16_26==0, family(gamma) link(log)

    *combine then predict method*
    *first derivatives of prediction equation*
    matrix s=2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    matrix list e(b)
    *prediction*
    matrix phat= s*e(b)'
    matrix list phat

    *calculate the variance of the prediction*
    matrix phat_var= s*e(V)*s'
    matrix list phat

    *SE of prediction*
    di sqrt(phat_var[1,1])



    ///////////////////////////////////////////////////////////////////////////////////////////////
    *Calculate the predict mean cost of part1'*
    mi estimate, dots post: glm Total_public_costs_w26 i.Treatment_success_w16 i.Treatment_success_w26 i.Treatment age i.Gender i.site_num i.ethnicity_BAME i.Baseline_HDRS17_Severe if Treatment_path_w16_26==1, family(gaussian) link(log)

    *combine then predict method*
    *first derivatives of prediction equation*
    matrix s=2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    matrix list e(b)
    *prediction* ?
    matrix phat= s*e(b)' (from this code not works)
    matrix list phat

    *calculate the variance of the prediction*
    matrix phat_var= s*e(V)*s'
    matrix list phat

    *SE of prediction*
    di sqrt(phat_var[1,1])


  • #2
    I don't understand where you are trying to get or why but please look at
    Code:
    help mi predict

    Comment

    Working...
    X