Regression - Save Variable(s) - Fitted Values

From Q
Jump to navigation Jump to search

Creates a new variable containing fitted values (i.e. the yhat values) for each case in the data from a model (e.g., from Regression - Linear Regressionlinear regression). Observations with missing values in the predictors are not fitted.

Output

Running this QScript will produce a new variablevariable, which will appear in your data setdata set for use in further analyses.

Technical details

Uses the fitted method from R. Unlike the defaults in most R packages, this implementation assigns fitted values for observations not in the estimation sample.

Code

includeWeb('QScript R Output Functions');

saveVariables('Fitted Values', 'Regression', 'fitted(', ')', null, null, 'fit.val', 'Regression');