Choose variables from a stanfit object

stan_select(object, ...)

Arguments

object

a stanfit object

...

One or more unquoted expressions separated by commas

Value

stanfit object

See also

quotation, quo_label, map

Other subsetting: stan_contains()

Examples

# \donttest{ rats <- rats_example(nCores = 1) rats%>%stan_select(mu_beta)
#> Inference for Stan model: rats. #> 4 chains, each with iter=2000; warmup=1000; thin=1; #> post-warmup draws per chain=1000, total post-warmup draws=4000. #> #> mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat #> mu_beta 6.19 0 0.11 5.98 6.12 6.19 6.25 6.4 4462 1 #> #> Samples were drawn using at Mon Aug 31 11:07:31 2020. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split chains (at #> convergence, Rhat=1).
rats%>%stan_select(mu_beta,beta)
#> Inference for Stan model: rats. #> 4 chains, each with iter=2000; warmup=1000; thin=1; #> post-warmup draws per chain=1000, total post-warmup draws=4000. #> #> mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat #> beta[1] 6.06 0 0.24 5.59 5.91 6.07 6.22 6.53 5584 1 #> beta[2] 7.05 0 0.26 6.55 6.88 7.05 7.22 7.55 4936 1 #> beta[3] 6.48 0 0.24 6.02 6.32 6.48 6.65 6.97 4433 1 #> beta[4] 5.34 0 0.26 4.82 5.17 5.34 5.52 5.84 5458 1 #> beta[5] 6.57 0 0.24 6.09 6.41 6.57 6.73 7.05 5527 1 #> beta[6] 6.17 0 0.24 5.70 6.00 6.17 6.34 6.64 5028 1 #> beta[7] 5.97 0 0.24 5.50 5.81 5.97 6.14 6.44 5714 1 #> beta[8] 6.42 0 0.24 5.95 6.25 6.41 6.59 6.90 5518 1 #> beta[9] 7.05 0 0.25 6.54 6.89 7.05 7.22 7.54 5162 1 #> beta[10] 5.84 0 0.24 5.36 5.68 5.84 6.00 6.31 5171 1 #> beta[11] 6.80 0 0.25 6.31 6.63 6.80 6.97 7.28 5098 1 #> beta[12] 6.12 0 0.24 5.65 5.96 6.11 6.28 6.58 5552 1 #> beta[13] 6.16 0 0.25 5.65 6.01 6.16 6.32 6.66 5429 1 #> beta[14] 6.69 0 0.24 6.22 6.52 6.69 6.85 7.17 5107 1 #> beta[15] 5.42 0 0.25 4.94 5.25 5.41 5.59 5.91 4556 1 #> beta[16] 5.93 0 0.24 5.45 5.77 5.93 6.09 6.39 5506 1 #> beta[17] 6.28 0 0.24 5.82 6.12 6.28 6.44 6.74 5684 1 #> beta[18] 5.84 0 0.24 5.36 5.68 5.83 6.00 6.30 5159 1 #> beta[19] 6.40 0 0.24 5.93 6.23 6.40 6.56 6.85 5036 1 #> beta[20] 6.05 0 0.25 5.56 5.89 6.05 6.22 6.54 6193 1 #> beta[21] 6.40 0 0.24 5.93 6.24 6.40 6.56 6.86 6641 1 #> beta[22] 5.86 0 0.24 5.40 5.69 5.86 6.02 6.31 5890 1 #> beta[23] 5.75 0 0.24 5.27 5.59 5.75 5.91 6.23 6016 1 #> beta[24] 5.89 0 0.24 5.41 5.73 5.89 6.05 6.37 6260 1 #> beta[25] 6.91 0 0.25 6.42 6.74 6.90 7.07 7.40 4974 1 #> beta[26] 6.54 0 0.24 6.06 6.39 6.55 6.70 7.01 5722 1 #> beta[27] 5.90 0 0.24 5.41 5.73 5.90 6.06 6.38 5821 1 #> beta[28] 5.85 0 0.23 5.40 5.69 5.84 6.01 6.31 5740 1 #> beta[29] 5.68 0 0.25 5.20 5.51 5.67 5.84 6.17 5303 1 #> beta[30] 6.13 0 0.23 5.68 5.97 6.12 6.28 6.59 6428 1 #> mu_beta 6.19 0 0.11 5.98 6.12 6.19 6.25 6.40 4462 1 #> #> Samples were drawn using at Mon Aug 31 11:07:31 2020. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split chains (at #> convergence, Rhat=1).
rats%>%stan_select('mu_beta')
#> Inference for Stan model: rats. #> 4 chains, each with iter=2000; warmup=1000; thin=1; #> post-warmup draws per chain=1000, total post-warmup draws=4000. #> #> mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat #> mu_beta 6.19 0 0.11 5.98 6.12 6.19 6.25 6.4 4462 1 #> #> Samples were drawn using at Mon Aug 31 11:07:31 2020. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split chains (at #> convergence, Rhat=1).
tmp <- c('mu_beta','mu_alpha') rats%>%stan_select(!!!rlang::syms(tmp))
#> Inference for Stan model: rats. #> 4 chains, each with iter=2000; warmup=1000; thin=1; #> post-warmup draws per chain=1000, total post-warmup draws=4000. #> #> mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat #> mu_alpha 242.47 0.05 2.76 236.95 240.61 242.50 244.38 247.7 3585 1 #> mu_beta 6.19 0.00 0.11 5.98 6.12 6.19 6.25 6.4 4462 1 #> #> Samples were drawn using at Mon Aug 31 11:07:31 2020. #> For each parameter, n_eff is a crude measure of effective sample size, #> and Rhat is the potential scale reduction factor on split chains (at #> convergence, Rhat=1).
# }