Hello, I am working on a small data set and trying to find values of Qmax and Kl for the equation qe = (Qmax * Kl * ce) / (1 + ?l* ce) I found my Qmax and Kl through the linear model butam now trying to find them through the "nls" function however an error comes up that I am unfamiliar with. I have the file loaded for reference. Any help is appreciated. Thank you. -Timothy
Your text has unreadable characters in it. Use plain text. Also, your attachments are not coming through. Read the Posting Guide about attachments... best results are usually obtained by inserting the R code in the body of your email and not attaching anything. -- Sent from my phone. Please excuse my brevity. On December 19, 2017 2:13:03 PM PST, Timothy Axberg <axbergtimothy at gmail.com> wrote:>Hello, I am working on a small data set and trying to find values of >Qmax >and Kl for the equation > >qe = (Qmax * Kl * ce) / (1 + ?l* ce) > >I found my Qmax and Kl through the linear model butam now trying to >find >them through the "nls" function however an error comes up that I am >unfamiliar with. I have the file loaded for reference. Any help is >appreciated. Thank you. > >-Timothy >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.
You also need to reply-all so the mailing list stays in the loop. -- Sent from my phone. Please excuse my brevity. On December 19, 2017 4:00:29 PM PST, Timothy Axberg <axbergtimothy at gmail.com> wrote:>Sorry about that. Here is the code typed directly on the email. > >qe = (Qmax * Kl * ce) / (1 + Kl * ce) > >##The data >ce <- c(15.17, 42.15, 69.12, 237.7, 419.77) >qe <- c(17.65, 30.07, 65.36, 81.7, 90.2) > >##The linearized data >celin <- 1/ce >qelin <- 1/qe > >plot(ce, qe, xlim = xlim, ylim = ylim) > >##The linear model >fit1 <- lm(qelin ~ celin) >intercept1 <- fit1$coefficients[1] >slope1 <- fit1$coeffecients[2] >summary(fit1) > >Qmax <- 1/intercept1 >Kl <- .735011*Qmax > >xlim <- range(ce, celin) >ylim <- range(qe, qelin) > >abline(lm(qelin ~ celin)) > >c <- seq(min(ce), max(ce)) >q <- (Qmax*Kl*c)/(1+(Kl*c)) > >lines(c, q) > > >##My attempt at the nonlinear regression >fit2 <- nls(qe ~ ((Qmax*Kl*ce)/(1+(Kl*ce))), start = list(Qmax = Qmax, >Kl >Kl)) >results <- fit2$m$getpars() >Qmax2 <- fit2$m$getpars()[1] >Kl2 <- fit2$m$getpars()[2] >summary(fit2) > >-Timothy
Should I repost the question with reply-all? On Tue, Dec 19, 2017 at 6:13 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> You also need to reply-all so the mailing list stays in the loop. > -- > Sent from my phone. Please excuse my brevity. > > On December 19, 2017 4:00:29 PM PST, Timothy Axberg < > axbergtimothy at gmail.com> wrote: > >Sorry about that. Here is the code typed directly on the email. > > > >qe = (Qmax * Kl * ce) / (1 + Kl * ce) > > > >##The data > >ce <- c(15.17, 42.15, 69.12, 237.7, 419.77) > >qe <- c(17.65, 30.07, 65.36, 81.7, 90.2) > > > >##The linearized data > >celin <- 1/ce > >qelin <- 1/qe > > > >plot(ce, qe, xlim = xlim, ylim = ylim) > > > >##The linear model > >fit1 <- lm(qelin ~ celin) > >intercept1 <- fit1$coefficients[1] > >slope1 <- fit1$coeffecients[2] > >summary(fit1) > > > >Qmax <- 1/intercept1 > >Kl <- .735011*Qmax > > > >xlim <- range(ce, celin) > >ylim <- range(qe, qelin) > > > >abline(lm(qelin ~ celin)) > > > >c <- seq(min(ce), max(ce)) > >q <- (Qmax*Kl*c)/(1+(Kl*c)) > > > >lines(c, q) > > > > > >##My attempt at the nonlinear regression > >fit2 <- nls(qe ~ ((Qmax*Kl*ce)/(1+(Kl*ce))), start = list(Qmax = Qmax, > >Kl > >Kl)) > >results <- fit2$m$getpars() > >Qmax2 <- fit2$m$getpars()[1] > >Kl2 <- fit2$m$getpars()[2] > >summary(fit2) > > > >-Timothy >[[alternative HTML version deleted]]