Skip to content

Commit

Permalink
update website
Browse files Browse the repository at this point in the history
saudiwin committed Dec 25, 2024
1 parent 44bd6c8 commit 889e7d3
Showing 38 changed files with 3,937 additions and 772 deletions.
Binary file modified _quarto/freeze.rds
Binary file not shown.
8 changes: 8 additions & 0 deletions _quarto/man/id_me-idealstan-method.qmd
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ given person-level hierarchical covariate.
id_me(
object,
covariate = NULL,
group_effects = NULL,
pred_outcome = NULL,
eps = 1e-04,
draws = 100,
@@ -38,6 +39,13 @@ The character value for a covariate passed to the
'id_make' function before model fitting. Only one covariate can be processed
at a time.
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="group_effects">group_effects</code></td>
<td>
character value of a covariate included in the formula passed
to 'id_make' for which marginal effect summaries should be grouped by. Useful
when looking at the marginal effect of an interaction. Note that grouping by a covariate
with many values will result in slow performance.
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="pred_outcome">pred_outcome</code></td>
<td>
Numeric value for level of outcome to predict for ordinal responses.
61 changes: 22 additions & 39 deletions _quarto/man/id_plot_cov.qmd
Original file line number Diff line number Diff line change
@@ -4,11 +4,10 @@

### Description

This function will calculate marginal effects, or the first derivative
This function will calculate and plot the ideal point marginal effects, or the first derivative
of the IRT/ideal point model with respect to the hierarchical covariate,
separately for the two poles of the latent variable. These two marginal
effects permit the interpretation of the effect of the covariate on
with respect to either end of the latent variable.
for each item in the model. The function <code>id_me</code> is used
to first calculate the ideal point marginal effects.



@@ -19,12 +18,13 @@ with respect to either end of the latent variable.
calc_param = NULL,
label_high = "High",
label_low = "Low",
cov_type = "person_cov",
group_effects = NULL,
plot_model_id = NULL,
pred_outcome = NULL,
high_quantile = 0.95,
low_quantile = 0.05,
new_cov_names = NULL,
lb = 0.05,
upb = 0.95,
facet_ncol = 2,
cov_type = "person_cov",
...
)
</code></pre>
@@ -56,12 +56,6 @@ latent scale
What label to use on the plot for the low end of the
latent scale
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="cov_type">cov_type</code></td>
<td>
Either <code>'person_cov'</code> for person or group-level hierarchical parameters,
<code>'discrim_reg_cov'</code> for bill/item discrimination parameters from regular (non-inflated) model, and
<code>'discrim_infl_cov'</code> for bill/item discrimination parameters from inflated model.
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="plot_model_id">plot_model_id</code></td>
<td>
The integer of the model ID to plot. If NULL and there
@@ -75,50 +69,39 @@ or binary models with missing data, which outcome to predict. This should
be the value that matches what the outcome was coded as in the data
passed to <code>id_make</code>.
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="high_quantile">high_quantile</code></td>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="lb">lb</code></td>
<td>
The upper limit of the posterior density to use for
The lower limit of the posterior density to use for
calculating credible intervals
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="low_quantile">low_quantile</code></td>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="upb">upb</code></td>
<td>
The lower limit of the posterior density to use for
The upper limit of the posterior density to use for
calculating credible intervals
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="new_cov_names">new_cov_names</code></td>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="facet_ncol">facet_ncol</code></td>
<td>
A character vector of length equal to the number
of covariates (plus 1 for the intercept) to change the default labels.
To see the default labels, use the plot function with this option blank.
The character vector should be of th form used by
If facetting by multiple models or grouped factors, sets the
number of columns in the multiple plots
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="...">...</code></td>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="cov_type">cov_type</code></td>
<td>
Additional argument passed on to <code>id_me</code>
Either <code>'person_cov'</code> for person or group-level hierarchical parameters,
<code>'discrim_reg_cov'</code> for bill/item discrimination parameters from regular (non-inflated) model, and
<code>'discrim_infl_cov'</code> for bill/item discrimination parameters from inflated model.
</td></tr>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="filter_cov">filter_cov</code></td>
<tr><td style = "white-space: nowrap; font-family: monospace; vertical-align: top"><code id="...">...</code></td>
<td>
A character vector of coefficients from covariate plots to exclude from
plotting (should be the names of coefficients as they appear in the plots)
Additional argument passed on to <code>id_me</code>
</td></tr>
</table>


### Details

Because the marginal effects are always with respect to a given
outcome/response, the outcome to be predicted must be specified
in <code>pred_outcome</code>. If it is not specified, the function
will prompt you to select one of the outcome's values in the data.

The ends of the latent variable can be specified via the
<code>label_low</code> and <code>label_high</code> options, which will use those
labels in the ensuing plot.

To exclude parameters from the plot, use the <code>filter_cov</code> option.
Note that the parameters must be specified using the underlying model
syntax (however they are labeled in the plot). You can also change
the names of parameters using the <code>new_cov_names</code> option.
labels for item discrimination.

Note that the function produces a <code>ggplot2</code> object, which can
be further modified with <code>ggplot2</code> functions.
14 changes: 11 additions & 3 deletions _quarto/vignettes/Package_Introduction.qmd
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ title: "Introduction to Idealstan"
author: "Robert Kubinec"
date: last-modified
format: html
cache: true
vignette: >
%\VignetteIndexEntry{Time-Varying Ideal Points}
%\VignetteEngine{R.rsp::asis}
@@ -37,7 +36,7 @@ The approach to handling missing data in this package is to model cases where mi
The package includes the following models:

| Model ID | Model Type | Response Type | Missing Data Adjustment |
|-----------------|-----------------------|-----------------|-----------------|
|-----------------|---------------------|-----------------|-----------------|
| 1 | IRT 2-PL | Binary | No |
| 2 | IRT 2-PL | Binary | Yes |
| 3 | IRT rating scale | Ordinal | No |
@@ -88,6 +87,7 @@ To begin with, we can simulate data from an ordinal ideal-point model in which t
The function `id_sim_gen()` allows you to simulate data from any of the sixteen models currently implemented in `idealstan` (see previous list). To include missing data, specify the `inflate` option as `TRUE`. For example, here we sample data from an ordinal graded response model:

```{r sim_data}
#| cache: false
ord_ideal_sim <- id_sim_gen(model='ordinal_grm',inflate = T)
@@ -157,6 +157,8 @@ To demonstrate how the package functions empirically, I include in the package a
We can first take a look at the raw data:

```{r check_data}
#| cache: false
data('senate114')
@@ -243,6 +245,9 @@ The wide high-posterior density (HPD) interval of the absence midpoint ruglines
We can obtain summary estimates of all the ideal points and item/bill discrimination/difficulty parameters using the summary function that provides the median value of the parameters in addition to a specified posterior density interval (i.e., 5%-95%). For example, we can extract summaries for the ideal points:

```{r ideal_pts_sum}
#| cache: false
ideal_pts_sum <- summary(sen_est,pars='ideal_pts')
tt(head(ideal_pts_sum))
```
@@ -266,8 +271,9 @@ stan_trace(sen_est,par='L_full[1]')
Finally we can also extract all of the posterior iterations to do additional calculations that average over posterior uncertainty by changing the `aggregate` option in `summary`. In the following code, I access the individual posterior iterations for the item/bill parameters, including difficulty (average probability of voting yes), discrimination (how strongly the item/bill loads on either end of the ideal point scale) and the midpoints (position where someone with that ideal point would be indifferent to voting yes/no).

```{r ideal_pts_ind}
#| cache: false
item_all <- summary(sen_est,pars='items', aggregate=F)
knitr::kable(head(item_all))
tt(head(item_all))
```

## Hierarchical Covariates
@@ -358,6 +364,8 @@ Because these covariates are on the ideal point scale, the meaning of the scale
We can also extract the covariate summary values using the `summary` function:

```{r cov_values}
#| cache: false
cov_sum <- summary(sen_est_cov,pars='person_cov')
tt(cov_sum)
```
Binary file modified docs/freeze.rds
Binary file not shown.
9 changes: 9 additions & 0 deletions docs/man/id_me-idealstan-method.html
Original file line number Diff line number Diff line change
@@ -395,6 +395,7 @@ <h3 class="anchored" data-anchor-id="usage">Usage</h3>
id_me(
object,
covariate = NULL,
group_effects = NULL,
pred_outcome = NULL,
eps = 1e-04,
draws = 100,
@@ -425,6 +426,14 @@ <h3 class="anchored" data-anchor-id="arguments">Arguments</h3>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="group_effects">group_effects</code>
</td>
<td>
character value of a covariate included in the formula passed to ‘id_make’ for which marginal effect summaries should be grouped by. Useful when looking at the marginal effect of an interaction. Note that grouping by a covariate with many values will result in slow performance.
</td>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="pred_outcome">pred_outcome</code>
</td>
<td>
43 changes: 17 additions & 26 deletions docs/man/id_plot_cov.html
Original file line number Diff line number Diff line change
@@ -387,7 +387,7 @@
<h2 class="unnumbered anchored" data-anchor-id="marginal-effects-plot-for-hierarchical-covariates">Marginal Effects Plot for Hierarchical Covariates</h2>
<section id="description" class="level3">
<h3 class="anchored" data-anchor-id="description">Description</h3>
<p>This function will calculate marginal effects, or the first derivative of the IRT/ideal point model with respect to the hierarchical covariate, separately for the two poles of the latent variable. These two marginal effects permit the interpretation of the effect of the covariate on with respect to either end of the latent variable.</p>
<p>This function will calculate and plot the ideal point marginal effects, or the first derivative of the IRT/ideal point model with respect to the hierarchical covariate, for each item in the model. The function <code>id_me</code> is used to first calculate the ideal point marginal effects.</p>
</section>
<section id="usage" class="level3">
<h3 class="anchored" data-anchor-id="usage">Usage</h3>
@@ -396,12 +396,13 @@ <h3 class="anchored" data-anchor-id="usage">Usage</h3>
calc_param = NULL,
label_high = "High",
label_low = "Low",
cov_type = "person_cov",
group_effects = NULL,
plot_model_id = NULL,
pred_outcome = NULL,
high_quantile = 0.95,
low_quantile = 0.05,
new_cov_names = NULL,
lb = 0.05,
upb = 0.95,
facet_ncol = 2,
cov_type = "person_cov",
...
)
</code></pre>
@@ -443,14 +444,6 @@ <h3 class="anchored" data-anchor-id="arguments">Arguments</h3>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="cov_type">cov_type</code>
</td>
<td>
Either <code>‘person_cov’</code> for person or group-level hierarchical parameters, <code>‘discrim_reg_cov’</code> for bill/item discrimination parameters from regular (non-inflated) model, and <code>‘discrim_infl_cov’</code> for bill/item discrimination parameters from inflated model.
</td>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="plot_model_id">plot_model_id</code>
</td>
<td>
@@ -467,51 +460,49 @@ <h3 class="anchored" data-anchor-id="arguments">Arguments</h3>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="high_quantile">high_quantile</code>
<code id="lb">lb</code>
</td>
<td>
The upper limit of the posterior density to use for calculating credible intervals
The lower limit of the posterior density to use for calculating credible intervals
</td>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="low_quantile">low_quantile</code>
<code id="upb">upb</code>
</td>
<td>
The lower limit of the posterior density to use for calculating credible intervals
The upper limit of the posterior density to use for calculating credible intervals
</td>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="new_cov_names">new_cov_names</code>
<code id="facet_ncol">facet_ncol</code>
</td>
<td>
A character vector of length equal to the number of covariates (plus 1 for the intercept) to change the default labels. To see the default labels, use the plot function with this option blank. The character vector should be of th form used by
If facetting by multiple models or grouped factors, sets the number of columns in the multiple plots
</td>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="..."></code>
<code id="cov_type">cov_type</code>
</td>
<td>
Additional argument passed on to <code>id_me</code>
Either <code>‘person_cov’</code> for person or group-level hierarchical parameters, <code>‘discrim_reg_cov’</code> for bill/item discrimination parameters from regular (non-inflated) model, and <code>‘discrim_infl_cov’</code> for bill/item discrimination parameters from inflated model.
</td>
</tr>
<tr>
<td style="white-space: nowrap; font-family: monospace; vertical-align: top">
<code id="filter_cov">filter_cov</code>
<code id="..."></code>
</td>
<td>
A character vector of coefficients from covariate plots to exclude from plotting (should be the names of coefficients as they appear in the plots)
Additional argument passed on to <code>id_me</code>
</td>
</tr>
</tbody></table>
</section>
<section id="details" class="level3">
<h3 class="anchored" data-anchor-id="details">Details</h3>
<p>Because the marginal effects are always with respect to a given outcome/response, the outcome to be predicted must be specified in <code>pred_outcome</code>. If it is not specified, the function will prompt you to select one of the outcome’s values in the data.</p>
<p>The ends of the latent variable can be specified via the <code>label_low</code> and <code>label_high</code> options, which will use those labels in the ensuing plot.</p>
<p>To exclude parameters from the plot, use the <code>filter_cov</code> option. Note that the parameters must be specified using the underlying model syntax (however they are labeled in the plot). You can also change the names of parameters using the <code>new_cov_names</code> option.</p>
<p>The ends of the latent variable can be specified via the <code>label_low</code> and <code>label_high</code> options, which will use those labels for item discrimination.</p>
<p>Note that the function produces a <code>ggplot2</code> object, which can be further modified with <code>ggplot2</code> functions.</p>
</section>
<section id="value" class="level3">
20 changes: 10 additions & 10 deletions docs/search.json

Large diffs are not rendered by default.

Loading

0 comments on commit 889e7d3

Please sign in to comment.