Conditional nls

余生长醉 提交于 2019-11-29 17:28:33

This code works in R 2.15.1.

x <- seq(from = 17, to = 47, by = 5)
y <- c(26.2, 173.6, 233.9, 185.9, 115.4, 62.0, 21.7)
Data <- data.frame(y, x)

Fit <- nls(formula =  y ~ ifelse(test = x <= Mu, ye = c1*exp(-((x-Mu)/Sigma11)^2), no = c1*exp(-((x-Mu)/Sigma12)^2)),
       data = Data, start = list(c1 = 240, Mu = 25, Sigma11 = 5, Sigma12 = 14), algorithm = "port",
       lower = list(Sigma11 = 0, Sigma12 = 0))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!