Add weights to `draws`

objects, with one weight per draw, for use in
subsequent weighting operations. For reasons of numerical accuracy, weights
are stored in the form of unnormalized log-weights (in a variable called
`.log_weight`

). See `weights.draws()`

for details how to extract weights from
`draws`

objects.

weight_draws(x, weights, ...)
# S3 method for draws_matrix
weight_draws(x, weights, log = FALSE, ...)
# S3 method for draws_array
weight_draws(x, weights, log = FALSE, ...)
# S3 method for draws_df
weight_draws(x, weights, log = FALSE, ...)
# S3 method for draws_list
weight_draws(x, weights, log = FALSE, ...)
# S3 method for draws_rvars
weight_draws(x, weights, log = FALSE, ...)

## Arguments

x |
(draws) A `draws` object or another R object for which the method
is defined. |

weights |
(numeric vector) A vector of weights of length `ndraws(x)` .
Weights will be internally stored on the log scale (in a variable called
`.log_weight` ) and will not be normalized, but normalized (non-log) weights
can be returned via the `weights.draws()` method later. |

... |
Arguments passed to individual methods (if applicable). |

log |
(logicla) Are the weights passed already on the log scale? The
default is `FALSE` , that is, expecting `weights` to be on the standard
(non-log) scale. |

## Value

A `draws`

object of the same class as `x`

.

## See also

## Examples

#> [1] 1.9344030 0.7445487 2.1868616 0.8625128 0.5622111 1.3747321

#> [1] 0.004921318 0.001894208 0.005563598 0.002194320 0.001430322 0.003497458

#> [1] 1.9344030 0.7445487 2.1868616 0.8625128 0.5622111 1.3747321

#> [1] -5.314179 -6.268955 -5.191510 -6.121883 -6.549856 -5.655719

#> [1] 0.6597987 -0.2949770 0.7824675 -0.1479052 -0.5758779 0.3182589

#> [1] 0.004921318 0.001894208 0.005563598 0.002194320 0.001430322 0.003497458

#> [1] 0.6597987 -0.2949770 0.7824675 -0.1479052 -0.5758779 0.3182589