New regression functionality: Retrieval of prediction and residual values

 by  Trond Pedersen

All regression commands found in microdata.no will now have associated commands that generate residual and prediction values. Such values can be used to analyze the data spread and for testing regression models. Prediction values can also be used as input for further analyzes.

The commands have the same name as the associated regression command plus “-predict”, and generate a set of values:

  • regress-predict: prediction values, residuals and “Cook’s distance”
  • ivregress-predict: prediction values and residuals
  • logit-predict: probability values, prediction values and residuals
  • probit-predict: probability values and prediction values
  • mlogit-predict: probability values and prediction values
  • panel-regress-predict: prediction values, residuals og unit effects

You decide which values to generate through the use of options. The result of the execution is a set of variables that contain the different values. By default, the former value type in the list above is generated, but it is still recommended to specify value type through options as this makes you able to define the names of the generated variables. If you run several “predict commands”, you must create new names for the automatically generated variables to avoid variables being given the same name, which will result in an error message.

Syntax examples:

regress-predict salary age man wealth, residuals(res) predicted(pred) cooksd(cook)
logit-predict highsalary age man wealth, residuals(res2) predicted(pred2) probabilities(prob2)

The automatically generated variables can be used as input for further analyzes or to be displayed graphically. Current graphical commands are hexbin and histogram. By running a histogram on the residual variable, one can check whether the residuals are normally distributed. The Hexbin command can also be used to create anonymized scatter plots where you combine two sets of values.

For more details, we recommend to use the help command, e.g. help regress-predict

Click here for examples of using prediction commands in analyzes

We work continuously to improve microdata.no so that most analysis needs can be met. Thus, more and more analysis options will be introduced. We are based on input from researchers, and have compiled a list of new tools that we work through. Do you have specific suggestions for new functionality? Feel free to contact us by email: support@microdata.no