Hi all,

Sorry for the re-post, I sent my previous e-mail before it was complete. I
am trying to model seroprevalence using the differential equation: dP/dt =
beta*seronegative*.001*(seropositive)-0.35*(0.999)*(seropositive)-r*seropositive.
I would like to estimate my two parameters, beta and r, using maximum
likelihood methods. I have included my code below:

summary=read.delim('summary.txt',header=T)
summary
  Year   N SeroPos SeroNeg
1    1  75       1      74
2    2  12       3       9
3    3 139      11     128
4    4 178      22     156
5    5 203      18     185
6    6 244      37     207
attach(summary)
poisNLL=function(P){
lambda=P[1]*SeroNeg*0.001*SeroPos-0.35*0.999*SeroPos-P[2]*SeroPos
v=-sum(dpois(SeroNeg,lambda=lambda,log=TRUE))
if (!is.finite(v)) v<- -2000000
v
}
opt1=optim(poisNLL,start=c(10,.1),method='BFGS')

I receive the following error from this code: "Error in optim(poisNLL, start
= c(10, 0.1), method = "BFGS") :
  cannot coerce type 'closure' to vector of type 'double'"

Any assistance provided would be greatly appreciated!

Best,
Tyler

	[[alternative HTML version deleted]]

