Skip to content

Commit

Permalink
Update Data Sets & IMM Vignette
Browse files Browse the repository at this point in the history
I have updated the data sets to include factor codings for some variables and made sure that the dependent variables ranges from -pi to pi.
  • Loading branch information
GidonFrischkorn committed Feb 13, 2024
1 parent ab76a47 commit a95a7fc
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' \item{trial}{Trial identifyier}
#' \item{setsize}{The setsize of the data in this row}
#' \item{RespErr}{The response error, that is the difference between the reponse
#' given and the target color.}
#' given and the target color in radians.}
#' \item{Pos_Lure1, Pos_Lure2, Pos_Lure3, Pos_Lure4, Pos_Lure5}{Position of the lure items relative to the target color.}
#'
#' }
Expand All @@ -25,7 +25,7 @@
#' with set size 1 to 8 reported by Oberauer & Lin (2017).
#'
#' @format ## `OberauerLin_2017`
#' A data frame with 4,000 rows and 9 columns:
#' A data frame with 15,200 rows and 39 columns:
#' \describe{
#' \item{ID}{Integer uniquely identifying different subjects}
#' \item{Session}{Session number}
Expand Down
Binary file modified data/OberauerLin_2017.rda
Binary file not shown.
Binary file modified data/ZhangLuck_2008.rda
Binary file not shown.
Binary file modified inst/imm_vignette_fit.rds
Binary file not shown.
2 changes: 1 addition & 1 deletion man/OberauerLin_2017.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ZhangLuck_2008.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions vignettes/IMM.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,17 @@ simData$cond <- as.factor(simData$cond)
To estimate the `IMM` we first need to specify a formula. In this formula, we directly estimate all parameters for each of the four conditions:

```{r}
model_formula <- brms::bf(respErr ~ 1,
c ~ 0 + cond,
a ~ 0 + cond,
s ~ 0 + cond,
kappa ~ 0 + cond)
model_formula <- bmm_formula(c ~ 0 + cond,
a ~ 0 + cond,
s ~ 0 + cond,
kappa ~ 0 + cond)
```

Then, we can specify the model that we want to estimate:

```{r}
model <- IMMfull(non_target = paste0("color_item",2:setsize),
model <- IMMfull(respErr = "respErr",
non_target = paste0("color_item",2:setsize),
setsize = setsize,
spaPos = paste0("dist_item",2:setsize))
```
Expand All @@ -185,7 +185,8 @@ model = model,
parallel = TRUE,
chains = 4,
iter = 2000,
backend = "cmdstanr"
backend = "cmdstanr",
refresh = 100
)
```

Expand Down Expand Up @@ -217,10 +218,10 @@ fixedFX[startsWith(rownames(fixedFX),"c_"),]
fixedFX[startsWith(rownames(fixedFX),"a_"),]
# print posterior means for the s parameter
exp(fixedFX[grepl("s_",rownames(fixedFX)),])
exp(fixedFX[startsWith(rownames(fixedFX),"s_"),])
# print posterior means for the s parameter
exp(fixedFX[grepl("kappa_",rownames(fixedFX)),])
exp(fixedFX[startsWith(rownames(fixedFX),"kappa_"),])
```

These results indicate that all parameters, except for `s` were well recovered. As already noted by @oberauerHierarchicalBayesianMeasurement2017, a good recovery of the generalization gradient `s` requires a lot of data. Thus you might consider opting for the simplified version of the IMM without the `s` parameter, the `IMMabc`.
Expand Down

0 comments on commit a95a7fc

Please sign in to comment.