Displaying 20 results from an estimated 20000 matches similar to: "nls: formula error?"
2006 Sep 29
1
linear gradient in nls
Hello,
I hope this doesn't turn into a statistics question but here I
go. I am using the nls function with a Gaussian distribution, see coding
below. When I run the nls I get an error back saying that I have a linear
gradient. I then, of course am unable to do anything else. The data that I
am using are intensity values from some mass spectrometry data. Is there
something I can
2006 Jun 13
1
plotting gaussian data
Ok I guess it's time to ask.
So I want to plot my data. It's my data from a frequency table, "temp". My
formula is just a Gaussian eq. I have done the nls function to get my
parameters and now I want to do the whole plot (...) and then lines(..)
This is what I have done.
> temp
bin x
1 -4.0 0
2 -3.9 0
3 -3.8 0
4 -3.7 0
5 -3.6 0
6 -3.5 0 .... and so
2007 Jan 19
3
if else statement
Hello,
I'm doing some scripting and I've noticed that R doesn't seem to
have an
if (cond){
do
}ifelse (cond) {
do
} else {
do
}
type block.
Is this correct or am I missing something.
THX
Paul
--
Research Technician
Mass Spectrometry
o The
/
o Scripps
\
o Research
/
o Institute
2004 Oct 25
1
Scoping and nls.
A colleague of mine is trying to use nls() to effect an optimization,
and is encountering a scoping problem. I should know how to solve it
for him but .... well, I just don't.
I also had a quick scrounge of the archives --- I know I've seen this
topic addressed before --- but I couldn't track it down.
So here's a toy example that demonstrates the problem:
hhh <-
2006 Feb 07
1
sampling and nls formula
Hello,
I am trying to bootstrap a function that extracts the log-likelihood value and the nls coefficients from an nls object. I want to sample my dataset (pdd) with replacement and for each sampled dataset, I want to run nls and output the nls coefficients and the log-likelihood value.
Code:
x<-c(1,2,3,4,5,6,7,8,9,10)
y<-c(10,11,12,15,19,23,26,28,28,30)
pdd<-data.frame(x,y)
2009 Aug 10
1
manipulating text to generate different formulas to use in nls()
Hello,
In doing a series of non-linear estimations of a function which is a sum of a varying number
of sinusoids, I would like to "autogenerate" the arguments needed by nls() depending on that
number.
For example, when there are two sinusoids:
> nls( y ~ mu + A1 * cos(2*pi*f1*x - P1) + A2 * cos(2*pi*f2*x - P2), data = some.xy.data,
start = list( mu=some.value0,
2006 Nov 29
3
better define: matrix comparison and cbind issue
Hello,
Sorry to all for the lack of communication, and thanks to those with the
suggestions.
So I have two matrixes which are different sizes, same column number but
different row number.
What I would like to do is to compare A to B. In the 6 and 9th column there
are ref numbers (molecular masses to be exact). I would like to check A and
B by these columns. If I find that the number in A[9,x]
2000 Nov 03
2
nls() function is not found (PR#725)
Full_Name: Michael Montero
Version: 1011
OS: NT4.0
Submission from: (NULL) (128.32.148.191)
I haven't been able to use the nls() function because of the following error:
Error in eval.with.vis(expr, envir, enclos) :
couldn't find function "nls"
Apparently nls() is no where to be found, in the /library directory nls exists
with all its files..
need help..
thanks
2009 Sep 21
1
How to use nls when [selfStart] function returns NA or Inf??
Hi Everyone,
I posted this a couple of weeks ago with no responses. My interface (via
gmane) seemed a bit flakey at the time, so I'm venturing to repost with some
additional information.
I'm trying to write selfStart non-linear models for use with nls. In these
models some combinations of parameter values are illegal; the function value
is undefined.
That's OK when calling the
2020 Oct 17
2
??? is to nls() as abline() is to lm() ?
I'm drawing a fitted normal distribution over a histogram. The use case is trivial (fitting normal distributions on densities) but I want to extend it to other fitting scenarios. What has stumped me so far is how to take the list that is returned by nls() and use it for curve(). I realize that I can easily do all of this with a few intermediate steps for any specific case. But I had expected
2007 Jun 18
2
data type for block data?
Dear All,
I have a matrix with data that is not organised. I would like to go
through this and extract it. Each feature has 2 vectors which express
the data. I also have an index of the places where the data should be cut.
eg.
>class(cc)
"matrix"
>cc
[,1] [,2]
[1,] 1 26
[2,] 2 27
[3,] 3 28
[4,] 4 29
[5,] 5 30
[6,] 6 31
[7,] 7 32
2008 Jun 10
3
newbie nls question
I'm tyring to fit a relatively simple nls model to some data, but keep coming up against the same error (code follows):
Oto=nls(Otolith ~ Linf*(1-exp(-k(AGE-to))),
data = ages,
start = list(Linf=1000, k=0.1, to=0.1),
trace = TRUE)
The error message I keep getting is "Error in eval(expr, envir, enclos) : could not find function "k"". I've used this
2007 Aug 28
4
Nodes & edges with similarity matrix
Hello,
I apologise if someone has already answered this but I searched and
googled but didn't find anything.
I have a matrix which gives me the similarity of each item to each
other. I would like to turn this matrix into something like what they
have in the graph package with the nodes and edges.
http://cran.r-project.org/doc/packages/graph.pdf . However I cannot find
a method to
2020 Oct 17
0
??? is to nls() as abline() is to lm() ?
I haven't followed your example closely, but can't you use the predict()
method for this? To draw a curve, the function that will be used in
curve() sets up a newdata dataframe and passes it to predict(fit,
newdata= ...) to get predictions at those locations.
Duncan Murdoch
On 17/10/2020 5:27 a.m., Boris Steipe wrote:
> I'm drawing a fitted normal distribution over a
2012 May 02
2
Problem with 'nls' fitting logistic model (5PL)
Dear R-Helpers,
I'm working with immunoassay data and 5PL logistic model. I wanted to
experiment with different forms of weighting and parameter selection,
which is not possible in instrument software, so I turned to R.
I am using R 2.14.2 under Win7 64bit, and the 'nls' library to fit the
model - I started with the same model and weighting type (1/y) as in the
instrument to see
2006 Jun 13
3
if syntax error :(
Umm sorry to bother everyone again but I'm having trouble with my if
statement. I come from a perl background so that's probably my problem! :)
So here is my code:
if (any(lgAB>4) | any(lgAB<-4)){
freq_AB<-hist(lgAB, type="o", plot=F)
else
freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
}
And I get
> source("E:/R/GMDA-1.1.R")
Error in
2007 Oct 24
1
Error in nls model.frame
Error in model.frame
When I run the following nls model an error message appears and I dont
know how to solve that. Could you help me??
mat = c(1,2,3,4,5,6,7,8,9,12,16,24,36,48,60)
for (i in 1:length(j30)) {
bliss = nls(c(j[i,1:length(mat)]) ~ b0 + b1*((1-exp(-k1*mat))/(k1*mat)) +
b2*(((1-exp(-k2*mat))/(k2*mat))-exp(-k2*mat)),
start = list(k1=0.1993, k2=0.1993, b0= 22.0046,
2007 Apr 24
2
negative number to positive number
Hello all,
I know this is a pretty easy question but I can't find it in S poetry or
R help.
How can I make a negative number positive. Such as
-5 to be +5
I tried +(-5), but that didn't work.
So no, I don't mean taking a -5^2 just to get a positive number.
This is in a function so it's not just -5 it's x. :)
Thanks,
Paul
--
Research Technician
Mass Spectrometry
o The
2005 Aug 03
1
passing variable to formula environment
List gurus,
I'm trying to code a Gompertz growth curve function as part of a larger
project and have run across a problem due to my ignorance of
environments. Some sample data and the function are as follows:
growth <- data.frame(age = c(1.92, 3, 5.83, 3.17, 15.5, 1.17, 5.58,
13.33, 14.29, 5.83, 13.79, 6.33, 13.75, 16.83, 13, 11.67, 0.25, 1.73,
9.46, 5.67), length = c(157, 165, 179,
2011 Jun 20
2
Model Formulae Evaluation
Hello All,
I have searched but haven't been able to find an answer to this question.
I'm writing a function that needs to be able evaluate the right-hand side of
a general non-linear formula for different parameter values, similar to what
nls() does. I looked through the nls() code but it isn't clear what is going
on. Could someone point me to a reference or a way I might do this?