make_newdata {sbd}R Documentation

Make new data for prediction

Description

Creates or converts a dataframe of covariates to pass to predict.sbm, based on the data used in the model to be used for prediction.

Usage

make_newdata(formula, data, newdata = NULL)

Arguments

formula

A two-sided formula of the form response ~ covariate + ...

data

A dataframe containing the fields named in formula.

newdata

A dataframe of covariate values with fields matching variables in formula.

Details

When newdata is missing, a new dataframe is created with numeric variables held at their mean values, and all combinations of factors. When a newdata dataframe is provided it is checked for compatibility with formula variables, and character variables are converted to factors, but otherwise passed unchanged.

Value

A dataframe of covariate values.

Examples

  data(BCI_speed_data)
  make_newdata(speed ~ species, BCI_speed_data)

[Package sbd version 0.1.0 Index]