search for: nstim

Displaying 1 result from an estimated 1 matches for "nstim".

Did you mean: nsim
2011 Nov 16
0
Maximum likelihood for censored geometric distribution
...ses will follow a geometric with parameter p, but censored at 10 stimulations. I hope to estimate p for my two treatment groups (p1 and p2), and then see whether the treatment affects p (i.e. whether p1 and p2 differ). # A subsample of the data, where 11 represent no response to 10 stimulations Nstim=c(1,1,1,1,1,1,2,2,3,4,5,6,8,11,11,11,11) # create the geometric likelihood function geometric.loglikelihood <- function(pi, y, n) { loglikelihood <- n*log(pi)-n*log(1-pi)+log(1-pi)*sum(y) return(loglikelihood) } # optimise the likelihood function test<-optim(c(0.5),geometric.logl...