# fixed formula part:
f <- dat ~ a0 * exp(-S*(x - 250)) + K
# convert to character
f <- as.character(f)
# component:
C <- "(p0*exp(-0.5*((x-p1)/p2)^2))"
# number of components (defined randomly):
n <- sample(1:3, 1)
C <- rep(C, n)
# collapse:
C <- paste(C, collapse = "+")
# combine
f <- paste(f[2],
Hi everyone.
I have a non-linear model specified as this (6 variables, a0, S, K, p0, p1, p2):
fit <- nlsLM(formula = dat ~ a0 * exp(-S*(x - 250)) + K + ( C ) )
where C = (p0*exp(-0.5*((x-p1)/p2)^2))
The problem is that I do not know in advance how many component (C) I will have
in the model. T
2 matches
Mail list logo