Announcement

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

  • How do I run a model with just coefficients from another dataset

    Dear All,
    I am trying to validate a risk prediction model using logistic regression on a dataset. I have only the coefficients produced from a dataset that is not available to me. How can I validate the model on my dataset?

  • #2
    You could start by mechanically calculating the regression model, using the previously mentioned coefficients and your validation dataset. From there you would need to consider the goodness of fit, calibration and discrimination at a minimum.

    Comment


    • #3
      Thank you very much Leonardo. I am new to stata so I am not quite sure how to do this. I am planning on using random-effects logistic regression. Could you please give me an idea as how to code this in stata? My data is in the form:

      Estimate Std. Error z value Pr(>|z|)

      (Intercept) -5.17507 0.21262 -24.340 < 2e-16 ***

      agecat25-29 0.36398 0.09047 4.023 5.74e-05 ***

      agecat30-34 0.68901 0.08956 7.693 1.43e-14 ***

      agecat35-39 1.03675 0.09980 10.389 < 2e-16 ***

      agecat=<40 1.42255 0.13506 10.533 < 2e-16 ***

      bmicat20.0-24.9 0.41981 0.10162 4.131 3.61e-05 ***

      bmicat25.0-26.9 0.86229 0.11675 7.386 1.52e-13 ***

      bmicat27.0-29.9 1.31655 0.11842 11.117 < 2e-16 ***

      bmicat30.0-34.9 1.60919 0.12553 12.819 < 2e-16 ***

      bmicat>=35.0 2.44541 0.14654 16.688 < 2e-16 ***

      Comment


      • #4
        You can generate a new variable using -generate-.

        Something like this shows the general idea of manually writing the logistic regression equation. Based on your coefficients, you will need to either have your age and BMI data categorized in the same way, or create those categorizations yourself from the original age and BMI values. Two new variables are made: -lp- is the linear predictor of the model, and -pred_pr- is the predicted probability by inverting the logit link. (These steps could have been combined into one for brevity, but two steps makes the process a bit more obvious.)

        Code:
        gen double lp = (constant) + beta1*x1 + ... betaN*xN
        gen double pred_pr = invlogit(lp)
        However, this is only the fixed effect portion of the model. It doesn't appear as though the original model was coded using random effects. If the original model was plain logistic regression, then the code above replicates that model and there are no issues. However, you can't fit a new model (like adding random effects) and call that a validation; a validation implies fitting the original model.

        Comment


        • #5
          Thank you so much Leonardo. You have been a great help.

          Comment


          • #6
            Dear Leonardo,
            Thank you so much for your help in the past. It worked fine. I have one more question. How can I get fit statistics such as lstat , fitstat in a random-effects logistic regression model? I am sorry to bother you again.
            Kind regards,
            Sanjeeva

            Comment

            Working...
            X