Displaying 2 results from an estimated 2 matches for "logpost".
Did you mean:
loghost
2008 Sep 19
2
Error: function cannot be evaluated at initial parameters
I have an error for a simple optimization problem. Is there anyone knowing
about this error?
lambda1=-9
lambda2=-6
L<-function(a){
s2i2f<-(exp(-lambda1*(250^a)-lambda2*(275^a-250^a))
-exp(-lambda1*(250^a)-lambda2*(300^a-250^a)))
logl<-log(s2i2f)
return(-logl)}
optim(1,L)
Error in optim(1, L) : function cannot be evaluated at initial parameters
Thank you in advance
--
View this
2008 Sep 27
0
compute posterior mean by numerical integration
...or density
"prior" <- function(omega, beta, o1, o2, b1, b2)
{
if(o1 && o2 && b1 && b2)
res <- dgamma(omega, o1, o2, log=T) + dgamma(beta, b1, b2, log=T)
else
res <- 0 ## noninformative prior
return(res)
}
## log posterior density
"logPost" <- function(t, omega, beta, o1, o2, b1, b2)
{
res <- loglike(t, omega, beta) + prior(omega, beta, o1, o2, b1, b2)
return(res)
}
## posterior normalizing constant
"PostNormConst" <- function(t, low, upw, lob, upb, o1, o2, b1, b2)
{
"g" <- function(be...