A slight glitch got-in during the copy and past.
The part below that says,
ms.curv(dd.nls.d4)
Parameter effects: c^theta x sqrt(F) = 0.0123
Intrinsic: c^iota x sqrt(F) = 0.0068
should read,
rms.curv(dd.nls.d4)
Parameter effects: c^theta x sqrt(F) = 0.0123
Intrinsic: c^iota x s
I have found a way to approach the question that I posed, that is
having deriv and deriv3 deal with an indexed term in the formula.
Unless, there is a more direct approach (and my minimal investigation
of the code involved suggested that it would not be simple to implement,
for me at least), this s
You ask "whether there would be a way to adapt the deriv and
deriv3 functions to deal with formulas that have an indexed term",
effectively allowing differentiation with respect to a vector. As Simon
Blomberg famously said, "This is R. There is no if. Only how."(*)
The implementati
I don't know why I get a different result than you do, though I'll
play around with it some and check the code to see if I can figure
out what is going on, on my end.
I will add that by transforming GL so that it spans the interval [0, 1]
instead
of [0, 255], the correlations among the parameters
I mixed up examples. Here it is again. As with the last one
confint(dd.plin) gives an error (which I assume is a problem with
confint that needs to be fixed) but other than that it works without
issuing errors and I assume you don't need the confint(dd.plin)
in any case since dd.plin is just bein
This works for me in terms of giving results without error messages
except for the confint(dd.plin) which I assume you don't really need anyways.
> gg <- model.matrix(~ Gun/GL - Gun, dd)
> dd.plin <- nls(Lum ~ gg^gamm, dd, start = list(gamm = 2.4),
+alg = "plinear"
Sorry, a slight glitch got in because I subsetted the original data frame.
The last part, that works should read:
dd.nls.d2 <- nls(Lum ~ dd.deriv2(Blev, beta, gamm, GL), data = dd,
start = list(Blev = B[2], beta = B[3:5], gamm = B[1]))
#But not here
confint(dd.nls.d2)
Thank you for your rapid response.
This is reproducible on my system. Here it is again, with, I hope,
sufficient detail to properly document what does not work and what
does on my system,
But my original question, properly motivated or not, concerns whether
there is a way to use or adapt deriv()
Please provide reproducible code which shows the error.
> dd <- structure(list(Lum = c(0.15, 0.07, 0.1, 0.19, 0.4, 0.73, 1.2,
+ 1.85, 2.91, 3.74, 5.08, 6.43, 8.06, 9.84, 12, 14.2, 16.6, 0.1,
+ 0.1, 0.17, 0.46, 1.08, 2.22, 3.74, 5.79, 8.36, 11.6, 15.4, 19.9,
+ 24.6, 30.4, 36.1, 43, 49.9, 0.06, 0.06
Hi,
I'm fitting a standard nonlinear model to the luminances measured
from the red, green and blue guns of a TV display, using nls.
The call is:
dd.nls <- nls(Lum ~ Blev + beta[Gun] * GL^gamm,
data = dd, start = st)
where st was initally estimated using optim()
st
$Blev
10 matches
Mail list logo