[R] nls Error Message - Singular Gradient Matrix

2011-06-09 Thread cahulme-lowe
I've been trying to run some analysis using the nls function in R but keep 
coming up with an error message which I don't understand how to fix. The 
message follows here:

Error in nls(formula = f.p, data = n.data, start = list(S = 1, a = -0.1, : 

  singular gradient
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

 


I did take a look at the archives before positing this and noticed that 
there was a similar message from a few years ago. The solution there 
seemed to be to change the algorithm to plinear. I've tried this to no 
avail. Unfortunately I'm not in a position where I can share the data I'm 
using, but will copy my code below. What I can say is that there are 
relatively few observations - only 12 - compared to the number of 
parameters. Could this be causing the error I'm seeing? Is there anything 
else that might be causing it? Any insight would be greatly appreciated!

Chris.

Code:

data - read.csv(choose.files(),header=TRUE)
adoption - data[,3]
year - data[,2]
time - data[,1]
cum.adoption - data[,4]
plot(data[,2],data[,3],xlab=Year,ylab=Adoption,main=Greek Cell Phone 
Adoption 1994 - 2005 Q3,type=b)
plot(data[,2],data[,4],xlab=year,ylab=Cumulative Adoption,main=Greek 
Cell Phone Adoption 1994 - 2005 Q3,type=b)
start.val - c(n=1.17,p=0.001,q=0.626)
bass - nls(formula=data[,3] ~ p*n+(q-p)*data[,5]-(q/n)*data[,5]^2,
data=n.data,
start=start.val)
start.val - c(S=1,a=1,b=1)
f.p - cum.adoption~S/(1+exp(-a+b*time))
fisher.pry - nls(formula = f.p,
  data = n.data,
  start= list(S=1,a=-0.1,b=0.1),
  alg = plinear,
  trace=TRUE)
[[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.


Re: [R] nls error message

2009-12-29 Thread Uwe Ligges



Jim Bouldin wrote:

When I try to run the following non-linear regression with  variables
index1 and prl3:


beta = 4
nls(index1~beta*(1/prl3),start = list(beta = 4))


I get this error message:

Error in nls(index1 ~ beta * (1/prl3), start = list(beta = 4)) : 
  REAL() can only be applied to a 'numeric', not a 'logical'


Please see the posting guide.  For reproducibility, we'd need prl3 and 
index1.




I've got no clue as to the REAL() to which this is referring.  Any help
appreciated. Thanks in advance.


Try traceback().

Uwe Ligges




Jim Bouldin
Research Ecologist
Department of Plant Sciences, UC Davis
Davis CA, 95616
530-554-1740

__
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.


__
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.


[R] nls error message

2009-12-28 Thread Jim Bouldin

When I try to run the following non-linear regression with  variables
index1 and prl3:

 beta = 4
 nls(index1~beta*(1/prl3),start = list(beta = 4))

I get this error message:

Error in nls(index1 ~ beta * (1/prl3), start = list(beta = 4)) : 
  REAL() can only be applied to a 'numeric', not a 'logical'

I've got no clue as to the REAL() to which this is referring.  Any help
appreciated. Thanks in advance.


Jim Bouldin
Research Ecologist
Department of Plant Sciences, UC Davis
Davis CA, 95616
530-554-1740

__
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.