<[email protected]> wrote in message
news:[email protected]...
> For nls, the fixing (or masking) of parameters is not, to my knowledge,
> possible.
>
> This is something I've been trying to get in such routines for over 2
> decades. Masks are
> available, but not yet well documented, in Rcgmin and Rvmmin packages.
> However, these use
> an optim() style approach, which is quite different from nls(). If there's
> sufficient
> interest and some collaboration, I'd be willing to have a go at providing
> such
> functionality, but it would take quite a bit of work to provide the full
> capability of nls().
>
> JN
>
Thanks for that. It would be burdensome to move away from nls, a lot of my
functions depend on nls-like properties of fitted objects.
I'm considering 'fixing' nls by creating a 'wrapper' with the same name to:
a) if start is unspecified, call getInitial
b) call 'vanilla' nls with start restricted to 'non-fixed' terms,
something like...
-----------------
nls <- function(formula, data=parent.frame(), start, ...){
if missing(start) start <- getInitial(formula, data)
stats:::nls(formula, data, start=start[names(start) %in%
all.vars(formula)], ...]
}
----------------------
The getInitial values will be calculated ignoring the fact that some
parameters are 'fixed' (unless the particular 'initial' attribute is very
clever!), but they shouldn't be too bad, and I don't really see a practical
alternative way of getting the required starting values.
I think this will work, but I'm very doubtful if it will work reliably.
Issues that concern me include:
a) How will 'data=parent.frame()' behave?
I've had troubles before with scope and nls!
b) Will other callers of nls (e.g. nlme:::nlsList) call mine or the
original?
Search list is something like
[1]".GlobalEnv" [n]mine [n+l]"package:nlme" [n+l+m]"package:stats"
Any comments?
Thanks in advance,
Keith J
______________________________________________
[email protected] 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.