Hi
While trying to simplify the model to create a small reproducible example I
have found my error.
Previously in order to try and solve another problem, I had changed my Model
function. However I had made a mistake in doing this and caused the function to
always output 0. Fixing this error has now fixed the error and brought me back
to the original problem.
I now get:
singular gradient matrix at initial parameter estimates
It is a very complex model so I am unsure how to fix this yet, but I am going
to try and use the brute-force algorithm from nls2.
Thanks for the help.
Matthew
Date: Wed, 1 Aug 2012 16:18:07 -0700
From: ml-node+s789695n4638799...@n4.nabble.com
To: matthew_...@hotmail.com
Subject: Re: R_nls_iter error: REAL() can only be applied to a 'numeric', not a
'logical'
On Wed, Aug 1, 2012 at 11:40 AM, matthewbk [hidden email] wrote:
Hi
I am using the nls function in R however it is causing the following error:
REAL() can only be applied to a 'numeric', not a 'logical'
Using traceback shows this occurs after the .Call(R_nls_iter, m, ctrl,
trace) call. However I do not know how to debug this further to find out
what is causing the error.
The data I give the nls call definitely starts as numeric. The data.frame is
generated by using the following:
d = data.read('data.csv', header=FALSE)
x = as.numberic(d[,1])
y = as.numberic(d[,2])
z = as.numberic(d[,3])
...
Certainly no b ?
dat = data.frame(x,y,z...)
nls is started by calling:
mdl = nls(y ~ Model(x,y,z,b1,b2,b3), data = dat)
Thanks in advance for any help.
Matthew
This one's actually tricky since that's an error arising from the C
code. I don't think there's an error in the C code, but let's do some
work on debugging. To start with, can you make a small reproducible
example following the advice given here:
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
To wit, we don't have your dat data (use dput! but please, only a
small-ish subset) nor the function Model and the lines of code
replaced by ... worry me as well.
Best,
Michael
--
View this message in context:
http://r.789695.n4.nabble.com/R-nls-iter-error-REAL-can-only-be-applied-to-a-numeric-not-a-logical-tp4638717.html
Sent from the R help mailing list archive at Nabble.com.
__
[hidden email] mailing list
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.
__
[hidden email] mailing list
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.
If you reply to this email, your message will be added to the
discussion below:
http://r.789695.n4.nabble.com/R-nls-iter-error-REAL-can-only-be-applied-to-a-numeric-not-a-logical-tp4638717p4638799.html
To unsubscribe from R_nls_iter error: REAL() can only be
applied to a 'numeric', not a 'logical', click here.
NAML
--
View this message in context:
http://r.789695.n4.nabble.com/R-nls-iter-error-REAL-can-only-be-applied-to-a-numeric-not-a-logical-tp4638717p4638849.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
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.