nls

not avoiding/skipping errors with try and tryCatch

二次信任 提交于 2019-12-08 04:36:12
问题 I have a nlsLM inside a for loop because I want to try different start values to fit my data. I already know that some start values generates this error : singular gradient matrix at initial parameter estimates , but I want to skip this error and continue with the loop , fitting the regression with the next start values . I tried to put all the for loop inside a try and a tryCatch block, setting silence=TRUE , but the code still stopping when the singular gradient matrix at initial parameter

AIC with weighted nonlinear regression (nls)

◇◆丶佛笑我妖孽 提交于 2019-12-07 21:14:15
问题 I encounter some discrepancies when comparing the deviance of a weighted and unweigthed model with the AIC values. A general example (from ‘nls’): DNase1 <- subset(DNase, Run == 1) fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1) This is the unweighted fit, in the code of ‘nls’ one can see that ‘nls’ generates a vector wts <- rep(1, n) . Now for a weighted fit: fm2DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1, weights = rep(1:8, each = 2)) in

Trying to fit data with R and nls on a function with a condition in it

只谈情不闲聊 提交于 2019-12-07 12:00:39
问题 I am trying to fit some data to a function which has validity limit in them. More precisely a function with different value if t<=T and t>T. Here is the code I have tried: posExpDecay <- function(t,tau,max,toff){ 1+max*(1-exp(-(t-toff)/tau)) } negExpDecay <- function(t,tau,max){ 1+max*exp(-(t)/tau) } data<-structure(list(t = c(0.67, 1, 1.33, 1.67, 2, 4, 6, 8, 10), y = c(1.02,2.33, 3.08, 3.34, 3.41,2.50, 1.86, 1.44, 1.22)), .Names = c("t", "y"), row.names = c(13L, 17L, 21L, 25L, 29L,37L, 45L,

Dojo 1.9 build 'multipleDefine' error while loading locale

拜拜、爱过 提交于 2019-12-06 22:52:31
问题 My dojo application breaks after building, during loading the app, throwing 'multipleDefine' and giving this error: Error {src: "dojoLoader", info: Object} Message: multipleDefine info: Object {pid: "dojo", mid: "dojo/nls/dojo_en-us", pack: Object, url: "dojo/nls/dojo_en-us.js", executed: 5…} Here is my profile: var profile = { // `basePath` is relative to the directory containing this profile file; in this case, it is being set to the // src/ directory, which is the same place as the

plotting nls fits with overlapping prediction intervals in a single figure

旧街凉风 提交于 2019-12-06 22:37:29
Say I some data, d , and I fit nls models to two subsets of the data. x<- seq(0,4,0.1) y1<- (x*2 / (0.2 + x)) y1<- y1+rnorm(length(y1),0,0.2) y2<- (x*3 / (0.2 + x)) y2<- y2+rnorm(length(y2),0,0.4) d<-data.frame(x,y1,y2) m.y1<-nls(y1~v*x/(k+x),start=list(v=1.9,k=0.19),data=d) m.y2<-nls(y2~v*x/(k+x),start=list(v=2.9,k=0.19),data=d) I then want to plot the fitted model regression line over data, and shade the prediction interval. I can do this with the package investr and get nice plots for each subset individually: require(investr) plotFit(m.y1,interval="prediction",ylim=c(0,3.5),pch=19,col.pred

nls and log scale in ggplot2

若如初见. 提交于 2019-12-06 15:26:33
I'm trying to plot 3 non-linear models in ggplot2. It's working in automatic scale but not in log10 scale where I get the "singular gradient error". What could be the problem(s)? The data I'm trying to fit (df1): x y 4.17 0.55 10.08 0.48 40.25 0.38 101.17 0.32 400.33 0.24 The code I tried: plot <- ggplot(df1, aes(x=x, y=y))+ stat_smooth(method="nls", formula=y~I(a*x^(-n)), data=df1, start=list(a=1,n=1), se=FALSE, colour="red")+ stat_smooth(method="nls", formula=y~m*(x+m^(1/n))^(-n), data=df1, start=list(m=0.7, n=0.17), se=FALSE, colour="blue")+ stat_smooth(method="nls", formula=y~m*(x+m^(1/n))

R - Confidence bands for exponential model (nls) in basic graphics

放肆的年华 提交于 2019-12-06 14:05:15
问题 I'm trying to plot a exponential curve (nls object), and its confidence bands. I could easily did in ggplot following the Ben Bolker reply in this post. But I'd like to plot it in the basic graphics style, (also with the shaped polygon) df <- structure(list(x = c(0.53, 0.2, 0.25, 0.36, 0.46, 0.5, 0.14, 0.42, 0.53, 0.59, 0.58, 0.54, 0.2, 0.25, 0.37, 0.47, 0.5, 0.14, 0.42, 0.53, 0.59, 0.58, 0.5, 0.16, 0.21, 0.33, 0.43, 0.46, 0.1, 0.38, 0.49, 0.55, 0.54), y = c(63, 10, 15, 26, 34, 32, 16, 31,26,

AIC with weighted nonlinear regression (nls)

独自空忆成欢 提交于 2019-12-06 13:48:10
I encounter some discrepancies when comparing the deviance of a weighted and unweigthed model with the AIC values. A general example (from ‘nls’): DNase1 <- subset(DNase, Run == 1) fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1) This is the unweighted fit, in the code of ‘nls’ one can see that ‘nls’ generates a vector wts <- rep(1, n) . Now for a weighted fit: fm2DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1, weights = rep(1:8, each = 2)) in which I assign increasing weights for each of the 8 concentrations with 2 replicates. Now with deviance I

Trying to fit data with R and nls on a function with a condition in it

前提是你 提交于 2019-12-05 23:02:10
I am trying to fit some data to a function which has validity limit in them. More precisely a function with different value if t<=T and t>T. Here is the code I have tried: posExpDecay <- function(t,tau,max,toff){ 1+max*(1-exp(-(t-toff)/tau)) } negExpDecay <- function(t,tau,max){ 1+max*exp(-(t)/tau) } data<-structure(list(t = c(0.67, 1, 1.33, 1.67, 2, 4, 6, 8, 10), y = c(1.02,2.33, 3.08, 3.34, 3.41,2.50, 1.86, 1.44, 1.22)), .Names = c("t", "y"), row.names = c(13L, 17L, 21L, 25L, 29L,37L, 45L, 49L, 53L), class = "data.frame") fit <- nls(y~ifelse(t<=tswitch, posExpDecay(t,tau1,max1,toff),

Dojo custom build with NLS / localisation

谁说胖子不能爱 提交于 2019-12-05 22:49:36
问题 I have a problem implementing a cross domain custom build in Dojo. The situation is as follows: i have a pretty large application, with a good number of localisation bundles, so basicly the directory structures is like core\ (my module) nls\ fr\ en\ .... When building my module the result is a big core.js/core.xd.js file, which, bien sur, does not contain the localisations. In the localisation nls directories (en/fr/etc) i find after the build each bundle builded/minified, and a bigger file