Skip to contents

Fit the model of interest. The model is fitted on the model and data already inside the object, unless extra arguments are provided, in which case the model is first updated and then fitted.

Usage

fit(object, ...)

# S4 method for ProgressModelList
fit(object, ...)

# S4 method for ProgressBM
fit(object, ...)

# S4 method for ProgressBMM
fit(object, ...)

# S4 method for ProgressCLM
fit(object, ...)

# S4 method for ProgressCLMM
fit(object, ...)

# S4 method for ProgressSRF
fit(object, ...)

# S4 method for ProgressMRF
fit(object, ...)

Arguments

object

an object of class ProgressModel or ProgressModelList.

...

extra arguments passed to update().

Value

An object identical to object, with the model and fitted

slot(s) altered.

Examples

if (FALSE) {
# Create a Region object
library(cronus)
region <- Region(name = "nebraska", type = "us state",
                 div = c(country = "United States", state = "Nebraska"))

# Create a model
object1 <- new("ProgressBM",
               region = region,
               crop = "Corn",
               data = data_progress$Corn,
               formula = "CumPercentage ~ Time + agdd") # ProgressModel

# Create another model
object2 <- new("ProgressCLM",
               region = region,
               crop = "Soybeans",
               data = data_progress$Soybeans,
               formula = "Stage ~ Time + agdd + adayl") # ProgressModel

# Concatenate the models
object <- c(object1, object2) # ProgressModelList

# Fit
object <- fit(object)

# Plot
plot(object, cumulative = TRUE, seasons = 2002)

# Predict
predict(object, data_progress)

# Evaluate
object <- evaluate(object, maxsam = 100, seed = 1)
plot_metrics(object)

# Summarize
summary(object)

# Report
report(object, name = "example_report", path = getwd())
}