multi_model_2: Fit and predict in one function

View source: R/multi_model_2.R

multi_model_2R 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")

manymodelr documentation built on April 4, 2025, 12:01 a.m.