Displaying 1 result from an estimated 1 matches for "accab".
Did you mean:
ccab
2007 Oct 31
1
Simple Umacs example help..
...ogalpha = sum( dcauchy(y,location=fn(x,a,b),scale=sstar,log=T) -
dcauchy(y,location=fn(x,a,b),scale=s,log=T)) - log(sstar/s)
logu = log(runif(1,0,1))
acc = (logu < logalpha)
s = acc*sstar + (1-acc)*s
list(s=s,accs=acc)
}
sample.abs<-function(n=10000,x,y,a=0,b=1,s=2,da=.2,db =.2,ds=1)
{
accab <- 0
accs <- 0
A = B = S = rep(NaN,n)
for(i in 1:n){
z = sampleab(x,y,a,b,s,da,db)
q <- samples(x,y,a,b,s,ds)
A[i] = a = z$a
B[i] = b = z$b
S[i]=s=q$s
accab = accab + z$acc
accs <- accs +q$accs
}
invisible(list(a=A, b=B, s=S, accab=accab/n,accs=accs/n))
}
Cheers,
Ted
Dept. of Bio...