Learn R Programming

alR (version 2.2.0)

kappa4al: Sigmoidal curve fitting.

Description

A framework for arc length fitting of the four-parameter kappa sigmoidal function.

Usage

kappa4al(formula, data = list(), lower, upper, q1, q2, tol, maxiter, ...)

# S3 method for default kappa4al(formula, data = list(), lower = c(0, -5, -5), upper = c(10, 1, 1), q1, q2, tol = 1e-15, maxiter = 50000, ...)

# S3 method for kappa4al print(x, ...)

# S3 method for kappa4al summary(object, ...)

# S3 method for summary.kappa4al print(x, ...)

# S3 method for formula kappa4al(formula, data = list(), lower = c(0, -5, -5), upper = c(10, 1, 1), q1, q2, tol = 1e-15, maxiter = 50000, ...)

# S3 method for kappa4al predict(object, newdata = NULL, ...)

Arguments

formula

An LHS ~ RHS formula, specifying the linear model to be estimated.

data

A data.frame which contains the variables in formula.

lower

A vector of lower constraints for the parameters to be estimated; defaults to c(0, -5, -5).

upper

A vector of upper constraints for the parameters to be estimated; defaults to c(10, 1, 1).

q1, q2

Numeric vectors, for the lower and upper bounds of the intervals over which arc lengths are to be computed.

tol

Error tolerance level; defaults to 1e-15.

maxiter

The maximum number of iterations allowed; defaults to 50000.

...

Arguments to be passed on to the differential evolution function JDEoptim.

x

A kappa4al object.

object

A kappa4al object.

newdata

The data on which the estimated model is to be fitted.

Value

A generic S3 object with class kappa4al.

kappa4al.default: A list with all components from JDEoptim, as well as:

  • intercept: Did the model contain an intercept TRUE/FALSE?

  • coefficients: A vector of estimated coefficients.

  • error: The value of the objective function.

  • fitted.values: A vector of estimated values.

  • residuals: The residuals resulting from the fitted model.

  • call: The call to the function.

  • ALFHat: Arc length segments of the empirical CDF (calculated from data).

  • ALF: Arc length segments of the CDF of the four-parameter kappa distribution (theoretical). p1: The vector of sample quantiles in the data corresponding to q1. p2: The vector of sample quantiles in the data corresponding to q2.

summary.kappa4al: A list of class summary.kappa4al with the following components:

  • call: Original call to the kappa4al function.

  • coefficients: A vector with parameter estimates.

  • arclengths: A matrix of the arc length segments of the dependent and independent variables that were matched.

  • r.squared: The \(r^{2}\) coefficient.

  • sigma: The residual standard error.

  • error: Value of the objective function.

  • residSum: Summary statistics for the distribution of the residuals.

print.summary.kappa4al: The object passed to the function is returned invisibly.

predict.kappa4al: A vector of predicted values resulting from the estimated model.

Methods (by class)

  • default: default method for kappa4al.

  • kappa4al: print method for kappa4al.

  • kappa4al: summary method for kappa4al.

  • summary.kappa4al: print method for summary.kappa4al.

  • formula: formula method for kappa4al.

  • kappa4al: predict method for kappa4al.

Examples

Run this code
# NOT RUN {
k <- kappa4tc(-4, 0, 1)$par
x <- seq(qkappa4(0, 4, 0.4, -4, k), qkappa4(0.7, 4, 0.4, -4, k), length.out=100)
y <- sapply(x, function(i) pkappa4(i, 4, 0.4, -4, k))
kappa4nls.default(y~x, q1=c(0.025, 0.5), q2=c(0.5, 0.975), tol=1e-5)

u <- seq(qkappa4(0.1, 4, 0.4, -4, k), qkappa4(0.8, 4, 0.4, -4, k), length.out=100)
v <- sapply(u, function(i) pkappa4(i, 4, 0.4, -4, k))
al <- kappa4al(y~x, q1=c(0.025, 0.5), q2=c(0.5, 0.975), tol=1e-5)
predict(al, newdata=data.frame(y=v, x=u))

# }

Run the code above in your browser using DataLab