On Mon, 6 Nov 2023 14:55:39 -0500
J C Nash wrote:
> However, I'm wondering if this approach is worth writing up, at least
> as a vignette or blog post. It does need a shorter example and some
> explanation of the "why" and some testing perhaps.
Do you mean using this problem as a basis to
G'day Troels,
On Tue, 7 Nov 2023 07:14:02 +0100
Troels Ring wrote:
> Be as it may, I wonder if not your method might work if only we KNOW
> that pK1 is either positive OR negative, in which case we have pK1 =
> -exp(theta1)?
If pK1 can be either negative or positive (or 0 :-) ), and it is just
Thanks a lot, Berwin. Unfortunately, pK1 may well be negative and as I
understand the literature it may be poorly defined as such, and also
seems to be at a boundary, since when lower is set to say rep(-4,3) pK1
is returned as -4 while pK2 and pK3 are undisturbed. Perhaps the point
is that pK1
G'day Troels,
On Mon, 6 Nov 2023 20:43:10 +0100
Troels Ring wrote:
> Thanks a lot! This was amazing. I'm not sure I see how the conditiion
> pK1 < pK2 < pK3 is enforced?
One way of enforcing such constraints (well, in finite computer
arithemtic only "<=" can be enforced) is to rewrite the
I won't send to list, but just to the two of you, as I don't have
anything to add at this time. However, I'm wondering if this approach
is worth writing up, at least as a vignette or blog post. It does need
a shorter example and some explanation of the "why" and some testing
perhaps.
If there's
Thanks a lot! This was amazing. I'm not sure I see how the conditiion
pK1 < pK2 < pK3 is enforced? - it comes from the derivation via
generalized Henderson-Hasselbalch but perhaps it is not really
necessary. Anyway, the use of Vectorize did the trick!
Best wishes
Troels
Den 06-11-2023 kl.
Your script is missing something (in particular kw).
I presume you are trying to estimate the pK values. You may have more success
with package nlsr than nls(). nlsr::nlxb() tries to get the Jacobian of the
model specified by a formula and do so by applying symbolic or automatic
differentiation.
В Mon, 6 Nov 2023 17:53:49 +0100
Troels Ring пишет:
> Hence I wonder if I could somehow have non linear regression to find
> the 3 pK values. Below is HEPESFUNC which delivers charge in the
> fluid for known pKs, HEPTOT and SID. Is it possible to have
> root-finding in the formula with nls?
I have a fair bit of experience with both nls and rating curves. This is
not a nls() problem, this is a model problem. The power law rating curve
favored by hydrologists would not apply to your data as it's based on
the idea that a log-log plot of discharge vs. stage, or state+a in your
case
If you insist on using nls() for anything that you don't understand
extremely well, you will end up with frustration. nls() uses the same
method K F Gauss used (with good understanding of the details) over
200 years ago. The Gauss-Newton approach inside works very well and
efficiently for
Hi
I am not an expert in nonlinear regression, but your data seems to be rather
weird. Last five points has almost linear relationship, the first one is
several times higher. If there is no error in your data, I doubt that you can
model it by power equation.
Cheers
Petr
> -Original
Thank you for the tip. Indeed, nlxb in nlmrt works and results are not
crazy.
I would like however to assess goodness-of-fit (gof) and ultimately to
compare it with gof from linear regression (fitted with same variables).
Before I used AICc to compare the nls() and lm() fit, however I get
Packages nlmrt or minpack.lm use a Marquardt method. minpack.lm won't
proceed if the Jacobian singularity is at the starting point as far as
I'm aware, but nlxb in nlmrt can sometimes get going. It has a policy
that is aggressive in trying to improve the sum of squares, so will use
more effort
These appear to be primarily statistics/nonlinear optimization issues
that are off topic here, which is about R programming. Post on a
statistics list like stats.stackexchange.com instead.
Cheers,
Bert
Bert Gunter
Data is not information. Information is not knowledge. And knowledge
is
Could you provide the code that you're running, so we can see what
you're trying to do? Even better would be a repeatable example.
Jeremy
On 19 December 2012 09:42, Yann Labou yann.la...@outlook.com wrote:
Hey all,
I'm trying to fit a non-linear model y ~ a * constant ^ b * x ^ c and
Jeremy:
Don't be silly. The model is overdetermined -- a and b tradeoff with each
other. e.g. for any solution (a,b), (a/k^m,b+m) for any m is also a
solution, where k = const (assuming I have correctly interpreted the model,
of course).
-- Bert
On Wed, Dec 19, 2012 at 11:59 AM, Jeremy Miles
Apologies for the phrasing of the question.
I've sorted the problem (thanks Bert Gunter) by using the curly brackets {}
as below (using a simplified version of my real model). I hope this helps
someone else!
Jeff
---
data
Alpha ip X
1 0.7106967
Your question is (completely) ill-posed. What is your actual
model? What you have said makes no sense at all as it stands.
(Minimal self-contained example .)
cheers,
Rolf Turner
On 28/02/12 09:25, jeff_hawkes wrote:
Hi all,
Is it possible to model a function where the
Hi:
Perhaps the self-starting functions may be helpful. See ?selfStart.
There are self-starting functions for both the logistic and Gompertz
models (SSlogis and SSgompertz, respectively). Go through the examples
to see how they work.
HTH,
Dennis
On Fri, Jun 17, 2011 at 2:14 PM, Sean Bignami
On Jun 17, 2011, at 23:14 , Sean Bignami wrote:
I am trying to fit a curve to a cumulative mortality curve (logistic) where y
is the cumulative proportion of mortalities, and t is the time in hours (see
below). Asym. at 0 and 1
y
[1] 0. 0.04853859 0.08303777 0.15201970 0.40995074
On 2011-04-11 13:29, Felix Nensa wrote:
Hi,
I am using nls to fit a non linear function to some data but R keeps giving
me singular gradient matrix at initial parameter estimates errors.
For testing purposes I am doing this:
### R code ###
x- 0:140
y- 200 / (1 + exp(17 - x)/2) * exp(-0.02*x)
Hi Peter,
thank you for your reply. Now I see, that P3 is indeed redundand.
But with the simplified model...
fit = nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x))
...nls still produces the same error.
Any ideas?
Felix
2011/4/12 Peter Ehlers ehl...@ucalgary.ca
On 2011-04-11 13:29, Felix
Use a more realistic starting point instead of the default one:
fit - nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x),
start=list(p1=410,p2=18,p4=-.03))
This works for me:
fit
Nonlinear regression model
model: yeps ~ p1/(1 + exp(p2 - x)) * exp(p4 * x)
data: parent.frame()
p1
Hi Mario,
yes works great. Thanks!
2011/4/12 Mario Valle mva...@cscs.ch
Use a more realistic starting point instead of the default one:
fit - nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x),
start=list(p1=410,p2=18,p4=-.03))
This works for me:
fit
Nonlinear regression model
model:
Thanks a lot, this I(xx^2) ... worked.
I guess, I should learn more abot the function poly itself. (so will I... :)
)
Thanks again!
--
View this message in context:
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2325911.html
Sent from the R help mailing list archive
I've tried lm, but something is wrong.
I've made a test dataset of 599 data points, my original equation is
zz = 1 +0.5*xx -3.2*xx*xx -1*yy +4.2*yy*yy
but the R gives this result:
---
mp - read.csv(file=sample.csv,sep=;,header=TRUE)
lm(zz ~
right. How does it come that if I devide the result vector with
10*interception, I get a much better result?
zz2 - 25.86 -2239.86*mp$xx -595.01*mp$xx*mp$xx + 2875.54*mp$yy +
776.84*mp$yy*mp$yy
mp$zz2 - zz2
library(lattice)
cloud(zz2/258.6 + zz ~ xx * yy, data=mp)
looks quite pretty.
On 12/08/2010 10:35 AM, szisziszilvi wrote:
I've tried lm, but something is wrong.
I've made a test dataset of 599 data points, my original equation is
zz = 1 +0.5*xx -3.2*xx*xx -1*yy +4.2*yy*yy
but the R gives this result:
---
mp -
On 11/08/2010 6:15 AM, szisziszilvi wrote:
Hello!
Is there a simplier way in R to get a nonlinear regression (like nls) for a
surface? I have 3D data, and it is definitely not a linear surface with
which it would fit the best. Rather sg like z = a + f(x) + g(y) where
probably both f and g are
oh, god, please don't tell anybody...
--
View this message in context:
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2321082.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing
It appears my suspicions about this being homework were unfounded.
Given the additional problems with excess zeroes, you may want to
examine the extremely informative material on analysis of such
problems written by Zeileis, Kleiber and Jackman:
(easily found in case you have misplaced it,
On Feb 6, 2010, at 10:33 PM, kupz wrote:
So I have a data set I would like to model using a non-linear
method. I know
it should be an exponential decay. However I know what the first
derivative
of the equation should be at two points, x=0 and x=100. Is there
anyway to
establish this
Agreed, it would be simple to propose the relationship, however the
regression is necessary to model the data properly. Unfortunately a simple
decay based on those two points does not have the proper shape necessary.
This is due to an extreme amount of zero inflation with this fisheries data.
-project.org
Sent: Thursday, December 10, 2009 9:55 PM
Subject: Re: [R] non-linear regression
You did not provide the data or a way of generating it.
I would guess that Excel finds the same solution (the same residual sum-of
squares) as nls but that it uses a weak convergence criterion and/or does
=list(A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,K=0))
HP
matplot(cbind(log(fitted(HP)), log(tx.br)),type=l)
- Original Message -
From: Katharine Mullen k...@few.vu.nl
To: AneSR citb...@terra.com.br
Cc: r-help@r-project.org
Sent: Thursday, December 10, 2009 9:55 PM
Subject: Re: [R] non-linear
You did not provide the data or a way of generating it.
I would guess that Excel finds the same solution (the same residual sum-of
squares) as nls but that it uses a weak convergence criterion and/or does
not give you information regarding why it terminates.
Regarding the step size: you can set
Hi and thank you for your reply,
in my new regression formular the parameter delta is inserted:
fit - nls(dataset$V2~(( alpha / ( 1 + exp( beta - gamma* dataset$V1 ) )
) + (dataset$V6*delta)),data=dataset,start=startparam)
The sense is, that dataset$V6 is a dummy variable that represents the
Those are linear in the coefficients so try these:
library(quantreg)
rq1 - rq(demand ~ Time + I(Time^2), data = BOD, tau= 1:3/4); rq1
# or
rq2 - rq(demand ~ poly(Time, 2), data = BOD, tau = 1:3/4); rq2
On Tue, Jun 9, 2009 at 10:55 AM, despairedmeyfa...@uni-potsdam.de wrote:
Hi,
I'm
Hi,
thanks, it works :-)
But where is the difference between demand ~ Time + I(Time^2) and demand ~
poly(Time, 2) ?
Or: How do I have to interpret the results? (I get different results for the
two methods)
Thank you again!
Gabor Grothendieck wrote:
Those are linear in the coefficients so
: Tuesday, June 09, 2009 11:59 AM
To: r-help@r-project.org
Subject: Re: [R] Non-linear regression/Quantile regression
Hi,
thanks, it works :-)
But where is the difference between demand ~ Time + I(Time^2) and demand ~
poly(Time, 2) ?
Or: How do I have to interpret the results? (I get different
-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of despaired
Sent: Tuesday, June 09, 2009 9:59 AM
To: r-help@r-project.org
Subject: Re: [R] Non-linear regression/Quantile regression
Hi,
thanks, it works :-)
But where is the difference between demand ~ Time + I(Time^2) and
demand
.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of despaired
Sent: Tuesday, June 09, 2009 9:59 AM
To: r-help@r-project.org
Subject: Re: [R] Non-linear
If you have the RSiteSearch package installed, you can do the
following:
library(RSiteSearch)
nrow(nll - RSiteSearch.function(nonlinear regression with latent))
HTML(nll)
This just produced 8 hits for me. If this doesn't solve your
problem, you might try other search terms. If
Thank you! It worked perfectly, also for the other variables!
Messaggio originale
Da: r...@life.ku.dk
Data: 06.02.2009 13.29
A: lauramorg...@bluewin.ch
Oggetto: Re: [R] non linear regression with nls
Hi Laura,
I think you have to make a list formulas:
formList - list(NT.N ~ fz1
A: lauramorg...@bluewin.ch
Oggetto: Re: [R] non linear regression with nls
Hi Laura,
I've the following suggestion for you using several lists and a for loop:
fz1-function(Portata, a, b){a+b/Portata}
fz2-function(Portata, a, b){a*exp(b*Portata)}
fz3-function(Portata, a, b, d, e){a+b/Portata+d*(Portata^e
can someone specify the groups/subset?
Thanks a lot!
Laura
Messaggio originale
Da: kfr...@wisc.edu
Data: 03.02.2009 15.36
A: lauramorg...@bluewin.ch
Oggetto: Re: [R] non linear regression with nls
Hi, Laura-
You might have a look at ?nlsList().
Ken
- Original Message -
From
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
On Wed, 2008-01-16 at 11:02 +0100, Janice Kielbassa wrote:
Hello!
I want to do a non-linear regression with 2 explanatory variables
(something like : length ~ a * time * exp( b* temperature)), having a
data set (length, time, temperature).
Gavin Simpson wrote:
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
On Wed, 2008-01-16 at 11:02 +0100, Janice Kielbassa wrote:
Hello!
I want to do a non-linear regression with 2 explanatory variables
(something like : length ~ a * time * exp( b* temperature)), having a
data set (length,
I have never had much success in using nls(). If you scan the archives
you will find one or two postings from me on this topic. I have
received
no useful responses to these postings.
I have found that anything that I tried (and failed) to do using nls()
could be done quite easily using
Dear Rolf,
One thing that sometimes makes nls easier to apply is using the 'formula'
argument like you would use the 'fn' argument of optim. That is, if you
have a residual function that has arguments x, y, a, b and you need to
optimize a and b, you would make a call like
50 matches
Mail list logo