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

initial values ignored #451

Closed
jpritikin opened this issue Feb 16, 2021 · 6 comments
Closed

initial values ignored #451

jpritikin opened this issue Feb 16, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@jpritikin
Copy link

Describe the bug
Can't set initial values

To Reproduce
Run bug.tar.gz

Expected behavior
rawTwin[1] etc should be set to 0.5

Operating system
Linux Ubuntu 20.10

CmdStanR version number
0.1.3, using cmdstan-2.26.0

Additional context
Maybe a cmdstan bug?

@jpritikin jpritikin added the bug Something isn't working label Feb 16, 2021
@jpritikin
Copy link
Author

Oops, you can comment tall[['ord']] <- ordinalize(tall[['value']], 12) and source("util.R") to get the script to run.

@mike-lawrence
Copy link
Collaborator

Check that you're structuring the inits properly. See this issue that boiled down to failure to do so.

@jpritikin
Copy link
Author

Here's what I found in the init file:

{
  "predVar": 1,
  "eVar": 2,
  "rawFamily[1]": 0.5,
  "rawFamily[2]": 0.5,
  "rawFamily[3]": 0.5,
  "rawFamily[4]": 0.5,
  "rawFamily[5]": 0.5,
  "rawFamily[6]": 0.5,
  "rawFamily[7]": 0.5,
  "rawFamily[8]": 0.5,
  "rawTwin[1]": 0.5,
  "rawTwin[2]": 0.5,
  "rawTwin[3]": 0.5,
  "rawTwin[4]": 0.5,
  "rawTwin[5]": 0.5,
  "rawTwin[6]": 0.5,
  "rawTwin[7]": 0.5,
  "rawTwin[8]": 0.5
}

Check that you're structuring the inits properly

What can I do? It's cmdstanr that structures the output.

@jpritikin
Copy link
Author

Oh, so I needed to do:

    initVal <- list(predVar=1, eVar=2)
    initVal[['rawFamily']] <- rep(.5, dl$numFamily)
    initVal[['rawTwin']] <- rep(.5, dl$numTwin)

Why doesn't cmdstanr prohibit square brackets in variable names?

@mike-lawrence
Copy link
Collaborator

mike-lawrence commented Feb 16, 2021

Why doesn't cmdstanr prohibit square brackets in variable names?

Yup, that's what should happen. If you scroll to the bottom of the issue I linked, that's the solution that has been seemingly agreed-to as the solution to this. It just hasn't been implemented yet.

@rok-cesnovar
Copy link
Member

rok-cesnovar commented Feb 16, 2021

In all honesty I forgot about that. Lets keep this issue here so we dont forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants