pseMer: PSE/JND for GLMM Using Bootstrap Methods

Description Usage Arguments Details Value Note References See Also Examples

View source: R/pseMer.R

Description

Estimates the Point of Subjective Equivalence (PSE), the Just Noticeable Difference (JND) and the related Standard Errors by means of Bootstrap Method.

Usage

1
2
pseMer(mer.obj, B = 200, FUN = NULL, alpha = 0.05, ci.type = c("norm",
  "basic", "perc"), beep = F)

Arguments

mer.obj

An object of class "merMod".

B

integer: the number of bootstrap samples.

FUN

An optional, custom made function to specify the required parameters to be estimated. if NULL, pseMer() will estimate the PSE and the JND of a univariable GLMM.

alpha

Significance level of the confidence interval.

ci.type

A vector of character strings representing the type of intervals required. The value should be any subset of the values c("norm","basic", "stud", "perc", "bca") or simply "all" which will compute all five types of intervals. "perc" should be always included for the summary table.

beep

Logical. If TRUE, a "ping" sound alerts that the simulation is complete.

Details

pseMer estimates PSE and JND (and additional user defined paremters) from a fitted GLMM model (class "merMod"). The "ping" sound is provided by beep function from the beepr package.

Value

pseMer returns a list of length 3 including a summary table (Estimate, Standard Error, Inferior and Superior Confidence Interval of the parameters) and the output of bootMer and boot.ci functions, for further analises. Confidence Intervals in the summary table are based on the percentile method.

Note

A first custom function was written in 2012 for the non-CRAN package MERpsychophisics, based on the algorithm in Moscatelli et al. (2012). The current function is a simple wrapper of lme4::bootMer() and boot::boot.ci() functions.

Increasing the nuber of bootstrap samples (B) makes the estimate more reliable. However, this will also increase the duration of the computation.

References

Moscatelli, A., Mezzetti, M., & Lacquaniti, F. (2012). Modeling psychophysical data at the population-level: The generalized linear mixed model. Journal of Vision, 12(11):26, 1-17. https://doi.org/10.1167/12.11.26

Bates, D., M<c3><a4>chler, M., Bolker, B., & Walker, S. (2015). Fitting Linear Mixed-Effects Models Using lme4. Journal of Statistical Software, 67(1), 51. https://doi.org/10.18637/jss.v067.i01

See Also

bootMer from lme4 package and boot.ci from boot package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Example 1: estimate pse/jnd of a univariable GLMM
library(lme4)
data(vibro_exp3)
formula.mod1 <- cbind(faster, slower) ~ speed + (1 + speed| subject)
mod1 <- glmer(formula = formula.mod1, family = binomial(link = "probit"), 
              data = vibro_exp3[vibro_exp3$vibration == 0,])

BootEstim.1 <- pseMer(mod1, B = 100, ci.type = c("perc"))

## Example 2: specify custom parameters for bootstrap estimation of a 
# multivariate model

formula.mod2 <- cbind(faster, slower) ~ speed * vibration + (1 + speed| subject)
mod2 <- glmer(formula = formula.mod2, family = binomial(link = "probit"), 
               data = vibro_exp3)
              
fun2mod = function(mer.obj){
#allocate space: 4 parameters (jnd_0Hz, jnd_32Hz, pse_0Hz, pse_32Hz) j
jndpse = vector(mode = "numeric", length = 4)
names(jndpse) = c("jnd_0Hz","jnd_32Hz", "pse_0Hz", "pse_32Hz")
jndpse[1] = qnorm(0.75)/fixef(mer.obj)[2] #jnd_0Hz
jndpse[2] = qnorm(0.75)/(fixef(mer.obj)[2] + fixef(mer.obj)[4]) #jnd_32Hz
jndpse[3] = -fixef(mer.obj)[1]/fixef(mer.obj)[2] #pse_0Hz
jndpse[4] = -(fixef(mer.obj)[1] + fixef(mer.obj)[3])/(fixef(mer.obj)[2] 
               + fixef(mer.obj)[4]) #pse_32Hz
return(jndpse)
}

BootEstim.2 = pseMer(mod2, B = 100, FUN = fun2mod)

MixedPsy documentation built on May 2, 2019, 3:40 p.m.