Hi Derek,

have a look at the following made-up example:

f1 <- function(x){2*x}
f2 <- function(x){-10*x+1}

x<-rnorm(10)
x
(x<0)*f1(x)
(x>=0)*f2(x)
(x<0)*f1(x) + (x>=0)*f2(x)



Therefore I suggest you should specify the model as follows:

yourNLSmodel <- nls(Y ~ (X<Z) * f(X,a,b,c) + (X>=Z) * g(X,a,d,e), data = 
myData, ...)



Christian

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to