Testing Logistic regression models on different data

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing Logistic regression models on different data

Jose von Roth
Hello,

I was wondering how to test a obtained logistic model on a different
data set. I already created a syntax that creates dummy variables
for categorical explanatory variables. Now I just want to test the
accuracy of my models on test samples ( if possible just using the
significant coefficients)?  saving the predicted probabilities in
the same test sample data set.

I found somthing similar for linear regressions, but I am not sure
what changes have to be done in order to acomplish what i am
looking for.

Regards,

Jose
Reply | Threaded
Open this post in threaded view
|

Re: Testing Logistic regression models on different data

Marta García-Granero
Hi Jose:

You have to match the second dataset to the first (the one you used to
obtain the model). Replace file names and variable names by your own:

GET FILE ='Your first dataset'.

ADD FILES /FILE=*
 /FILE='Drive:\Path\Validating dataset.sav'
 /IN=source01.
VARIABLE LABELS source01
 'Case source is second file'.

Source01 will be EQ 0 for the original cases and EQ 1 for the second
dataset.

Then run your logistic regression model again, but selecting only the
cases from the first dataset (see "/SELECT =..." subcommand below).
The model (derived from the first dataset) will be authomatically
applied to the second dataset (you will see predicted vs observed
values table) and the predicted probabilities for both datasets will
be saved as a new variable (using /SAVE = PRED):

LOGISTIC REGRESSION VARIABLES  depvar
  /SELECT = source01 EQ 0
  /METHOD = ENTER "list of predictors"
  /SAVE = PRED
  /PRINT = GOODFIT.

JvR> I was wondering how to test a obtained logistic model on a different
JvR> data set. I already created a syntax that creates dummy variables
JvR> for categorical explanatory variables. Now I just want to test the
JvR> accuracy of my models on test samples ( if possible just using the
JvR> significant coefficients)?  saving the predicted probabilities in
JvR> the same test sample data set.

Is that what you wanted?

--
Regards,
Dr. Marta García-Granero,PhD           mailto:[hidden email]
Statistician

---
"It is unwise to use a statistical procedure whose use one does
not understand. SPSS syntax guide cannot supply this knowledge, and it
is certainly no substitute for the basic understanding of statistics
and statistical thinking that is essential for the wise choice of
methods and the correct interpretation of their results".

(Adapted from WinPepi manual - I'm sure Joe Abrahmson will not mind)