ch.logistic: A function to fit a logistic function

View source: R/ch.logistic.r

ch.logisticR Documentation

A function to fit a logistic function

Description

This function fits a logistic function to a dataset

Usage

ch.logistic(
  x,
  y,
  parameters = c(bottom = NA, top = NA, slope = 5),
  fixedMaxX = NULL,
  fixedMinX = 0
)

Arguments

x

A vector of predictor values.

y

A vector outcome values.

parameters

A vector that specifies the free parameters that are used in the logistic model. There are four possible free parameters, three of them are specified here: bottom, top, and slope (The fourth is a scale value and is set using fixedMaxX). If you specify the variable value in this vector, then it will be included in the logistic model as a free parameter. Furthermore, the value you set in this vector is the start value for the maximum likelihood search. If you do not specify it, or assign in an NA, then it be fixed at the default value. bottom: specifies the floor value. DEFAULT = 0. top: specifies the ceiling value. DEFAULT = 1. slope: is always a free value. You have the opportunity to specify its starting value here.

fixedMaxX

A numeric value that specifies a fixed X value for the function to reach ceiling. IF this parameter is set to NULL, then scale will be a free parameter and maximum x value for ceiling will be derived from the dataset. DEFAULT = NULL.

fixedMinX

A numeric value that specifies the fixed x value for the function to reach floor. This value must be set and is used to transform the x variable so that the logistic will run properly. If you are unsure, then set this value to min(x). DEFAULT = 0.

Value

a list that contains the input data (data) with the best fit values (column name = "fit") and a scale value if scale is fixed (column name = "scale"); the nls object (fit); and a measure of the variance explained by the fitted function (r2).

Examples

ch.logistic (x, y, c(bottom = 0, slope = 5), fixedMinX = -1)

ccpluncw/ccpl_R_chutils documentation built on Feb. 28, 2024, 1:17 a.m.