Regression - Save Variable(s) - Fitted Values

From Q
Jump to: navigation, 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 Regression). Observations with missing values in the predictors are not fitted.

Output

Running this QScript will produce a new variable, which will appear in your data 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");
 
main();
 
function main() {
    saveVariables("Fitted Values", "Regression", "fitted(", ")", null);
}