Displaying 1 result from an estimated 1 matches for "second_deriv".
2006 Aug 24
1
Optim question
...starting value
for theta
rasch <- function(theta,b) 1/ (1 + exp(b-theta))
old <- 0
updated <- 5
while(abs(old-updated) > .001){
old <- updated
for(k in seq(along=b_vector)) p[k] <- rasch(theta,b_vector[k])
first_deriv <- sum(x) - sum(p)
second_deriv <- sum((1-p)*-p)
change <- (first_deriv/second_deriv)
theta <- theta - change # This is the updated theta
updated <- change
}
cat('theta is about', round(theta,2), ', se', 1/sqrt(-second_deriv),
'\n')
}
Harold
> vers...