Learn R Programming

biometrics (version 1.0.3)

bankpred: Predicts the variable of interest for each model of the list

Description

The function predicts the variable of biometrics-interest for each model belonging to the list previously fitted, as well as, generates a dataframe with the results.

Usage

bankpred(
  file = stop("You must provide a bankfit output object"),
  data = stop("You must provide a dataframe")
)

Arguments

file

The output from bankfit() as a file path or object.

data

A dataframe for the prediction of the response variable's values using the models fitted in file.

Examples

Run this code
if (FALSE) {
## list of example models
model.list <- list(
    mod1 = list(expr = vtot ~ I(dap^2) + I(dap^2 * atot^2) +I(d6),
                pred.f = function(x, ...) x,
                summodel = function(x, ...) datana::modresults(x)),
    mod2 = list(expr = I(log(vtot)) ~ I(log(dap)) + I(log(atot)),
                pred.f = function(x, ...) exp(x),
                summodel = function(x, ...) datana::modresults(x)))

## example dataframe
df <- treevolruca2
head(df)

## fitting models to dataframe and saving them
bankfit(models = model.list, data = df, file = "out.rdata")


## using fitted models file from biometrics::bankfit()
bankpred(file = "out.rdata", data = df) 
}

Run the code above in your browser using DataLab