R/fit.R
fit-method-constrain_variables.Rd
The $constrain_variables()
method transforms input parameters
to the constrained scale.
constrain_variables(
unconstrained_variables,
transformed_parameters = TRUE,
generated_quantities = TRUE
)
(numeric) A vector of unconstrained parameters to constrain.
(logical) Whether to return transformed parameters implied by newly-constrained parameters (defaults to TRUE).
(logical) Whether to return generated quantities implied by newly-constrained parameters (defaults to TRUE).
log_prob()
, grad_log_prob()
, constrain_variables()
,
unconstrain_variables()
, unconstrain_draws()
, variable_skeleton()
,
hessian()
# \dontrun{
fit_mcmc <- cmdstanr_example("logistic", method = "sample", force_recompile = TRUE)
fit_mcmc$constrain_variables(unconstrained_variables = c(0.5, 1.2, 1.1, 2.2))
#> $alpha
#> [1] 0.5
#>
#> $beta
#> [1] 1.2 1.1 2.2
#>
#> $log_lik
#> [1] -0.671996961 -0.076521408 -0.050097680 -0.859061944 -4.368940350
#> [6] -0.026348601 -1.399709850 -1.607383090 -0.197580264 -0.161519876
#> [11] -0.020289680 -0.005109469 -3.391453198 -0.438505774 -0.019831358
#> [16] -0.320576250 -0.491982174 -0.985897601 -0.760711848 -0.135968222
#> [21] -0.090365458 -0.289106971 -2.401995550 -0.741279075 -1.130539252
#> [26] -0.051754355 -0.052810285 -0.592894549 -4.203884680 -1.627902707
#> [31] -0.086396696 -0.055223416 -0.702223347 -1.437214411 -4.277397542
#> [36] -3.430371053 -0.029399304 -2.582700752 -0.082096143 -0.613542693
#> [41] -1.631715761 -0.780555873 -8.456425184 -1.129873174 -0.803760727
#> [46] -0.375921603 -0.200697408 -1.179516083 -0.288812923 -0.028251618
#> [51] -2.203830461 -0.542549041 -0.108332542 -1.410224678 -0.176267923
#> [56] -6.137792581 -0.301999796 -0.002415079 -1.082073078 -0.661755204
#> [61] -0.906463865 -0.022520669 -0.200599774 -0.088896080 -4.807633540
#> [66] -0.027891348 -1.129060197 -0.378523990 -0.287530851 -4.083209231
#> [71] -4.503703248 -2.056130808 -0.409881228 -2.435290917 -0.022311747
#> [76] -0.310871780 -1.558477854 -3.416918272 -0.143495888 -0.017064658
#> [81] -1.422948018 -0.019539438 -0.383208393 -0.083042642 -0.216009949
#> [86] -3.175676338 -0.547416219 -3.767462435 -1.854701489 -3.595218847
#> [91] -1.713321036 -4.146153592 -1.389571073 -0.344785402 -0.305319997
#> [96] -1.233113298 -1.753232181 -0.002618034 -0.608156530 -1.329013367
#>
# }