multi_model_2 {manymodelr}R Documentation

Fit and predict in one function

Description

Fit and predict in one function

Usage

multi_model_2(old_data, new_data, yname, xname, modeltype, ...)

Arguments

old_data

The data set to which predicted values will be added.

new_data

The data set to use for predicting.

yname

The outcome variable

xname

The predictor variable(s)

modeltype

A character specifying the model type e.g lm for linear model

...

Other arguments to specific model types.

Examples

# fit a linear model and get predictions
multi_model_2(iris[1:50,],iris[50:99,],"Sepal.Length","Petal.Length","lm")
# multilinear
multi_model_2(iris[1:50,],iris[50:99,],"Sepal.Length",
    "Petal.Length + Sepal.Width","lm")
# glm
multi_model_2(iris[1:50,],iris[50:99,],"Sepal.Length","Petal.Length","glm")

[Package manymodelr version 0.3.7 Index]