idealstan 1.1
New features
- Multidimensional ideal points:
id_estimate(num_dim = )
estimates ideal points and discriminations on more than one dimension,
for every model type and time process. With
const_type = "persons", restrict_ind_dim names
the person who identifies each extra dimension; with
const_type = "items", the discriminations are lower
triangular; fixtype = "vb_full" chooses the persons or
items itself. Summaries have a Dimension column,
id_plot_persons(), id_plot_persons_dyn(),
id_plot_legis_var() and id_plot_cov() have a
dim argument, and id_post_pred(),
id_me(), id_extract() and
id_sim_gen(num_dim = ) handle every dimension.
One-dimensional models are unchanged.
- Correlated discriminations:
id_estimate(discrim_corr = TRUE) lets each item’s
discrimination for the observed outcome and for missingness be
correlated, with one correlation shared by all items (a Gaussian copula,
so each discrimination keeps its prior). discrim_corr_eta
sets the prior on the correlation,
summary(fit, pars = "discrim_corr") reports it, and
id_sim_gen(discrim_corr = ) simulates it.
- Models can be estimated with ‘stanr’ (https://github.com/andrjohns/stanr), which runs Stan
inside R and doesn’t need a CmdStan installation, as well as with
‘cmdstanr’:
id_estimate(backend = "stanr"), or
options(idealstan.backend = "stanr"). By default,
‘cmdstanr’ is used if it and CmdStan are installed, and ‘stanr’
otherwise. With ‘stanr’, MCMC chains all start from the same initial
values.
- Binomial outcomes (model types 17 and 18, the second with
missing-data inflation): the new
outcome_trials argument of
id_make() gives the number of trials, and
id_sim_gen(model_type = "binomial", binom_trials = )
simulates them.
- Parallel processing uses the ‘future’ framework instead of
parallel::mclapply(), which forks and failed in some IDEs
(such as Positron) and on Windows. A plan set with
future::plan() is used; otherwise cores or
use_cores above 1 starts a multisession plan for the call.
id_post_pred() (and so id_me() and
id_plot_cov()) and
summary(fit, pars = "items") run in parallel.
id_make() no longer needs an ordered_id
column when every item is ordinal: the number of categories is counted
from the data. It is still needed when ordinal items are combined with
other types of items.
id_estimate() warns when an inflated model has no
missing outcomes, and stops when the same person or item is in both
restrict_ind_high and restrict_ind_low.
id_backend_available() says whether the backend that
id_estimate() would use (‘cmdstanr’ with CmdStan, or
‘stanr’) is installed. The examples that estimate models run only when
it is, so they no longer fail where neither is installed, as in CRAN’s
checks with --run-donttest.
Changes that can alter
results
- Poisson counts were fitted as their rank among the observed values
(counts of 0, 5 and 100 as 1, 2 and 3). Count models now use the
counts.
- The values of pinned persons or items (
fix_high,
fix_low) were rounded down to whole numbers. With
map_over_id = "items" or const_type = "items",
several pins could also be given to the wrong persons or items.
- Discrimination bounds wider than the default
(
discrim_reg_lb, discrim_reg_upb) were capped
at -0.999 and 0.999; they are now used as given.
id_post_pred(type = "log_lik") returned matrices of the
wrong shape for most model types, so loo() results were
wrong. It now returns draws by observations and, for inflated models,
includes the missing-data model, as the Stan model does.
restrict_var and time_fix_sd are removed.
id_estimate() warns and ignores them. Random-walk models
with map_over_id = "items" now fit.
Bug fixes
- Missing values in inflated models and in data that mix model types
(#42, #43): when an inflated model had no missing outcomes, every
observed value was modelled as missing; missing values of non-inflated
items could make observed values of inflated items count as missing; and
ordered beta items were dropped when combined with discrete items.
id_post_pred():
type = "epred" failed for ordinal, Poisson, Normal,
log-normal and ordered beta models, and so did
id_me().
- Normal and log-normal predictions used the first item’s residual SD
for every item, and ordered beta predictions could use another item’s
cutpoints.
- Latent-space probabilities didn’t match the Stan model, and inflated
latent-space probabilities were doubled.
- Item covariates were ignored.
- Ordered beta
log_lik didn’t match Stan for outcomes
very close to 0 or 1.
- Predictions of binary and latent-space models were one more than the
outcome (1 and 2 rather than 0 and 1), so
id_plot_ppc()
showed the predictions next to the wrong observed values.
- Ordinal predictions, and predictions of missing values
(
output = "missing") of Poisson, Normal, log-normal and
ordered beta models, had one row per person rather than one per draw
when there were more persons than draws.
output was ignored for binary and ordinal models. It
now works for every model type: "observed" predicts the
outcome, "missing" whether it is missing, and the new
"all" both, with missing values as their own category (the
default for binary and ordinal models, as before).
item_subset failed.
id_plot_ppc():
group plotted every person rather than only those
given, item picked model types rather than items (so it
failed or plotted the wrong items), and which_mod always
failed when there was more than one model type.
- With
combine_item = FALSE, Poisson and binomial models
plotted only the missing outcomes, or failed without missing-data
inflation. The plots are now also returned, as a list.
observed_only = TRUE compared the observed outcomes
with predictions that included missing values. It now needs predictions
made with id_post_pred(output = "observed").
use_groups = TRUE with fixtype = "prefix"
always failed (“Your restricted persons/items are not in the data”),
because id_make() stored the groups as integers and lost
their labels. The labels are kept again, so groups are pinned by label
with restrict_ind_high, restrict_ind_low and
restrict_ind_dim, and summaries and plots show them. Models
fitted with idealstan 1.0 still show the labels.
id_plot_persons() with include or
sample_persons plotted no one (or, with numeric IDs, the
wrong persons), and id_plot_persons() and
id_plot_persons_dyn() failed when item_plot
was given numeric item IDs.
launch_shinystan() needed an unreleased version (3.0.0)
of ‘shinystan’, so it always failed with the version on CRAN, and it
ignored pars. It now works with ‘shinystan’ 2.6.0 or later,
for models fitted with either backend, and shows the parameters in
pars. Pathfinder and Laplace fits are shown without sampler
diagnostics.
id_estimate(use_method = "pathfinder") sometimes failed
(“Fitting failed. Unable to retrieve the draws.”) when Pathfinder
couldn’t start from the starting values found for it. It now tries again
from random starting values. When no starting values could be found,
id_estimate() failed rather than trying the Laplace
approximation and then random starting values, and starting values of
missing-data discriminations close to -1 or 1 changed the observed
discriminations instead.
- Positive discriminations failed:
discrim_reg_lb = 0
gave non-finite log densities, and positive lower and upper bounds (the
exponential prior) failed at initialization.
id_sim_gen() drew discriminations from the wrong
generalized beta distribution when its two shape parameters differed,
and with latent_space = TRUE drew persons from a much wider
space than the items, which left most of their ideal points
unidentified. Persons are now drawn from the same space as the items,
and the intercepts from Normal(0, 0.5).
summary(fit, pars = "items"):
- It failed for inflated rating-scale models (model type 4).
- For rating-scale and graded response models, it added three spurious
midpoints per item, reported the missing-data discrimination as the
inflated difficulty, failed with
aggregated = FALSE, and
gave graded response items a midpoint only for their last cutpoint.
summary(fit, pars = "person_cov") failed for pathfinder
and Laplace fits, and item covariate summaries mislabelled the
covariates.
id_me() failed for time-varying models after a change
in ‘dplyr’ (duplicate column names).
id_plot_persons() and
id_plot_persons_dyn() with item_plot failed
for models without groups.
id_plot_irf() referred to an undefined model type.
idealstan 1.0
- switched to
cmdstanr as back-end (requires additional
installation)
- added
id_me method for calculating ideal point marginal
effects for covariates
- added ordered beta distribution for items (bounded continuous
measures)
- added splines as possible time series functions
- updated vignettes with new features
- changed
legis functions to person
functions (old functions kept as deprecated)
idealstan 0.7.2
- Updated to be compatible with most recent
rstan
(version 2.19.2).
- Added
id_plot_cov function for marginal effects
plotting of covariates.
- Added
id_plot_irf for calculating impulse-response
functions for AR(1) models covariates.
idealstan 0.7.1
- Fixed bug where time series vignette did not show on CRAN
screen
idealstan 0.7.0
- Implement a Gaussian process prior for ideal points to permit
semi-parametric inference
- Update
id_plot_legis_dyn to allow for overlay plots
comparing different time series models
- Strength over-time model identification using variational inference
fits
idealstan 0.6.0
- Set a stricter threshold for
vb to 1e-04
to promote more robust variational inference
idealstan 0.5.1
- Fixed bugs in plotting functions related to plotting two
groups.
- Fixed bug in AR(1) model with restricted time variance.
- Updated dependencies to rstan 2.18.2.
- Added error-catching in covariate creation.
idealstan 0.5.0
- New models for Poisson, ordinal-graded response, Normal and
Log-normal outcomes.
- Time-varying ideal point processes: random-walks and auto-regressive
priors.
- Time-varying plot functions for ideal points.
- Hierarchical covariates for ideal points and item/bill
discrimination.
- Switched from matrix data input to long data frames.
idealstan 0.2.9.1
- Fixed bugs in
id_extract and id_make
functions.
idealstan 0.2.9
- Fixed a bug in the ideal point plot function, and also in the
auto_id option in id_estimate.
idealstan 0.2.2
- First release on CRAN.
- Fixed documentation issues from v0.2.1
- All vignettes now building properly.