rppi | R Documentation |
Given parameters of the PPI model, generates independent samples.
rppi(n, ..., paramvec = NULL, maxden = 4, maxmemorysize = 1e+05)
rppi_egmodel(n, maxden = 4)
n |
Number of samples to generate |
... |
Arguments passed on to
|
paramvec |
The PPI parameter vector, created easily using |
maxden |
This is the constant |
maxmemorysize |
Advanced use. The maximum size, in bytes, for matrices containing simulated Dirichlet samples. The default of |
We recommend running rppi()
a number of times to ensure the choice of maxden
is good. rppi()
will error when maxden
is too low.
The simulation uses a rejection-sampling algorithm with Dirichlet proposal \insertCite@Appendix A.1.3 @scealy2023scscorematchingad.
Initially n
Dirichlet proposals are generated. After rejection there are fewer samples remaining, say n^*
.
The ratio n^*/n
is used to guess the number of new Dirichlet proposals to generate until n
samples of the PPI model are reached.
Advanced use: The number of Dirichlet proposals created at a time is limited such that the matrices storing the Dirchlet proposals are always smaller than maxmemorysize
bytes (give or take a few bytes for wrapping).
Larger maxmemorysize
leads to faster simulation so long as maxmemorysize
bytes are reliably contiguously available in RAM.
A matrix with n
rows and p
columns. Each row is an independent draw from the specified PPI distribution.
rppi_egmodel
returns a list:
sample
A matrix of the simulated samples (n
rows)
p
The number of components of the model
theta
The PPI parameter vector
AL
The A_L
parameter matrix
bL
The b_L
parameter vector
beta
The \beta
parameter vector
rppi_egmodel()
: Simulates the 3-component PPI model from \insertCite@Section 2.3, @scealy2023scscorematchingad and returns both simulations and model parameters.
Other PPI model tools:
dppi()
,
ppi()
,
ppi_param_tools
,
ppi_robust()
beta0=c(-0.8, -0.8, -0.5)
AL = diag(nrow = 2)
bL = c(2, 3)
samp <- rppi(100,beta=beta0,AL=AL,bL=bL)
rppi_egmodel(1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.