I'm trying to fit some data to an equation and keep running into the same error : Error in nls(y ~ A + (B * exp(1) * ((-(x - K)^2)/(2 * (E)^2))) + (G * : parameters without starting value in 'data': B, K, E, G, H, J
gausform <- function(x, A, B, K, E, G, H, J) {
A + (B * exp(1) * ((-(x - K)^2)/(2 * (E)^2))) + (G * exp(1) *((-(x - H)^2)/(2 * (J)^2)))
}
new <- data.frame(x,y)
st1 <- list(c(A = min(y), B = mx1, K = cen1, E = width1, G = mx2, H = cen2, J = width2))
fit <- nls(y ~ gausform(x, A, B, K, E, G, H, J), data = new, start = st1)
Very new to R, so likely that something is terribly wrong, here is what I'm trying to do: x and y are my data A, B, K, E, G, H and J are values I'm trying to get from the fit mx1, cen1, width1, mx2, cen2 and width2 are all values that I've calculated from my data and want to use as my initial start values.
I'm not sure line(s) I messed up that is making the B through J not starting with what's set as st1.
Any hints or insight is very much appreciated!!