Displaying 1 result from an estimated 1 matches for "derfs4".
2007 Mar 02
2
nlm() problem : extra parameters
...e my own code,
Newton-Raphson converged in three iterations using both the gradient
and the Hessian and the starting values given below. But I can't
get nlm() to work! I would much appreciate any help.
> x
[1] 10.2 7.7 5.1 3.8 2.6
> y
[1] 9 8 3 2 1
> n
[1] 10 9 6 8 10
derfs4=function(b,x,y,n)
{
b0 = b[1]
b1 = b[2]
c=b0+b1*x
d=exp(c)
p=d/(1+d)
e=d/(1+d)^2
f = -sum(log(choose(n,y))-n*log(1+d)+y*c)
attr(f,"gradient")=c(-sum(y-n*p),-sum(x*(y-n*p)))
attr(f,"hessian"...