multi_model_2: Fit and predict in one function

Description Usage Arguments Examples

View source: R/multi_model_2.R

Description

Fit and predict in one function

Usage

1
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

1
2
3
4
5
6
7
# 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 Nov. 15, 2021, 5:07 p.m.