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

c++ error: dpotrf A.alpha failed, when running spPGOcc #9

Closed
agentilis opened this issue Apr 4, 2022 · 2 comments
Closed

c++ error: dpotrf A.alpha failed, when running spPGOcc #9

agentilis opened this issue Apr 4, 2022 · 2 comments

Comments

@agentilis
Copy link

Thank you so much for the excellent work. I was excited to see 0.3.0 come out with random intercepts in the occupancy formulas. I have run into an issue with model execution and am stuck with how to resolve it. Any advice would be appreciated.

I receive the error "c++ error: dpotrf A.alpha failed", when running spPGOcc. Sometimes it fails on chain 1, and sometimes on chain 2. I have n.report = 80. When it fails, it fails before the first update (at 25%).

spOccupancy 0.3.0, R 4.1.3, Windows 11, 64-bit, Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz, 32.0 GB RAM.

Dataset: 3360 survey points, up to 15 replicates, across 6 western states.

Settings
n.batch = 320 # will increase later
batch.length = 25
NNGP = TRUE
n.neighbors = 8
n.burn = 2000
n.thin = 4
n.chains = 2 # will increase later

This runs fine:
m._.bjns2 <- spPGOcc(occ.formula = ~ (1|year) + (1|stratum),
det.formula = ~ broad + julian + noise + start + I(start^2),
data = flowList, n.omp.threads=n.omp.threads,k.fold.threads=k.fold.threads,
n.batch = n.batch, batch.length = batch.length, accept.rate = 0.43, cov.model = "exponential",
NNGP = NNGP, n.neighbors = n.neighbors, n.burn = n.burn, n.thin = n.thin, n.chains = n.chains,
verbose = T, n.report=n.report) #, , k.fold = k.fold)

This causes the error (adding "elev" to the occupancy formula):
m.e <- spPGOcc(occ.formula = ~ (1|year) + (1|stratum) + elev,
det.formula = broad + julian + noise + start + I(start^2),
data = flowList, n.omp.threads=n.omp.threads,k.fold.threads=k.fold.threads,
n.batch = n.batch, batch.length = batch.length, accept.rate = 0.43, cov.model = "exponential",
NNGP = NNGP, n.neighbors = n.neighbors, n.burn = n.burn, n.thin = n.thin,
n.chains = n.chains, verbose = T, n.report=n.report)#, k.fold = k.fold)

However, this runs fine (keeping "elev", but removing "I(start^2)" from detection model).
m.e <- spPGOcc(occ.formula = ~ (1|year) + (1|stratum) + elev,
det.formula = broad + julian + noise + start,
data = flowList, n.omp.threads=n.omp.threads,k.fold.threads=k.fold.threads,
n.batch = n.batch, batch.length = batch.length, accept.rate = 0.43, cov.model = "exponential",
NNGP = NNGP, n.neighbors = n.neighbors, n.burn = n.burn, n.thin = n.thin,
n.chains = n.chains, verbose = T, n.report=n.report)#, k.fold = k.fold)

Any suggestions?

I would be happy to share my dataset privately, or to help debug the issue.

Thank you for your time and effort.

@doserjef
Copy link
Owner

doserjef commented Apr 4, 2022

Hi Rob,

Thanks for reaching out with the error, and for providing all the really useful info. Sorry you're running into this issue. That error indicates that there is a problem when computing the detection regression coefficients in the MCMC, although it could be caused by a problem somewhere else in the code. All the code you have there looks fine, so would you be able to send me the data set and R script via email (doserjef@msu.edu) and I'll take a look more closely? My guess is there is something with your specific data set that spPGOcc isn't expecting when including that specific combination of covariates.

Thanks,

Jeff

@doserjef
Copy link
Owner

doserjef commented Apr 4, 2022

Error was occurring as a result of very large, non-standardized covariates in the model, which was resolved by standardizing the variables or scaling them to smaller values.

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

2 participants