nls

Forcing nls to fit a curve passing through a specified point

六眼飞鱼酱① 提交于 2019-11-29 15:52:14
I'm trying to fit a Boltzmann sigmoid 1/(1+exp((x-p1)/p2)) to this small experimental dataset: xdata <- c(-60,-50,-40,-30,-20,-10,-0,10) ydata <- c(0.04, 0.09, 0.38, 0.63, 0.79, 1, 0.83, 0.56) I know that it is pretty simple to do it. For example, using nls : fit <-nls(ydata ~ 1/(1+exp((xdata-p1)/p2)),start=list(p1=mean(xdata),p2=-5)) I get the following results: Formula: ydata ~ 1/(1 + exp((xdata - p1)/p2)) Parameters: Estimate Std. Error t value Pr(>|t|) p1 -33.671 4.755 -7.081 0.000398 *** p2 -10.336 4.312 -2.397 0.053490 . --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

How get plot from nls in R?

三世轮回 提交于 2019-11-29 10:27:18
问题 In R I use nls to do a nonlinear least-squares fit. How then do I plot the model function using the values of the coefficients that the fit provided? (Yes, this is a very naive question from an R relative newbie.) 回答1: Using the first example from ?nls and following the example I pointed you to line by line achieves the following: #This is just our data frame DNase1 <- subset(DNase, Run == 1) DNase1$lconc <- log(DNase1$conc) #Fit the model fm1DNase1 <- nls(density ~ SSlogis(lconc, Asym, xmid,

Extract coefficients from ggplot2-created nls fit

爱⌒轻易说出口 提交于 2019-11-29 07:43:17
There's a nice explanation here of how to use ggplot2 to create a scatterplot, fit the data using nls, and plot the fit, all in one line, like so myhist = data.frame(size = 10:27, counts = c(1L, 3L, 5L, 6L, 9L, 14L, 13L, 23L, 31L, 40L, 42L, 22L, 14L, 7L, 4L, 2L, 2L, 1L) ) ggplot(data=myhist, aes(x=size, y=counts)) + geom_point() + geom_smooth(method="nls", formula = y ~ N * dnorm(x, m, s), se=F, start=list(m=20, s=5, N=300)) My question is: using this construction, is it possible to pull out the actual nls object from that call? I'd like to know my coefficients, etc. Right now I can't figure

Conditional nls

血红的双手。 提交于 2019-11-28 12:37:33
问题 I'm trying to fit the conditional nls with R 2.15.1. The same code was working fine with R 2.13 but now R 2.15.1 throws errors. 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, yes = Mean <- c1*exp(-((x-Mu)/Sigma11)^2), no = Mean <- c1*exp(-((x-Mu)/Sigma12)^2)), data = Data, start = list(c1 = 240, Mu = 25, Sigma11 = 5, Sigma12 = 14), algorithm = "port", lower = list(Sigma11 = 0,

R: nls not picking up additional arguments when used in custom function in geom_smooth

萝らか妹 提交于 2019-11-28 10:44:39
问题 This is a question that relates to my earlier question geom_smooth with facet_grid and different fitting functions. In that question, I was trying to use a different fitting function in geom_smooth for each facet in a facet grid for ggplot2. Marco Sandri kindly provided an answer that I am trying to adapt to use user-defined formulas rather than existing formulas (e.g., lm , loess ). Here is the my code. # Load library library(ggplot2) # Load data data(mtcars) # Smoothing function with

Forcing nls to fit a curve passing through a specified point

橙三吉。 提交于 2019-11-28 10:41:48
问题 I'm trying to fit a Boltzmann sigmoid 1/(1+exp((x-p1)/p2)) to this small experimental dataset: xdata <- c(-60,-50,-40,-30,-20,-10,-0,10) ydata <- c(0.04, 0.09, 0.38, 0.63, 0.79, 1, 0.83, 0.56) I know that it is pretty simple to do it. For example, using nls : fit <-nls(ydata ~ 1/(1+exp((xdata-p1)/p2)),start=list(p1=mean(xdata),p2=-5)) I get the following results: Formula: ydata ~ 1/(1 + exp((xdata - p1)/p2)) Parameters: Estimate Std. Error t value Pr(>|t|) p1 -33.671 4.755 -7.081 0.000398 ***

NLS_LANG setting for JDBC thin driver?

你。 提交于 2019-11-27 07:50:29
I am using the thin Oracle JDBC driver ver 10.2.0 (ojdbc14.jar). I would like to configure its NLS_LANG setting manually. Is there a way? Currently it fetches this setting from the VM variable user.language (which is set automatically by setting the current locale, or on startup from the system environment). This is a problem when the users switch the application locale to a one that is unsupported by the Oracle JDBC driver (e.g. mk_MK). In this case, the next time I fetch a connection I get the following exception: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access

ORA-00604 ORA-12705

℡╲_俬逩灬. 提交于 2019-11-27 02:56:42
问题 I am having this error in my j2ee web application. java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283) oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278) oracle.jdbc.driver.T4CTTIoauthenticate

NLS_LANG setting for JDBC thin driver?

谁说胖子不能爱 提交于 2019-11-26 13:50:51
问题 I am using the thin Oracle JDBC driver ver 10.2.0 (ojdbc14.jar). I would like to configure its NLS_LANG setting manually. Is there a way? Currently it fetches this setting from the VM variable user.language (which is set automatically by setting the current locale, or on startup from the system environment). This is a problem when the users switch the application locale to a one that is unsupported by the Oracle JDBC driver (e.g. mk_MK). In this case, the next time I fetch a connection I get