## Initial Situation and Goal

In addition to the ‘Cornerstone’ core methods of fitting data by a
linear regression it is possible to use a a model building function from
CornerstoneR to model data. Afterwards, the model can be used to make
predictions for other datasets.

How do we use the method ‘modelPredict’ in ‘Cornerstone’ from
‘CornerstoneR’?

## Use Fitted Models for Predictions

The following conditions are required in order to properly use the
‘modelPredict’ function from CornerstoneR:

- an already fitted Decision Tree, Random Forest or Gaussian Process
Regression Model outputted using the corresponding CornerstoneR
method,
- data records that the fitted model did not see beforehand, but show
the same structure (same predictors recorded) as the input data from the
model build.

You can find the detailed user guides with examples for fitting and
predicting a model in the respective user guide for *Decision
Tree*, *Random Forest* and *Gaussian Process
Regression*, section “Use fitted *model name* for
predictions”.

## Options in the Script Variables Dialog

Starting from the ‘R’ analysis object ‘modelPredict’, you can find
the ‘Script Variables’ dialog via the menu ‘R Script’ -> ‘Script
Variables’. The following dialog appears.

Here, you can choose if you wish to output computed columns as such.
That means, if your input data contains computed columns, they will show
up in the outputted ‘Predictions’ dataset as static columns. If you
check this box in the script variables, the computed columns will be
outputted with their formula. Make sure that the computation of these
columns is still valid and not using any columns that were not passed to
the CornerstoneR routine.