Learn R Programming

biometrics (version 1.0.3)

bankfit: Function that fits a list of models on a given dataframe.

Description

Function that fits a list of models on a given dataframe.

Usage

bankfit(modlist, data, file = NULL, file.full = FALSE, trace = FALSE, ...)

Arguments

modlist

List that contains the models to be fitted. To know the structure, see examples below.

data

dataframe that contains the values that correspond to observed values and variables as columns.

file

a (writable binary-mode) connection or the name of the file where the data will be saved (when tilde expansion is done).

file.full

wheter to include all output (TRUE) or just the fitted models plus their respective pred.f field (FALSE, default).

trace

logical value indicating if a trace of the iteration progress of stats::nls() should be printed (TRUE) or not (FALSE, default).

...

Other options used to control de behavior of stats::nls().

Examples

Run this code
model.list <- list(
    mod1 = list(expr = vtot ~ I(dap^2) + I(dap^2 * atot^2) +I(d6),
                pred.f = function(x, ...) x,
                type = "lm"),
    mod2 = list(expr = I(log(vtot)) ~ I(log(dap)) + I(log(atot)),
                pred.f = function(x, ...) exp(x),
                type = "lm"))

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

## fitting models to dataframe
bankfit(modlist = model.list, data = df)

Run the code above in your browser using DataLab