Skip to contents

parameter_sample_to_tibble() takes a rstan::stanfit parameter sample of a model, extracts the paramters values and returns them in a data frame.

Usage

parameter_sample_to_tibble(model, sample, ...)

Arguments

model

an object of class srpmodel containing prior information

sample

a stanfit object with samples from the respective model.

...

further arguments passed to method implementations

Value

a tibble with the sampled parameters, in long format

Examples

mdl <- create_srpmodel(A = define_srp_prior())
smpl <- sample_prior(mdl, seed = 3647L)
parameter_sample_to_tibble(mdl, smpl)
#> # A tibble: 20,000 × 5
#>     iter parameter group_id transition  value
#>    <int> <chr>     <chr>         <int>  <dbl>
#>  1     1 p         A                NA  0.605
#>  2     1 median_t  A                 1  2.04 
#>  3     1 median_t  A                 2 12.1  
#>  4     1 median_t  A                 3 24.4  
#>  5     1 shape     A                 1  1.15 
#>  6     1 shape     A                 2  1.30 
#>  7     1 shape     A                 3  1.99 
#>  8     1 scale     A                 1  2.81 
#>  9     1 scale     A                 2 16.0  
#> 10     1 scale     A                 3 29.4  
#> # ℹ 19,990 more rows