Shrink continuous slopes and factor effects using ridge, lasso or horseshoe priors. The fitted contrast determines which coefficients shrink together. All members of a named group share the global scale and, when specified, the slab variance.
prior_regularized(
family,
scale,
terms = NULL,
slab_scale = NULL,
slab_df = 4,
contrast = NULL
)One of "ridge", "lasso", and "horseshoe".
A positive number fixing the global scale, or a proper scalar continuous prior with positive support from which to learn it. The scale is in fitted coefficient units. For a single lasso coefficient it is the Laplace scale. For a centered factor it scales the Euclidean norm in the group-lasso density.
Optional character vector of fixed-effect term labels.
Place a group under its own name in the formula prior list. Omitting
terms selects the non-intercept terms without a prior of their own.
Separate named groups have independent scales, even if they use the
same scale prior. A multi-column term uses its fitted coefficient basis.
Positive scale of the Student-t slab for the regularized
horseshoe. The default NULL selects the classical horseshoe.
Positive degrees of freedom of the Student-t slab.
Optional factor coding, one of "treatment", "independent",
"meandif" or "orthonormal". With NULL, JAGS_formula() uses treatment
coding by default and a calling model can supply its factor coding.
With numeric scale and omitted terms, ridge and lasso return
ordinary scalar priors accepted by prior_spike_and_slab() and
prior_mixture(). Otherwise the result declares a coefficient group for
JAGS_formula(). is.prior.regularized() identifies group declarations.
is.prior.regularized_term() identifies coefficient priors bound to a group.
A continuous slope is one shrinkage unit. Treatment coding
gives one unit per difference from the reference level. Independent
coding gives one per level coefficient. Mean-difference and orthonormal
coding place the centered coefficients of a factor in one exchangeable
unit. In an interaction the fitted codings of the constituent factors
determine the units. Centered factors form one unit per column
combination of partners coded by treatment contrasts or level indicators.
A group that supplies a factor main effect can use its requested contrast
for that factor while a separately specified partner retains its own coding.
If the group supplies only the interaction, an explicit contrast must
match the fitted coding of every constituent that uses a contrast. Omit
contrast to inherit a mixed design. Formula-forced level indicators keep
their indicator coding.
For a unit of dimension \(d\), write \(b\) for its vector of coded coefficients and \(\tau\) for the global scale. Ridge gives \(b\) a spherical Normal prior with coordinate standard deviation \(\tau\). Group lasso has density proportional to \(\tau^{-d}\exp(-\|b\|_2/\tau)\). Equivalently, conditional on one variance multiplier \(W\) with Gamma shape \((d+1)/2\) and rate \(1/2\), its coordinates are independent Normals with standard deviation \(\tau\sqrt{W}\) (Kyung et al. 2010) . Each coordinate has variance \((d+1)\tau^2\) given \(\tau\). A one-dimensional unit has the ordinary Laplace distribution with scale \(\tau\).
The horseshoe draws one standard half-Cauchy local scale per unit.
Conditional on global scale \(\tau\) and its unit's local scale
\(\lambda_j\), a horseshoe coefficient is Normal with mean zero and
standard deviation \(s_j = \tau\lambda_j\). With a finite slab its
conditional variance is \(c^2 s_j^2/(c^2+s_j^2)\), where the shared
\(c^2\) follows an inverse-gamma distribution with shape
\(\nu/2\) and scale \(\nu s^2/2\) for \(\nu=\) slab_df
and \(s=\) slab_scale (Piironen and Vehtari 2017)
.
Both centered codings give exchangeable level deviations. They retain
the scale convention of prior_factor(). For a main effect with
\(K\) levels the mean-difference contrast matrix is the orthonormal
contrast matrix divided by \(\sqrt{1-1/K}\). Thus the same coded
scale gives larger level deviations under mean-difference coding.
The horseshoe has a continuous density with an infinite peak at zero,
including with a finite slab. A point hypothesis at zero cannot use
the Savage-Dickey density ratio. Use explicit point-null models for
inclusion probabilities. Prior draws within a group retain its common
scales when forming contrasts. Where an analytic contrast distribution
is unavailable, the joint prior draws can still be used. Density and
probability calculations for a contrast of two coordinate-wise lasso coefficients sharing
a learned scale integrate its conditional convolution over that scale.
Within one centered unit, a linear contrast has the marginal law of
one coded coordinate scaled by the Euclidean length of its weight
vector. For wider coordinate-wise shared-lasso contrasts, plots omit
unresolved prior curves.
For a bound centered factor, the marginal methods such as mpdf()
describe a level deviation using the fitted contrast matrix. Use
JAGS_formula_prior_density() for a particular coefficient or
contrast, and rng() for joint draws.
For terms with several coefficients, a joint density, CDF or quantile request raises
BayesTools_regularized_joint_unavailable. A marginal calculation that
cannot meet its numerical precision raises
BayesTools_regularized_marginal_unavailable.
Kyung M, Gill J, Ghosh M, Casella G (2010).
“Penalized regression, standard errors, and Bayesian lassos.”
Bayesian Analysis, 5(2), 369–412.
doi:10.1214/10-BA607
.
Piironen J, Vehtari A (2017).
“Sparsity information and regularization in the horseshoe and other shrinkage priors.”
Electronic Journal of Statistics, 11(2).
doi:10.1214/17-EJS1337SI
.
prior_regularized("ridge", scale = 0.5)
#> Normal(0, 0.5)
prior_regularized("lasso", scale = 0.5)
#> Laplace(0, 0.5)
global <- prior("cauchy", list(0, 0.2), truncation = list(0, Inf))
intercept <- prior("normal", list(0, 2))
# All slopes share a global scale.
all_slopes <- list(intercept = intercept, sh = prior_regularized("horseshoe", global))
# Only wt and hp share shrinkage; disp has its own Normal prior.
priors <- list(
intercept = intercept, disp = prior("normal", list(0, 0.5)),
shrinkage = prior_regularized("horseshoe", scale = global,
terms = c("wt", "hp"), slab_scale = 2)
)
JAGS_formula(~ wt + hp + disp, "mu", mtcars, prior_list = priors)
#> $formula_syntax
#> [1] "for(i in 1:N_mu){\n mu[i] = mu_intercept + mu_wt * mu_data_wt[i] + mu_hp * mu_data_hp[i] + mu_disp * mu_data_disp[i]\n}\n"
#>
#> $data
#> $data$N_mu
#> [1] 32
#>
#> $data$mu_data_wt
#> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
#> 2.620 2.875 2.320 3.215
#> Hornet Sportabout Valiant Duster 360 Merc 240D
#> 3.440 3.460 3.570 3.190
#> Merc 230 Merc 280 Merc 280C Merc 450SE
#> 3.150 3.440 3.440 4.070
#> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
#> 3.730 3.780 5.250 5.424
#> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
#> 5.345 2.200 1.615 1.835
#> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
#> 2.465 3.520 3.435 3.840
#> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
#> 3.845 1.935 2.140 1.513
#> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
#> 3.170 2.770 3.570 2.780
#>
#> $data$mu_data_hp
#> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
#> 110 110 93 110
#> Hornet Sportabout Valiant Duster 360 Merc 240D
#> 175 105 245 62
#> Merc 230 Merc 280 Merc 280C Merc 450SE
#> 95 123 123 180
#> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
#> 180 180 205 215
#> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
#> 230 66 52 65
#> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
#> 97 150 150 245
#> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
#> 175 66 91 113
#> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
#> 264 175 335 109
#>
#> $data$mu_data_disp
#> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
#> 160.0 160.0 108.0 258.0
#> Hornet Sportabout Valiant Duster 360 Merc 240D
#> 360.0 225.0 360.0 146.7
#> Merc 230 Merc 280 Merc 280C Merc 450SE
#> 140.8 167.6 167.6 275.8
#> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
#> 275.8 275.8 472.0 460.0
#> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
#> 440.0 78.7 75.7 71.1
#> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
#> 120.1 318.0 304.0 350.0
#> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
#> 400.0 79.0 120.3 95.1
#> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
#> 351.0 145.0 301.0 121.0
#>
#>
#> $prior_list
#> $prior_list$mu_intercept
#> Normal(0, 2)
#> $prior_list$mu_disp
#> Normal(0, 0.5)
#> $prior_list$mu_wt
#> Regularized horseshoe(scale = Cauchy(0, 0.2)[0, Inf], slab scale = 2, slab df = 4, group = shrinkage)
#> $prior_list$mu_hp
#> Regularized horseshoe(scale = Cauchy(0, 0.2)[0, Inf], slab scale = 2, slab df = 4, group = shrinkage)
#>
#> $formula
#> ~wt + hp + disp
#> <environment: 0x00000131c88b6350>
#>
#> $add_parameters
#> character(0)
#>
#> $jags_modules
#> [1] "BayesTools"
#>
#> $required_packages
#> [1] "BayesTools"
#>
#> $formula_design
#> $schema_version
#> [1] 7
#>
#> $stored_data_scale
#> source_data expression_data model_frame model_matrix
#> "original" "original" "model" "model"
#>
#> $parameter
#> [1] "mu"
#>
#> $formula
#> ~wt + hp + disp
#> <environment: R_EmptyEnv>
#>
#> $log_intercept
#> [1] FALSE
#>
#> $model_frame
#> wt hp disp
#> Mazda RX4 2.620 110 160.0
#> Mazda RX4 Wag 2.875 110 160.0
#> Datsun 710 2.320 93 108.0
#> Hornet 4 Drive 3.215 110 258.0
#> Hornet Sportabout 3.440 175 360.0
#> Valiant 3.460 105 225.0
#> Duster 360 3.570 245 360.0
#> Merc 240D 3.190 62 146.7
#> Merc 230 3.150 95 140.8
#> Merc 280 3.440 123 167.6
#> Merc 280C 3.440 123 167.6
#> Merc 450SE 4.070 180 275.8
#> Merc 450SL 3.730 180 275.8
#> Merc 450SLC 3.780 180 275.8
#> Cadillac Fleetwood 5.250 205 472.0
#> Lincoln Continental 5.424 215 460.0
#> Chrysler Imperial 5.345 230 440.0
#> Fiat 128 2.200 66 78.7
#> Honda Civic 1.615 52 75.7
#> Toyota Corolla 1.835 65 71.1
#> Toyota Corona 2.465 97 120.1
#> Dodge Challenger 3.520 150 318.0
#> AMC Javelin 3.435 150 304.0
#> Camaro Z28 3.840 245 350.0
#> Pontiac Firebird 3.845 175 400.0
#> Fiat X1-9 1.935 66 79.0
#> Porsche 914-2 2.140 91 120.3
#> Lotus Europa 1.513 113 95.1
#> Ford Pantera L 3.170 264 351.0
#> Ferrari Dino 2.770 175 145.0
#> Maserati Bora 3.570 335 301.0
#> Volvo 142E 2.780 109 121.0
#>
#> $source_data
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
#> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
#> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
#> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
#> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
#> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
#> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
#> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
#> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
#> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
#> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4
#> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
#> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
#> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
#> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
#> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
#> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
#> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
#> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
#> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
#> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
#> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
#> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
#> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
#> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
#> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1
#> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2
#> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
#> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
#> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6
#> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
#> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2
#>
#> $model_matrix
#> (Intercept) wt hp disp
#> Mazda RX4 1 2.620 110 160.0
#> Mazda RX4 Wag 1 2.875 110 160.0
#> Datsun 710 1 2.320 93 108.0
#> Hornet 4 Drive 1 3.215 110 258.0
#> Hornet Sportabout 1 3.440 175 360.0
#> Valiant 1 3.460 105 225.0
#> Duster 360 1 3.570 245 360.0
#> Merc 240D 1 3.190 62 146.7
#> Merc 230 1 3.150 95 140.8
#> Merc 280 1 3.440 123 167.6
#> Merc 280C 1 3.440 123 167.6
#> Merc 450SE 1 4.070 180 275.8
#> Merc 450SL 1 3.730 180 275.8
#> Merc 450SLC 1 3.780 180 275.8
#> Cadillac Fleetwood 1 5.250 205 472.0
#> Lincoln Continental 1 5.424 215 460.0
#> Chrysler Imperial 1 5.345 230 440.0
#> Fiat 128 1 2.200 66 78.7
#> Honda Civic 1 1.615 52 75.7
#> Toyota Corolla 1 1.835 65 71.1
#> Toyota Corona 1 2.465 97 120.1
#> Dodge Challenger 1 3.520 150 318.0
#> AMC Javelin 1 3.435 150 304.0
#> Camaro Z28 1 3.840 245 350.0
#> Pontiac Firebird 1 3.845 175 400.0
#> Fiat X1-9 1 1.935 66 79.0
#> Porsche 914-2 1 2.140 91 120.3
#> Lotus Europa 1 1.513 113 95.1
#> Ford Pantera L 1 3.170 264 351.0
#> Ferrari Dino 1 2.770 175 145.0
#> Maserati Bora 1 3.570 335 301.0
#> Volvo 142E 1 2.780 109 121.0
#> attr(,"assign")
#> [1] 0 1 2 3
#>
#> $column_names
#> [1] "(Intercept)" "wt" "hp" "disp"
#>
#> $raw_column_names
#> [1] "(Intercept)" "wt" "hp" "disp"
#>
#> $assign
#> [1] 0 1 2 3
#>
#> $terms
#> ~wt + hp + disp
#> attr(,"variables")
#> list(wt, hp, disp)
#> attr(,"factors")
#> wt hp disp
#> wt 1 0 0
#> hp 0 1 0
#> disp 0 0 1
#> attr(,"term.labels")
#> [1] "wt" "hp" "disp"
#> attr(,"order")
#> [1] 1 1 1
#> attr(,"intercept")
#> [1] 1
#> attr(,"response")
#> [1] 0
#> attr(,".Environment")
#> <environment: R_EmptyEnv>
#>
#> $contrasts
#> NULL
#>
#> $contrast_matrices
#> list()
#>
#> $xlevels
#> named list()
#>
#> $predictors
#> [1] "wt" "hp" "disp"
#>
#> $predictor_types
#> wt hp disp
#> "continuous" "continuous" "continuous"
#>
#> $model_terms
#> [1] "intercept" "wt" "hp" "disp"
#>
#> $model_terms_type
#> intercept wt hp disp
#> "continuous" "continuous" "continuous" "continuous"
#>
#> $prior_list
#> $prior_list$mu_intercept
#> Normal(0, 2)
#> $prior_list$mu_disp
#> Normal(0, 0.5)
#> $prior_list$mu_wt
#> Regularized horseshoe(scale = Cauchy(0, 0.2)[0, Inf], slab scale = 2, slab df = 4, group = shrinkage)
#> $prior_list$mu_hp
#> Regularized horseshoe(scale = Cauchy(0, 0.2)[0, Inf], slab scale = 2, slab df = 4, group = shrinkage)
#>
#> $formula_scale
#> list()
#> attr(,"unscale_design")
#> attr(,"unscale_design")$schema_version
#> [1] 2
#>
#> attr(,"unscale_design")$formula
#> ~wt + hp + disp
#> <environment: R_EmptyEnv>
#>
#> attr(,"unscale_design")$continuous
#> [1] "wt" "hp" "disp"
#>
#> attr(,"unscale_design")$continuous_logical
#> wt hp disp
#> FALSE FALSE FALSE
#>
#> attr(,"unscale_design")$factor_levels
#> named list()
#>
#> attr(,"unscale_design")$factor_ordered
#> named logical(0)
#>
#> attr(,"unscale_design")$contrast_matrices
#> named list()
#>
#> attr(,"unscale_design")$model_terms
#> [1] "intercept" "wt" "hp" "disp"
#>
#> attr(,"unscale_design")$assign
#> [1] 0 1 2 3
#>
#> attr(,"unscale_design")$raw_column_names
#> [1] "(Intercept)" "wt" "hp" "disp"
#>
#> attr(,"unscale_design")$multipliers
#> attr(,"unscale_design")$multipliers$mu_intercept
#> attr(,"unscale_design")$multipliers$mu_intercept$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_intercept$value
#> [1] 1
#>
#>
#> attr(,"unscale_design")$multipliers$mu_disp
#> attr(,"unscale_design")$multipliers$mu_disp$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_disp$value
#> [1] 1
#>
#>
#> attr(,"unscale_design")$multipliers$mu_wt
#> attr(,"unscale_design")$multipliers$mu_wt$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_wt$value
#> [1] 1
#>
#>
#> attr(,"unscale_design")$multipliers$mu_hp
#> attr(,"unscale_design")$multipliers$mu_hp$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_hp$value
#> [1] 1
#>
#>
#>
#> attr(,"unscale_design")$state_constants
#> named numeric(0)
#>
#> attr(,"unscale_design")$owner_scope
#> [1] "compiler"
#>
#> attr(,"unscale_design")$complete
#> [1] FALSE
#>
#>
#> $rank
#> [1] 4
#>
#> $qr_pivot
#> [1] 1 2 3 4
#>
#> $aliased
#> (Intercept) wt hp disp
#> FALSE FALSE FALSE FALSE
#>
#> $transformed_terms
#> list()
#>
#> $expression_specs
#> list()
#>
#> $expression_data
#> list()
#>
#> $random_effects
#> list()
#>
#> $random_effects_compile
#> $sampled
#> character(0)
#>
#> $marginalized
#> character(0)
#>
#> $mode
#> named character(0)
#>
#> attr(,"class")
#> [1] "random_effects_compile_resolved" "random_effects_compile"
#> [3] "list"
#>
#> $jags_data_names
#> $jags_data_names$wt
#> [1] "mu_data_wt"
#>
#> $jags_data_names$hp
#> [1] "mu_data_hp"
#>
#> $jags_data_names$disp
#> [1] "mu_data_disp"
#>
#>
#> $name_map
#> encoded_name
#> 1 BT1_6669786564_6D75_696E74657263657074_636F656666696369656E74
#> 2 BT1_6669786564_6D75_7774_636F656666696369656E74
#> 3 BT1_6669786564_6D75_6870_636F656666696369656E74
#> 4 BT1_6669786564_6D75_64697370_636F656666696369656E74
#> 5 BT1_67656E657261746564_6D75__6D755F736872696E6B6167655F676C6F62616C
#> 6 BT1_67656E657261746564_6D75__6D755F736872696E6B6167655F736C616232
#> 7 BT1_66697865645F617578696C69617279_6D75_7774_5F6C6F63616C5F31
#> 8 BT1_66697865645F617578696C69617279_6D75_6870_5F6C6F63616C5F31
#> formula_output BT1_666F726D756C615F6F7574707574_6D75__6C696E6561725F707265646963746F72
#> jags_name kind formula_parameter term
#> 1 mu_intercept fixed mu intercept
#> 2 mu_wt fixed mu wt
#> 3 mu_hp fixed mu hp
#> 4 mu_disp fixed mu disp
#> 5 mu_shrinkage_global generated mu
#> 6 mu_shrinkage_slab2 generated mu
#> 7 mu_wt_local_1 fixed_auxiliary mu wt
#> 8 mu_hp_local_1 fixed_auxiliary mu hp
#> formula_output mu formula_output mu
#> role
#> 1 coefficient
#> 2 coefficient
#> 3 coefficient
#> 4 coefficient
#> 5 mu_shrinkage_global
#> 6 mu_shrinkage_slab2
#> 7 _local_1
#> 8 _local_1
#> formula_output linear_predictor
#>
#> $random_allocations
#> list()
#>
#> $random_effects_interface
#> [1] "none"
#>
#> attr(,"class")
#> [1] "BayesTools_formula_design" "list"
#>
#> $formula_scale
#> list()
#> attr(,"unscale_design")
#> attr(,"unscale_design")$schema_version
#> [1] 2
#>
#> attr(,"unscale_design")$formula
#> ~wt + hp + disp
#> <environment: R_EmptyEnv>
#>
#> attr(,"unscale_design")$continuous
#> [1] "wt" "hp" "disp"
#>
#> attr(,"unscale_design")$continuous_logical
#> wt hp disp
#> FALSE FALSE FALSE
#>
#> attr(,"unscale_design")$factor_levels
#> named list()
#>
#> attr(,"unscale_design")$factor_ordered
#> named logical(0)
#>
#> attr(,"unscale_design")$contrast_matrices
#> named list()
#>
#> attr(,"unscale_design")$model_terms
#> [1] "intercept" "wt" "hp" "disp"
#>
#> attr(,"unscale_design")$assign
#> [1] 0 1 2 3
#>
#> attr(,"unscale_design")$raw_column_names
#> [1] "(Intercept)" "wt" "hp" "disp"
#>
#> attr(,"unscale_design")$multipliers
#> attr(,"unscale_design")$multipliers$mu_intercept
#> attr(,"unscale_design")$multipliers$mu_intercept$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_intercept$value
#> [1] 1
#>
#>
#> attr(,"unscale_design")$multipliers$mu_disp
#> attr(,"unscale_design")$multipliers$mu_disp$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_disp$value
#> [1] 1
#>
#>
#> attr(,"unscale_design")$multipliers$mu_wt
#> attr(,"unscale_design")$multipliers$mu_wt$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_wt$value
#> [1] 1
#>
#>
#> attr(,"unscale_design")$multipliers$mu_hp
#> attr(,"unscale_design")$multipliers$mu_hp$type
#> [1] "constant"
#>
#> attr(,"unscale_design")$multipliers$mu_hp$value
#> [1] 1
#>
#>
#>
#> attr(,"unscale_design")$state_constants
#> named numeric(0)
#>
#> attr(,"unscale_design")$owner_scope
#> [1] "compiler"
#>
#> attr(,"unscale_design")$complete
#> [1] FALSE
#>
#>
#> $random_effects_interface
#> [1] "none"
#>
# Two groups give wt and hp independent global scales.
separate <- list(intercept = intercept,
sh_wt = prior_regularized("horseshoe", global, terms = "wt"),
sh_hp = prior_regularized("horseshoe", global, terms = "hp"))
# One global scale for Wind and Month. Month has one local horseshoe
# scale for all four of its centered coordinates. Wind has its own.
weather <- transform(airquality, Month = factor(Month))
group <- prior_regularized("horseshoe", global, terms = c("Month", "Wind"),
contrast = "meandif")
centered <- JAGS_formula(~ Month + Wind, "mu", weather,
prior_list = list(intercept = intercept, sh = group))
# Group lasso on the orthonormal month coordinates.
month_lasso <- prior_regularized("lasso", global, terms = "Month",
contrast = "orthonormal")