Announcement

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

  • Model Validation Using Stata

    Hi all,

    I have a question about how to do model validation using Stata.

    I used a training dataset to run regression and get the coefficients of the regressions. I want to first, save the result of these coefficients and second, use these coefficients in a new dataset to do prediction and calculate MSE, MPE, etc.

    I have many variables and one categorical variable has around 3000 values. I wonder if anyone knows how to save the regression coefficients and then apply them to the new dataset to do prediction.

    Thanks!


  • #2
    How about something along these lines?
    Code:
    use training_dataset
    generate byte training_dataset = 1
    append using new_dataset
    replace training_dataset = 0 if missing(training_dataset)
    regress <stuff> if training_dataset
    predict double outcome_hat, xb
    <summary statistics of difference between observed and predicted outcome variables if !training_dataset>

    Comment


    • #3
      What's the point of doing this? Why are you interested in this?

      Comment

      Working...
      X