David> Is there an easy way to put a bound on a parameter in a
David> nls model?
Sometimes, but you have to do it with the parameterization. rather
than with some option in the fitting function.
David> I have a fairly straightforward nonlinear model of the
David> following form:
David> nls( Thickness ~ B + S*exp(-D*t))
David> where B, S, and D are the parameters of interest. We want
David> to put a bound on B, so it never drops below a certain
David> level, say 400.
David> Any ideas?
Try a parameterization such as
> fm <- nls( Thickness ~ 400 + B0^2 + S*exp(-D*t))
That is, your parameter B is represented as (400 + B0^2). If you
want a standard error for B (rather than B0) you still have a bit
of a problem, especially if B0 is estimated as 0 (but in this
case a standard error doesn't mean much, anyway).
You could also try something like B = 400 + exp(B0), but then if
your least squares estimate of B is at the boundary, the estimate
of B0 will wander off towards minus infinity.
Bill