stan-dev / stan-dev/rstan

Compilation error fitting the Stan model

Open
#565 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

I encountered compilation errors when fitting a Stan model as below,

fit1 <- stan(file='mystancode.stan', data=ds, refresh=1000, warmup = 2000, iter = 4000, cores = 1, chains=4, seed=100)

Within mystancode.stan, I defined an improper prior distribution on param as below,

functions { // declare and define user-defined function before calling it
real gen_penalty_lpdf(vector param, real s1, real s2, real s3) {
return -s1 * fabs(param[1])-s2 * fabs(param[2])-s3 * fabs(param[1]*param[2]);
}
}

And the error messages are,

trying deprecated constructor; please alert package maintainer
Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) :
no valid constructor available for the argument list
failed to create the sampler; sampling not done

Any help or advice would be greatly appreciated!!!

RStan Version:

The version of RStan you are running (e.g., from packageVersion("rstan"))
‘2.17.2’

R Version:

The version of R you are running (e.g., from R.version.string)
3.5.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the stan call from the issue with RStan 2.17.2, R 3.5.1, and the supplied mystancode.stan function. Inspect whether the compilation failure comes from the model definition or the deprecated-constructor error, then document a reproducible cause and confirmed resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.