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

Make constrain_pars behaviour consistent with rstan #704

Merged
merged 2 commits into from
Oct 16, 2022
Merged

Make constrain_pars behaviour consistent with rstan #704

merged 2 commits into from
Oct 16, 2022

Conversation

andrjohns
Copy link
Collaborator

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

The constrain_pars method in RStan also returns the transformed parameters and generated quantities implied by the provided unconstrained parameters. This PR adds two boolean arguments to the cmdstanr constrain_pars for whether to return the transformed parameters and/or generated quantities (defaulting to TRUE for consistency with rstan):

fit$constrain_pars(c(0.1))
#> $theta
#> [1] 0.5249792
#> 
#> $log_lik
#>  [1] -7.243967 -7.243967 -7.243967 -7.243967 -7.243967 -7.243967 -7.243967
#>  [8] -7.243967 -7.243967 -7.243967

fit$constrain_pars(c(0.1), generated_quantities = FALSE)
#> $theta
#> [1] 0.5249792

Created on 2022-10-16 with reprex v2.0.2

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Andrew Johnson

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@codecov-commenter
Copy link

codecov-commenter commented Oct 16, 2022

Codecov Report

Merging #704 (4ecfd85) into master (cdd62a0) will increase coverage by 1.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #704      +/-   ##
==========================================
+ Coverage   89.48%   90.55%   +1.06%     
==========================================
  Files          12       12              
  Lines        3824     3884      +60     
==========================================
+ Hits         3422     3517      +95     
+ Misses        402      367      -35     
Impacted Files Coverage Δ
R/fit.R 98.22% <100.00%> (+<0.01%) ⬆️
R/utils.R 86.35% <100.00%> (+0.99%) ⬆️
R/csv.R 97.66% <0.00%> (+0.42%) ⬆️
R/model.R 91.71% <0.00%> (+0.98%) ⬆️
R/run.R 95.28% <0.00%> (+1.57%) ⬆️
R/install.R 62.93% <0.00%> (+4.19%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rok-cesnovar rok-cesnovar merged commit 9aa36ee into stan-dev:master Oct 16, 2022
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

Successfully merging this pull request may close these issues.

3 participants