Simulate example data for tar_stan_example_file().
Source: R/tar_stan_example_data.R
tar_stan_example_data.RdAn example dataset compatible with the model file
from tar_stan_example_file().
Format
A list with the following elements:
n: integer, number of data points.x: numeric, covariate vector.y: numeric, response variable.true_beta: numeric of length 1, value of the regression coefficientbetaused in simulation..join_data: a list of simulated values to be appended to as a.join_datacolumn in the output of targets generated by functions such astar_stan_mcmc_rep_summary(). Contains the regression coefficientbeta(numeric of length 1) and prior predictive datay(numeric vector).
Value
List, dataset compatible with the model file from
tar_stan_example_file().
Details
The tar_stan_example_data() function draws a Stan
dataset from the prior predictive distribution of the
model from tar_stan_example_file(). First, the
regression coefficient beta is drawn from its standard
normal prior, and the covariate x is computed.
Then, conditional on the beta draws and the covariate,
the response vector y is drawn from its
Normal(x * beta, 1) likelihood.
See also
Other examples:
tar_stan_example_file()
Examples
tar_stan_example_data()
#> $n
#> [1] 10
#>
#> $x
#> [1] -1.0000000 -0.7777778 -0.5555556 -0.3333333 -0.1111111 0.1111111
#> [7] 0.3333333 0.5555556 0.7777778 1.0000000
#>
#> $y
#> [1] 2.43169232 2.51720220 2.50244695 -1.00939646 0.02348177 -0.51500667
#> [7] -1.09512665 -1.90773472 -1.26666743 -0.37223872
#>
#> $true_beta
#> [1] -2.437264
#>
#> $.join_data
#> $.join_data$beta
#> [1] -2.437264
#>
#> $.join_data$y_rep
#> [1] 2.43169232 2.51720220 2.50244695 -1.00939646 0.02348177 -0.51500667
#> [7] -1.09512665 -1.90773472 -1.26666743 -0.37223872
#>
#>