Hi
I am trying to use the deriv and eval functions to obtain the value of a
function , say "xi-(alpha0+alpha1*gi)" , differentiated with respect to
alpha0 and alpha1, in the following way
# for gi = 0
> dU1dtheta <- deriv(~ xi-(alpha0+alpha1*gi), c("alpha0","alpha1"))
> eval(dU1dtheta)
(Intercept)
-0.2547153
attr(,"gradient")
alpha0 alpha1
[1,] -1 0
I want to extract the output gradient values of -1 and 0 but I don't
know how to access them. The only thing I can access is the intercept
term via.
> eval(dU1dtheta)[1].
I'm sorry if this is too basic a question for the list, but any help
would be greatly appreciated
Jack
--
Dr Jack Bowden
MRC Biostatistics Unit
Institute of Public Health
Forvie Site
Robinson Way
Cambridge
CB2 0SR
Tel: (01223) 330385
______________________________________________
R-help@r-project.org 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.