Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Postestimation using different data


From   [email protected] (Yulia Marchenko, StataCorp)
To   [email protected]
Subject   Re: st: Postestimation using different data
Date   Thu, 27 Dec 2007 11:38:14 -0600

Nancy West <[email protected]> wants to validate a model fitted by the
-logit- command:

> Using version 9, I've run a logit model and now want to validate it.  I am
> using another dataset to do so.

So Nancy has two datasets -- one used for estimation and another she wants to
use for validation.  Nancy can validate the model by using option -all- with
-estat classification-.

        . use <first_data_set>
        . logit (or logistic) <outcome> ...
        . use <second_data_set>
        . estat classification, all

If the validation dataset has different variable names than the estimation
dataset, Nancy would need to rename the variables first.

Also, Nancy is not able to reproduce an example from Stata 9 of -estat gof-:

> I've followed the directions according to
> the manual ([R] K-Q, pg. 88-89). I did "matrix input..."  and "matrix
> colnames..."  I've run "lroc..." and "lsens..." They work but "estat gof"
> and "estat clas" do not.  I typed the "estat gof" command exactly as in the
> manual but it gives me the message "varlist not allowed".  "Estat clas" also
> gives me the same error message and this is the test I really want.

This example should not have been in the documentation; it was removed from
the Stata 10 documentation.  If Nancy wants a classification table, she will
have to do it by hand:

        . matrix score linear_prediction = <matrixname>

        . gen predicted_p = invlogit(linear_prediction)

        . gen classification = (predicted_p >= #)

        . tabulate classification <outcome>

where Nancy substitutes for <matrixname> the matrix containing the coefficient
estimates, for # the cutoff, such as 0.5, and for <outcome> the dependent
variable name.


--Yulia
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index