[R] asymptotic convergence intervall for poisson regression
soxx
c1schwar at edu.uni-klu.ac.at
Wed Apr 8 08:54:43 CEST 2009
Hello!
The following code is an implementation of a Poisson regression. It
generates some data-samples and computes the beta values with the negative
log likelihood function.
Now, my task is to compute the asymptotic convergence intervalls for the
values of beta but I dont know how to implement this function - this topic
is not in my lecture notes.
I hope someone can help me.
> library(Bhat)
> # generate new data
> dose <- c(rep(0,50), rep(1,50), rep(5,50), rep(10,50))
> data <- cbind(dose, rpois(200,2*(1+(10-dose)
*.5*(1-(10-dose)*0.05))))
> data
> lambda <- function(dose)
> {
> 2*(1+(10 - dose) * .5 * (1-(10-dose)*0.05))
> }
> plot(c(0:10),lambda(c(0:10)))
> # estimated count of fits - dose 0:10
> plot (data[,1] + rnorm(200, mean=0, sd=0.15), data[,2])
> # Likelihood - function
> negloglike <- function(beta)
> {
> ds <- data[,1]
> x <- data[,2]
> lambda <- beta[1] * (1 + ( 10 - ds )
* beta[2] * (1 - (10 - ds) * beta[3]))
> return(sum(lambda - x * log(lambda)))
> }
> beta <- list(label = c("beta1","beta2","beta3"),
est=c(2.5,0.5,0.1), low=c(1,0,0),upp=c(3,2,2))
> result <- dfp(beta,f=negloglike)
> result
Kind regards
--
View this message in context: http://www.nabble.com/asymptotic-convergence-intervall-for-poisson-regression-tp22944357p22944357.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list