View source: R/as_data_frame.R
| as.data.frame.dynamitefit | R Documentation |
dynamitefit Object as a Data FrameProvides a data.frame representation of the posterior samples of the model
parameters.
## S3 method for class 'dynamitefit'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
types = NULL,
parameters = NULL,
responses = NULL,
times = NULL,
groups = NULL,
summary = FALSE,
probs = c(0.05, 0.95),
include_fixed = TRUE,
...
)
x |
[ |
row.names |
Ignored. |
optional |
Ignored. |
types |
[ |
parameters |
[ |
responses |
[ |
times |
[ |
groups |
[ |
summary |
[ |
probs |
[ |
include_fixed |
[ |
... |
Ignored. |
The arguments responses and types can be used to extract only a subset
of the model parameters (i.e., only certain types of parameters related to a
certain response variable).
Potential values for the types argument are:
alpha
Intercept terms (time-invariant or time-varying).
beta
Time-invariant regression coefficients.
cutpoint
Cutpoints for ordinal regression.
delta
Time-varying regression coefficients.
nu
Group-level random effects.
lambda
Factor loadings.
kappa
Contribution of the latent factor loadings in the total
variation.
psi
Latent factors.
tau
Standard deviations of the spline coefficients of delta.
tau_alpha
Standard deviations of the spline coefficients of
time-varying alpha.
sigma_nu
Standard deviations of the random effects nu.
corr_nu
Pairwise within-group correlations of random effects nu.
Samples of the full correlation matrix can be extracted manually as
rstan::extract(fit$stanfit, pars = "corr_matrix_nu") if necessary.
sigma_lambda
Standard deviations of the latent factor loadings
lambda.
corr_psi
Pairwise correlations of the noise terms of the latent
factors. Samples of the full correlation matrix can be extracted
manually as rstan::extract(fit$stanfit, pars = "corr_matrix_psi") if
necessary.
sigma
Standard deviations of Gaussian responses.
corr
Pairwise correlations of multivariate Gaussian responses.
phi
Describes various distributional parameters, such as:
Dispersion parameter of the Negative Binomial distribution.
Shape parameter of the Gamma distribution.
Precision parameter of the Beta distribution.
Degrees of freedom of the Student t-distribution.
omega
Spline coefficients of the regression coefficients delta.
omega_alpha
Spline coefficients of time-varying alpha.
omega_psi
Spline coefficients of the latent factors psi. Note that
in case of nonzero_lambda = FALSE, mean of these are used to flip the
sign of psi to avoid multimodality due to sign-switching, but
omega_psi variables are not modified.
zeta
Total variation of latent factors, i.e., the sum
of sigma_lambda and tau_psi.
A tibble containing either samples or summary statistics of the
model parameters in a long format. For a wide format, see
as_draws.dynamitefit().
Model outputs
as.data.table.dynamitefit(),
as_draws_df.dynamitefit(),
coef.dynamitefit(),
confint.dynamitefit(),
dynamite(),
get_code(),
get_data(),
get_parameter_dims(),
get_parameter_names(),
get_parameter_types(),
ndraws.dynamitefit(),
nobs.dynamitefit()
data.table::setDTthreads(1) # For CRAN
as.data.frame(
gaussian_example_fit,
responses = "y",
types = "beta"
)
# Basic summaries can be obtained automatically with summary = TRUE
as.data.frame(
gaussian_example_fit,
responses = "y",
types = "beta",
summary = TRUE
)
# Time-varying coefficients "delta"
as.data.frame(
gaussian_example_fit,
responses = "y",
types = "delta",
summary = TRUE
)
# Obtain summaries for a specific parameters
as.data.frame(
gaussian_example_fit,
parameters = c("tau_y_x", "sigma_y"),
summary = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.