The as_draws_matrix()
methods convert
objects to the draws_matrix
format.
The draws_matrix()
function creates an object of the
draws_matrix
format based on a set of numeric vectors.
See Details.
as_draws_matrix(x, ...) # S3 method for default as_draws_matrix(x, ...) # S3 method for draws_matrix as_draws_matrix(x, ...) # S3 method for draws_array as_draws_matrix(x, ...) # S3 method for draws_df as_draws_matrix(x, ...) # S3 method for draws_list as_draws_matrix(x, ...) # S3 method for mcmc as_draws_matrix(x, ...) # S3 method for mcmc.list as_draws_matrix(x, ...) draws_matrix(...) is_draws_matrix(x)
x | An object to convert to a |
---|---|
... | For |
A draws_matrix
object, which has classes
c("draws_matrix", "draws", "matrix")
.
Objects of class "draws_matrix"
are matrices (2-D arrays) with
dimensions "draw"
and "variable"
. This format does not store any
information about which MCMC chain the draws are from and so we simply
refer to the rows as draws and not iterations (unlike for the
draws_array
format). See Examples.
Other formats:
draws_array()
,
draws_df()
,
draws_list()
,
draws
#> [1] "draws_matrix" "draws" "matrix"print(x1)#> # A draws_matrix: 400 draws, and 10 variables #> variable #> draw mu tau theta[1] theta[2] theta[3] theta[4] theta[5] theta[6] #> 1 2.01 2.8 3.96 0.271 -0.74 2.1 0.923 1.7 #> 2 1.46 7.0 0.12 -0.069 0.95 7.3 -0.062 11.3 #> 3 5.81 9.7 21.25 14.931 1.83 1.4 0.531 7.2 #> 4 6.85 4.8 14.70 8.586 2.67 4.4 4.758 8.1 #> 5 1.81 2.8 5.96 1.156 3.11 2.0 0.769 4.7 #> 6 3.84 4.1 5.76 9.909 -1.00 5.3 5.889 -1.7 #> 7 5.47 4.0 4.03 4.151 10.15 6.6 3.741 -2.2 #> 8 1.20 1.5 -0.28 1.846 0.47 4.3 1.467 3.3 #> 9 0.15 3.9 1.81 0.661 0.86 4.5 -1.025 1.1 #> 10 7.17 1.8 6.08 8.102 7.68 5.6 7.106 8.5 #> # ... with 390 more draws, and 2 more variablesstr(x1)#> 'draws_matrix' num [1:400, 1:10] 2.01 1.46 5.81 6.85 1.81 ... #> - attr(*, "dimnames")=List of 2 #> ..$ draw : chr [1:400] "1" "2" "3" "4" ... #> ..$ variable: chr [1:10] "mu" "tau" "theta[1]" "theta[2]" ...#> [1] "draws_matrix" "draws" "matrix"print(x2)#> # A draws_matrix: 10 draws, and 3 variables #> variable #> draw a b c #> 1 0.424 -0.39 1 #> 2 1.063 -0.79 1 #> 3 1.049 -1.06 1 #> 4 -0.038 -0.80 1 #> 5 0.486 -1.76 1 #> 6 1.673 -0.69 1 #> 7 -0.354 -0.56 1 #> 8 0.946 -0.54 1 #> 9 1.317 0.23 1 #> 10 -0.297 0.98 1str(x2)#> 'draws_matrix' num [1:10, 1:3] 0.4242 1.0631 1.0487 -0.0381 0.4861 ... #> - attr(*, "dimnames")=List of 2 #> ..$ draw : chr [1:10] "1" "2" "3" "4" ... #> ..$ variable: chr [1:3] "a" "b" "c"