Mean_Variance | R Documentation |
Estimates number of samples and prior parameters of the Bayesian Sampler using the Mean/Variance relationship as shown by \insertCitesundh2023UnifiedExplanationVariabilitysamplr. For consistency with the Bayesian Sampler function we call beta the prior parameter, and b0 and b1 slope and intercept respectively.
Mean_Variance(rawData, idCol)
rawData |
Dataframe with the following column variables for N repetitions of each unique query: participant ID ('id'), response query 1, response query 2, ... , response query N |
idCol |
Name of the 'ID' column. |
A dataframe with values for the intercept (b0) and slope (b1) of the estimated regression, as well as estimates for N, d, and beta (termed b in the paper) for each participant.
library(dplyr)
library(tidyr)
library(magrittr)
library(samplrData)
pct_to_prob <- function(x){x/100}
data <- sundh2023.meanvariance.e3 %>%
group_by(ID, querydetail) %>%
mutate(iteration = LETTERS[1:n()]) %>%
pivot_wider(id_cols = c(ID, querydetail),
values_from = estimate, names_from = iteration) %>%
mutate(across(where(is.numeric), pct_to_prob)) %>%
ungroup %>%
select(-querydetail)
head(data)
head(Mean_Variance(data, "ID"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.