Hey,
I calculate residuals and predicted/fitted values from a logit equation. I saw that the observations do not coincide, i.e. some observations have NA as residual, but a non-NA predicted value. What's the reason behind this behaviour? Shouldn't be both values either NA or non-NA?
My question kinda has to do with this thread where Glenn wrote some code for AUROC and used the residuals to find "valid observations":
http://forums.eviews.com/viewtopic.php?t=10614
In what sense are these observations "valid"?
Thanks in advance!
Residuals and predicted/fitted values of logit do not coincide
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Residuals and predicted/fitted values of logit do not coincide
Could you provide an example?
Follow us on Twitter @IHSEViews
Re: Residuals and predicted/fitted values of logit do not coincide
Workfile attached. Thanks, I just found out where the problem lies (and that I forgot some things, but these are not related to the example).
I have an additional variable that indicates the "valid" observations and only these are used to estimate the model. The fitted values are calculated for all observations (that are "complete"), while the residuals are only calculated for the "valid" observations (= subsample specified in the equation).
The workfile consists of the following variables:
- binary_indicator: Dependent variable
- indep1/indep2: Two independent variables
- sample_indicator: Indicator for the subsample to be used
The model logit_model is based on these variables and fitted values and residuals are estimated using:
Can you confirm my "suspicion"?
I have an additional variable that indicates the "valid" observations and only these are used to estimate the model. The fitted values are calculated for all observations (that are "complete"), while the residuals are only calculated for the "valid" observations (= subsample specified in the equation).
The workfile consists of the following variables:
- binary_indicator: Dependent variable
- indep1/indep2: Two independent variables
- sample_indicator: Indicator for the subsample to be used
The model logit_model is based on these variables and fitted values and residuals are estimated using:
logit_model.forecast _xxf
logit_model.makeresid _xxr
Can you confirm my "suspicion"?
- Attachments
-
- logit_example.wf1
- (421.32 KiB) Downloaded 226 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Residuals and predicted/fitted values of logit do not coincide
When you perform the forecast, it will forecast all observations in the sample you tell it to forecast over. If the forecast cannot be computed due to missing data in the regressors, the forecast will have an NA for that observation.
When you produce the residuals, the residuals will be produced for all observations in the estimation sample (which may or may not be the same sample you decided to forecast over). If the residuals cannot be computed due to missing data in the regressors or the dependent variable, the residuals will have an NA for that observation.
When you produce the residuals, the residuals will be produced for all observations in the estimation sample (which may or may not be the same sample you decided to forecast over). If the residuals cannot be computed due to missing data in the regressors or the dependent variable, the residuals will have an NA for that observation.
Follow us on Twitter @IHSEViews
Re: Residuals and predicted/fitted values of logit do not coincide
So one has to subsample the valid observations first. Thanks!
Who is online
Users browsing this forum: No registered users and 51 guests