How to fit a negative binomial distribution in R while incorporating censoring
I need to fit Y_ij ~ NegBin(m开发者_如何学C_ij,k)
, hence a negative binomial distribution to a count. However, the data I have observed are censored, I know the value of y_ij
, but it could be more than that value. Writting down the loglikelihood going with this problem is:
ll = \sum_{i=1}^n w_i (c_i log(P(Y_ij=y_ij|X_ij)) + (1- c_i) log(1- \sum_{k=1}^32 P(Y_ij = k|X_ij)))
Where X_ij
represent the design matrix (with the covariates of interest), w_i
is the weight for each observation, y_ij
is the response variable and P(Y_ij=y_ij|Xij)
is the negative binomial distribution where the m_ij=exp(X_ij \beta)
and \alpha
is the overdispersion parameter.
Does someone knows if there exist a build-in code in R that could be used to obtain this?
Check this paper out: Regression Models for Count Data in R
精彩评论