I have the following data:
a vector age A
a vector population P
a vector number of patients N
beta0 = -12
beta1= 0.01
I assume a Poisson distribution for the number of patients:
mll <- function(beta0, beta1, gamma, N, A, P) { -sum(dpois(N, lambda = P exp(beta0 + A * gamma * beta1), log = TRUE))}
Not even sure if this script is correct!
I'm supposed to construct the log-likelihood function and graph it in function of gamma. Absolutely no idea how to do this. I'm researching, but it seems like Chinese to me.
I should use optim to find the max likelihood estimate for gamma.
Help is needed, and much appreciated!!! Thanks!!!