Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prob of shift proportional to branch length maybe broke on dev version? #11

Closed
eliotmiller opened this issue Oct 31, 2017 · 2 comments
Closed

Comments

@eliotmiller
Copy link

Runs that previously worked on the CRAN version of bayou are no longer working for me on the dev version. These runs use the probability of a shift proportional branch length prior outlined in some of the documentation. The runs work for a few generations, but ultimately crash. For instance,

prior2 <- make.prior(prunedMBC, dists=list(dalpha="dhalfcauchy", dsig2="dhalfcauchy",dsb="dsb", dk="cdpois", dtheta="dnorm"), param=list(dalpha=list(scale=1), dsig2=list(scale=1), dk=list(lambda=15, kmax=200), dsb=list(bmax=Inf,prob=prunedMBC$edge.length), dtheta=list(mean=mean(avMBC), sd=2)))

mcmc2 <- bayou.makeMCMC(prunedMBC, avMBC, SE=cvMBC, model="OU", prior=prior2, new.dir=TRUE, samp=10^2, chunk=10^3, ticker.freq=10^4, plot.freq=NULL)

system.time(mcmc2$run(ngen=10^7))

returns

Error in sample.int(x, size, replace, prob) : NA in probability vector
Calls: system.time ... .proposalFn -> .moveFn -> .sample -> sample -> sample.int
Timing stopped at: 2099.404 15.264 2117.245

Perhaps something needs to get fixed with this model on the dev version? Or, perhaps I've misspecified something in the code (entirely possible).

@coyotree
Copy link

Hello,

I am running into the same error. I am using version 2.1. If I just keep re-running it, it will manage to run for a period of time and then throw an error again. Would really like to use branch lengths in the prior but the errors worrying me. See below for a very long example of the output. Thanks for your help!

`Checking inputs for errors:...........
seems fine...

fit.branches$run(100000)
gen lnL prior alpha sig2 rtheta k .alpha .sig2 .theta birth.k D0.slid D1.slid death.k U0.slid U1.slid U2.slid
1000 -119.15 -61.41 1.93 3.64 2.21 10 0.53 0.40 0.68 0.12 1.00 0.60 0.78 1.00
....
7000 -118.00 -43.52 1.26 2.21 2.04 6 0.47 0.45 0.62 0.10 1.00 0.36 0.59 0.94 0.34 0.24
Error in sample.int(x, size, replace, prob) : NA in probability vector
fit.branches$run(100000)
gen lnL prior alpha sig2 rtheta k .alpha .sig2 .theta birth.k D0.slid D1.slid death.k U0.slid U1.slid U2.slid
8000 -117.02 -52.69 1.44 2.40 2.12 8 0.42 0.43 0.60 0.07 1.00 0.08 0.45 1.00 0.00 0.18
....
10000 -120.05 -49.49 1.58 3.53 1.82 7 0.45 0.42 0.59 0.07 1.00 0.15 0.45 0.99 0.17 0.12
Error in sample.int(x, size, replace, prob) : NA in probability vector
fit.branches$run(100000)
gen lnL prior alpha sig2 rtheta k .alpha .sig2 .theta birth.k D0.slid D1.slid death.k U0.slid U1.slid U2.slid
11000 -126.16 -52.32 0.45 1.26 2.24 9 0.45 0.44 0.70 0.14 1.00 0.00 0.38 1.00
......
72000 -115.63 -54.08 0.14 0.22 2.31 8 0.48 0.48 0.68 0.10 0.95 0.30 0.60 0.00 0.94 0.31 0.25
Error in if (runif(1) < exp(nll - oll + pr2 - pr1 + hr)) { :
missing value where TRUE/FALSE needed
fit.branches$run(100000)
Error in sample.int(x, size, replace, prob) : NA in probability vector
fit.branches$run(100000)
Error in sample.int(x, size, replace, prob) : NA in probability vector
fit.branches$run(100000)
gen lnL prior alpha sig2 rtheta k .alpha .sig2 .theta birth.k D0.slid D1.slid death.k U0.slid U2.slid
73000 -125.83 -47.44 0.07 0.17 2.01 8 0.62 0.29 0.88 0.05 1.00 0.00 0.60 1.00 0.00
74000 -123.76 -45.19 0.34 0.61 2.23 8 0.46 0.54 0.75 0.10 1.00 0.38 0.62 0.92 0.40 0.04
75000 -117.79 -51.09 1.56 2.11 2.20 8 0.44 0.47 0.70 0.10 1.00 0.25 0.54 0.93 0.18 0.08
Error in if (runif(1) < exp(nll - oll + pr2 - pr1 + hr)) { :
missing value where TRUE/FALSE needed
fit.branches$run(100000)
gen lnL prior alpha sig2 rtheta k .alpha .sig2 .theta birth.k D0.slid D1.slid death.k U0.slid U1.slid U2.slid
76000 -117.55 -68.06 3.31 6.71 1.80 12 0.34 0.54 0.62 0.13 1.00 0.11 0.55 1.00 0.50 0.25
....
96000 -123.52 -57.11 0.06 0.09 2.20 10 0.48 0.48 0.65 0.09 0.98 0.31 0.58 0.95 0.33 0.19
Error in sample.int(x, size, replace, prob) : NA in probability vector`

@uyedaj
Copy link
Owner

uyedaj commented Apr 9, 2019

Resolved this issue in version 2.1.3 (hopefully)

@uyedaj uyedaj closed this as completed Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants