Message-ID: <OF9043DEFD.5D5F1185-ONC1257568.00475AC1-C1257568.004A15C2@precheza.cz>
Date: 2009-02-25T13:30:09Z
From: PIKAL Petr
Subject: nls and start values evaluation
Dear all
I have troubles with correct evaluating/structure of nls input
x<-1:10
y<-1/(.5-x)+rnorm(10)/100
form <- structure(list(a = list(quote(y ~ 1/(a - x)), "list(a=mean(y))")),
.Names = "a")
This gives me an error due to not suitable default starting value
fit <- nls(form [[1]] [[1]], data.frame(x=x, y=y))
This works and gives me a result
fit <- nls(form [[1]] [[1]], data.frame(x=x, y=y), start=list(a=mean(y)))
How to organise list "form" and call to nls to enable to use other then
default starting values.
I thought about something like
fit <- nls(form [[1]] [[1]], data.frame(x=x, y=y), start=get(form [[1]]
[[2]]))
but this gives me an error so it is bad function. (BTW I tried eval,
assign, sustitute, evalq and maybe some other options but did not get it
right.
I know I can put starting values interactively but what if I want them
computed by some easy way which is specified by second part of a list,
like in above example.
If it matters
WXP, R2.9.0 devel.
Regards
Petr