simhetegro: Simulate heteroscedastic exponential growth data

Description Usage Arguments Value Examples

Description

A sandbox to simulate heteroscedastic exponential growth data. Random normal variance enlarges with the model value of y using a constant coefficeint of variation (cv). The data generating model is an exponential growth function: 'yp = ylo*exp(k*x)'. The random value is then produced by applying the following to a dataframe of yp values: 'y = rnorm(1, yp, cv*yp)'. The plot fitting subfunction will occasionally fail due to random data. These may occur with higher cv values, fewer reps, and fewer x values. Just re-simulate with modified parameter values. The regression formula is 'y ~ ylo*exp(k*x)'.

Usage

1
simhetegro(x, k, ylo, cv, reps, weight = F)

Arguments

x

A vector of linear scale values.

k

A starting estimate for the rate constant, which has units of reciprocal x.

ylo

The lowest value of y, or starting value.

cv

The coefficient of variation.

reps

The number of replicates per value of x.

weight

A logical value indicating y scale weighting. Default is FALSE. If TRUE, the curve is fit using relative (1/y^2) weighting.

Value

ggplot, data

Examples

1
2
3
4
5
6
7
8
# Hypothetical Cell growth measured every 4 hours, replicated 5 times

simu <- simhetegro(x=c(0, 4, 8, 12, 16, 20, 24, 28), k=0.2, ylo=100,
cv=0.3, reps=5, weight=FALSE)

simu

simu$data#'

TJMurphy/nlfitr documentation built on March 18, 2021, 12:33 p.m.