> Dear All
>
> I have data as follows.
>
> D       T        M       L
> 0.20     1       03       141
> 0.32    1       07       62
> 0.50     1       05       49
> 0.80     1       04       46
> 0.20     2       14      130
> 0.32    2       17      52
> 0.50     2       13      41
> 0.80     2       14      36
> 0.20     3       24      120
> 0.32    3       28      41
> 0.50     3       24      30
> 0.80     3       22      28
> 0.20     4       31      113
> 0.32    4       44      25
> 0.50     4       39      15
> 0.80     4       36      14
> 0.20     5       35      109
> 0.32    5       47      22
> 0.50     5       43      11
> 0.80     5       44      06
> 0.20     6       38      106
> 0.32    6       49      20
> 0.50     6       45      09
> 0.80     6       46      04
>
> I want to fit a negative binomial regression model where "M" is the
> required success and "L" is number of units to have the required
> success.
>
> I want to fit the following model
>
> GLM link, log(1-M / (M+L)) = constant + theta 1 * log(D) + theta 2 *
> 1/T + theta 3 * log(D) * 1 / T
>
> I wrote the function as
>
>                          dat = read.table("N_d_t_F.txt",header=T)
>
>                          N_D = 4
>                          N_T = 6
>
>                          dat$x    = log(dat$D)
>                          dat$p    = dat$M / (dat$L+dat$M)
>                          dat$InvT = 1/dat$T
>                          dat$glm1= log(1-dat$p)
>
>                          negloglike = function(parms, dat){
>
>                          pp   = design%*%parms
>                          p    = 1-exp(pp)
>
>                          obj  = 0
>                          t_D = 0
>                          for(d in 1:N_D){
>                              for(t in 1:N_T){
>                                t_D = t_D+1
>
>                              obj = obj + dat$M[t_D]*log(p[t_D])
>                                obj = obj + dat$L[t_D]*log(1-p[t_D])
>
>                              }
>                          }
>                          -obj
>                          }
>
>                          design = cbind(1, dat$x, dat$InvT, dat$x*dat$InvT)
>                          g = lm(glm1~design-1, dat, subset=c(p>0))
>                          mle.fit = optim(coef(g),  negloglike,
> dat=dat, hessian=T)
>
> However, this function does not optimize properly. It always creates
> some errors.
>
> How can I optimize this model?
>
> This is not a count data. That's why I can not use the function
> "glm.nb" or "aod" package.
>
> Would you please give me some suggestions so that I can optimize the
> function?
>

	[[alternative HTML version deleted]]

