Announcement

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

  • How do I transfer logistic regression coefficients from training set to the validation set to test for AUROC

    I have divided my data in to training set (0) and validation (1) set using variable valid

    TRAINING SET
    logit outcome var1 var2 var3 if valid==0
    lroc


    How do I get the coefficients from training set to run logistic regression on validation set?
    logit ??? if valid==1
    Can I output a confusion matrix after this?

    Sorry to trouble

  • #2
    Review the output of help logit postestimation - specifically the predict command.

    Comment


    • #3
      Thanks for the above reference.

      Are there any worked code examples I could look at please?

      Comment


      • #4
        Originally posted by Edsel Ing View Post
        Are there any worked code examples I could look at please?
        Here's one:
        Code:
        sysuse auto
        set seed 1404614
        generate byte validation_set = runiform() > 0.5
        
        *
        * Begin here
        *
        logit foreign price mpg if !validation_set, nolog
        
        predict double xb, xb
        
        roctab foreign xb if validation_set
        // or
        lroc if validation_set, nograph

        Comment


        • #5
          Thank you much
          Will try this.

          Comment

          Working...
          X