seinfitR: SeinfitR

View source: R/seinfitR.R

seinfitRR Documentation

SeinfitR

Description

This function fits the Seinhorst equation to experimental data describing the relationship between preplant nematode densities and plant growth using nonlinear least squares fitting. The fitting process is performed using the nlsLM function from the minpack.lm package.

Usage

seinfitR(p_i, y, data, start, z_fixed = FALSE, control = seinfitR_control())

Arguments

p_i

A character string specifying the column name in data that contains preplant nematode densities.

y

A character string specifying the column name in data that contains the plant growth response.

data

A data frame containing the experimental data. It must include at least two columns: one representing the preplant nematode densities (p_i) and another representing the plant growth response (y).

start

A list of initial parameter values for m, t, and z (if z_fixed = FALSE). These values are used to initialize the nonlinear least squares fitting process.

z_fixed

Logical. If TRUE, the function uses the default value for \( z^t \), as described in Seinhorst (1986) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-1-4613-2251-1_11")}

control

A control object created using seinfitR_control(), which specifies options for the optimization process.

Value

A list of class "seinfitR" containing:

fit

An object of class nls with the fitted model.

summary_seinfitR

Summary statistics of the fitted model.

cov

The covariance matrix of parameter estimates (if available).

data

The original dataset used for fitting.

x

The name of the predictor variable used (p_i).

y

The name of the response variable used (y).

z_fixed

Logical value indicating whether z was fixed.

Examples

# Example: Modeling plant response to nematode densities using "jambu" dataset

# Fit the model using seinfitR with specified initial values
model <- seinfitR(p_i = "p_i", y = "y", data = jambu,
                  start = list(m = 0.103, t = 250, z = 0.991),
                  control = seinfitR_control(maxiter = 5))

# View model summary
summary(model)

seinfitR documentation built on April 11, 2025, 5:54 p.m.