zgompert / bgc-hm

R package for Bayesian genomic analyses of hybrid zones, including Bayesian genomic clines
GNU General Public License v3.0
2 stars 0 forks source link

Stan rejecting initial sampling value #3

Open DaveLutgen opened 2 months ago

DaveLutgen commented 2 months ago

Hi,

image

I'm trying to run Bgc-hm on genotype likelihoods and I think to have formatted the data according to the required input format (see image for P0 example), however when I start to run est_p() the Initialization seems to fail with Stan rejecting the initial sampling value.

Chain 4: Rejecting initial value:
Chain 4:   Gradient evaluated at the initial value is not finite.
Chain 4:   Stan can't start sampling from this initial value.
Chain 4: 
Chain 4: Initialization between (-2, 2) failed after 100 attempts. 
Chain 4:  Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] "Error : Initialization failed."
error occurred during calling the sampler; sampling not done
Warning: some chains had errors; consider specifying chains = 1 to debughere are whatever error messages were returned

Would you have any hints to where the issue might be?

All the best, Dave

zgompert commented 2 months ago

Hi Dave, send me the R object with the data loaded and I can take a look. Zach Sent from my iPhoneOn Jun 26, 2024, at 6:44 AM, Dave Lutgen @.***> wrote: Hi, image.png (view on web) I'm trying to run Bgc-hm on genotype likelihoods and I think to have formatted the data according to the required input format (see image for P0 example), however when I start to run est_p() the Initialization seems to fail with Stan rejecting the initial sampling value. Chain 4: Rejecting initial value: Chain 4: Gradient evaluated at the initial value is not finite. Chain 4: Stan can't start sampling from this initial value. Chain 4: Chain 4: Initialization between (-2, 2) failed after 100 attempts. Chain 4: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model. [1] "Error : Initialization failed." error occurred during calling the sampler; sampling not done Warning: some chains had errors; consider specifying chains = 1 to debughere are whatever error messages were returned

Would you have any hints to where the issue might be? All the best, Dave

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

zgompert commented 2 months ago

Hi Dave,

One more thing, are there by chance any loci where both parents are fixed for the same allele but where the hybrids have an alternative allele? If so, you can replace allele frequencies of 0 and 1 with something like 0.0001 and 0.9999 to solve the problem (this can be a good idea in general).

Zach

On Wed, Jun 26, 2024 at 6:44 AM Dave Lutgen @.***> wrote:

Hi, image.png (view on web) https://github.com/zgompert/bgc-hm/assets/53175344/5b55199c-a238-4854-8a16-cac0b2073eb1

I'm trying to run Bgc-hm on genotype likelihoods and I think to have formatted the data according to the required input format (see image for P0 example), however when I start to run est_p() the Initialization seems to fail with Stan rejecting the initial sampling value.

Chain 4: Rejecting initial value: Chain 4: Gradient evaluated at the initial value is not finite. Chain 4: Stan can't start sampling from this initial value. Chain 4: Chain 4: Initialization between (-2, 2) failed after 100 attempts. Chain 4: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model. [1] "Error : Initialization failed." error occurred during calling the sampler; sampling not done Warning: some chains had errors; consider specifying chains = 1 to debughere are whatever error messages were returned

Would you have any hints to where the issue might be?

All the best, Dave

— Reply to this email directly, view it on GitHub https://github.com/zgompert/bgc-hm/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHTKRHXHWGQUP2I25NJZZH3ZJKZUTAVCNFSM6AAAAABJ52FKBCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM3TKMRUGIZDSNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>