Introduction
The standard meta-d’ model assumes that participants have the same
metacognitive sensitivity for both type 1 responses. As noted by Maniscalco & Lau (2014), this assumption can be
relaxed to allow different metacognitive sensitivities for each of the
two type 1 responses in a variant of the meta-d’ model known as the
response-specific meta-d’ model. Maniscalco &
Lau (2014) showed that the
response-specific meta-d’ model is much better suited for predicting the
asymmetric ROCs generated by the unequal variance gaussian signal
detection model (though, see
vignette("alternative_distributions") for another approach
to modeling asymmetric ROCs).
The response-specific meta-d’ model is parameterized in the same way as the standard meta-d’ model, except with separate type 2 parameters for each type 1 response. Specifically, now the type 2 evidence is distributed as follows:
x_2 \sim \begin{cases} \mathcal{D}_S^{(-\infty, \textrm{meta-}c_0]}\left(\textrm{meta-}d'_0\right) & \textrm{if } R=0 \\ \mathcal{D}_S^{[\textrm{meta-}c_1, \infty)}\left(\textrm{meta-}d'_1\right) & \textrm{if } R=1 \end{cases}
This leads to analogous type 2 response probabilities as with the standard meta-d’ model, only using the response-specific values \textrm{meta-}d'_0, \textrm{meta-}d'_1, \textrm{meta-}c_0, and \textrm{meta-}c_1:
\begin{align*} P(C=c \;\vert\; R=r,S=s) &= \begin{cases} \frac{F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_0\right) - F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_{2,1}^0\right)} {F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_0\right)} & \textrm{if } r=0, c=1 \\ \frac{F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_{2,k}^0\right) - F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_{2,k+1}^0\right)} {F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_0\right)} & \textrm{if } r=0, 1 \le c \le K \\ \frac{F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_{2,K}^0\right)} {F_{\mathcal{D}_s(\textrm{meta-}d'_0)}\left(\textrm{meta-}c_0\right)} & \textrm{if } r=0, c = K \\ \frac{F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_{2,1}^1\right) - F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_1 \right)} {1 - F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_1\right)} & \textrm{if } r=1, c=1 \\ \frac{F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_{2,k+1}^1\right) - F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_{2,k}^1\right)} {1 - F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_1\right)} & \textrm{if } r=1, 1 \le c \le K \\ \frac{1 - F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_{2,K}^1 \right)} {1 - F_{\mathcal{D}_s(\textrm{meta-}d'_1)}\left(\textrm{meta-}c_1\right)} & \textrm{if } r=1, c = K \end{cases} \end{align*}
The model is parameterized similarly, only with two separate M-ratios, M_0 =
\frac{\textrm{meta-}d'_0}{d'} and M_1 = \frac{\textrm{meta-}d'_1}{d'}.
In R, the main parameter of the model is M_1, and M_0
is represented by the additional parameter Mzero.
Model fitting
To demonstrate how to fit the response-specific meta-d’ model, we
first load necessary packages in R and set a random seed
for reproducibility:
We can simulate data from the response-specific meta-d’ model using
the function sim_metad, specifying separate values of M-ratio for each type 1 response and using
the argument response_specific=TRUE:
d <- sim_metad(1000, M_0 = 0.5, M_1 = 1.5, response_specific = TRUE) |>
mutate(joint_response = joint_response(response, confidence, K = 4))
d
#> # A tibble: 1,000 × 15
#> # Groups: stimulus, response, confidence [16]
#> trial stimulus response correct confidence dprime c meta_dprime M
#> <int> <int> <int> <int> <int> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0 0 1 1 1 0 0.5 0.5
#> 2 2 0 0 1 1 1 0 0.5 0.5
#> 3 3 0 0 1 1 1 0 0.5 0.5
#> 4 4 0 0 1 1 1 0 0.5 0.5
#> 5 5 0 0 1 1 1 0 0.5 0.5
#> 6 6 0 0 1 1 1 0 0.5 0.5
#> 7 7 0 0 1 1 1 0 0.5 0.5
#> 8 8 0 0 1 1 1 0 0.5 0.5
#> 9 9 0 0 1 1 1 0 0.5 0.5
#> 10 10 0 0 1 1 1 0 0.5 0.5
#> # ℹ 990 more rows
#> # ℹ 6 more variables: meta_c2_0 <list>, meta_c2_1 <list>, theta <dbl>,
#> # theta_1 <dbl>, theta_2 <dbl>, joint_response <int>First, we’ll fit the standard meta-d’ model assuming equal metacognitive sensitivities for the two responses:
m_standard <- fit_metad(
N ~ 1, d,
prior = set_prior("std_normal()", class = "Intercept"),
cores = 4, init = 0, refresh = 0
)#> Family: metad__4__normal__absolute__multinomial
#> Links: mu = log
#> Formula: N ~ 1
#> Data: data.aggregated (Number of observations: 1)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Regression Coefficients:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept -0.02 0.15 -0.32 0.26 1.00 3308 2958
#>
#> Further Distributional Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> dprime 0.99 0.08 0.83 1.15 1.00 4330 3458
#> c 0.03 0.04 -0.05 0.11 1.00 3685 3002
#> metac2zero1diff 0.49 0.03 0.43 0.56 1.00 4437 3266
#> metac2zero2diff 0.56 0.04 0.49 0.65 1.00 5047 2983
#> metac2zero3diff 0.52 0.05 0.43 0.62 1.00 5329 3567
#> metac2one1diff 0.51 0.04 0.44 0.59 1.00 3840 3087
#> metac2one2diff 0.44 0.04 0.37 0.52 1.00 4770 2789
#> metac2one3diff 0.52 0.05 0.43 0.62 1.00 4974 2730
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
Already from the model summary, we can see that the estimated M-ratio of approximately one (zero on the logarithmic scale) does not represent the data-generating M-ratios for either response. Instead, it is the average of the two M-ratios.
To fix this problem, now we’ll fit the response-specific model by
using the additional argument response_specific=TRUE and by
providing corresponding formulas and priors for the new parameter
Mzero:
m_rs <- fit_metad(
bf(N ~ 1, Mzero ~ 1), d,
prior = set_prior("std_normal()", class = "Intercept") +
set_prior("std_normal()", class = "Intercept", dpar = "Mzero"),
cores = 4, refresh = 0, response_specific = TRUE
)#> Family: rsmetad__4__normal__absolute__multinomial
#> Links: mu = log; Mzero = log
#> Formula: N ~ 1
#> Mzero ~ 1
#> Data: data.aggregated (Number of observations: 1)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Regression Coefficients:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 0.41 0.15 0.11 0.69 1.00 3236 2583
#> Mzero_Intercept -0.62 0.32 -1.36 -0.12 1.00 3198 2099
#>
#> Further Distributional Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> dprime 0.98 0.08 0.83 1.15 1.00 3847 3132
#> c 0.05 0.04 -0.03 0.13 1.00 3833 3230
#> metac2zero1diff 0.47 0.03 0.41 0.54 1.00 4033 2968
#> metac2zero2diff 0.54 0.04 0.47 0.62 1.00 4990 3089
#> metac2zero3diff 0.50 0.05 0.41 0.60 1.00 5431 2924
#> metac2one1diff 0.55 0.04 0.47 0.63 1.00 4093 2925
#> metac2one2diff 0.47 0.04 0.40 0.56 1.00 4994 3085
#> metac2one3diff 0.55 0.05 0.46 0.65 1.00 4729 3169
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
Now we see that the two estimated M-ratios reflect their true values.
Model estimates
All of the post-processing functions in hmetad work in
the same way for the response-specific meta-d’ model. For example, here
we gather posterior draws of the pseudo-type 1 ROC curves:
newdata <- tibble(.row = 1)
draws.roc1 <- bind_rows(
roc1_rvars(m_standard, newdata) |> mutate(model = "Standard"),
roc1_rvars(m_rs, newdata) |> mutate(model = "Response-Specific")
)Then, we can compare these estimates against the data:
draws.roc1 |>
median_qi(p_hit, p_fa) |>
ggplot(aes(
x = p_fa, xmin = p_fa.lower, xmax = p_fa.upper,
y = p_hit, ymin = p_hit.lower, ymax = p_hit.upper,
linetype = model
)) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
geom_errorbar(orientation = "y", width = .01) +
geom_errorbar(orientation = "x", width = .01) +
geom_line() +
geom_point(aes(x = p_fa, y = p_hit), data = roc1(d), inherit.aes = FALSE) +
coord_fixed(xlim = 0:1, ylim = 0:1, expand = FALSE) +
xlab("P(False Alarm)") +
ylab("P(Hit)") +
scale_linetype_discrete("Model") +
theme_bw(18)
#> `hmetad` has inferred that there are K=4 confidence levels in the data. If this is incorrect, please set this manually using the argument `K=<K>`From this plot, it is apparent that the standard meta-d’ model
under-predicts sensitivity for the "1" responses (left side
of the curve) and over-predicts sensitivity for the "0"
responses (right side of the curve). In contrast, here the
response-specific model properly recovers the correct response
probabilities.
Similarly, we can obtain posterior estimates of the type 2 ROC curves:
draws.roc2 <- bind_rows(
roc2_rvars(m_standard, newdata) |> mutate(model = "Standard"),
roc2_rvars(m_rs, newdata) |> mutate(model = "Response-Specific")
)Again, we can compare these estimates against the data:
draws.roc2 |>
median_qi(p_hit2, p_fa2) |>
mutate(
response = factor(response),
model = factor(model, levels = c("Standard", "Response-Specific"))
) |>
ggplot(aes(
x = p_fa2, xmin = p_fa2.lower, xmax = p_fa2.upper,
y = p_hit2, ymin = p_hit2.lower, ymax = p_hit2.upper,
color = response, linetype = model
)) +
geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
geom_errorbar(orientation = "y", width = .01) +
geom_errorbar(orientation = "x", width = .01) +
geom_line() +
geom_point(aes(x = p_fa2, y = p_hit2, color = response),
data = mutate(roc2(d), response = factor(response)), inherit.aes = FALSE
) +
coord_fixed(xlim = 0:1, ylim = 0:1, expand = FALSE) +
xlab("P(Type 2 False Alarm)") +
ylab("P(Type 2 Hit)") +
scale_color_discrete("Type 1\nResponse") +
scale_linetype_discrete("Model") +
theme_bw(18)
#> `hmetad` has inferred that there are K=4 confidence levels in the data. If this is incorrect, please set this manually using the argument `K=<K>`The type 2 ROC curves make apparent that, in this case, there are two
different metacognitive sensitivities for the two type 1 responses.
Additionally, while the standard model incorrectly assumes equal
metacognitive sensitivity across type 1 responses, the response-specific
model correctly infers that metacognitive sensitivity is higher for
"1" responses than "0" responses.
Model comparison
The above plot is qualitatively clear that the response-specific
model outperforms the standard model in predicting the data. However,
real datasets will usually not be so clear, in which case it is often
worth performing a formal model comparison. Here we will use the
loo package which computes approximate
leave one out
cross-validated estimates of out-of-sample predictive performance on
models fit using hmetad (or brms more
generally).
Usually, in LOO cross validation, we want to leave out individual
trials. But since hmetad aggregates trials by default,
loo will attempt to leave out a single row in the dataset,
which corresponds to the smallest cell in our task design matrix (e.g.,
all trials for a single participant within a single condition). To
ensure that we are actually leaving out individual trials, we first
re-fit both models using the trial-level likelihood (see
vignette("categorical") for more information):
m_standard <- fit_metad(
joint_response | vint(stimulus) ~ 1, d,
prior = set_prior("std_normal()", class = "Intercept"),
cores = 4, refresh = 0, categorical = TRUE
)
m_rs <- fit_metad(
bf(joint_response | vint(stimulus) ~ 1, Mzero ~ 1),
d,
prior = set_prior("std_normal()", class = "Intercept") +
set_prior("std_normal()", class = "Intercept", dpar = "Mzero"),
cores = 4, refresh = 0, response_specific = TRUE, categorical = TRUE,
)Next, we can use the loo function to estimate the
predictive performance of each model and loo_compare to
compare the models against one another:
loo_standard <- loo(m_standard, cores = 4)
loo_rs <- loo(m_rs, cores = 4)
loo_compare(loo_standard, loo_rs)
#> model elpd_diff se_diff p_worse diag_diff diag_elpd
#> m_rs 0.0 0.0 NA
#> m_standard -6.8 4.0 0.95Now we have very strong evidence that the response-specific model indeed outperforms the standard model in predicting the data!
Conclusions
In cases where it is reasonable to assume that participants may have
different metacognitive insight depending on which type 1 response they
made, the response-specific meta-d’ model is a useful tool for
recovering this pattern. In the hmetad package, using the
response-specific model is as simple as setting the argument
response_specific=TRUE.