Running examples in ‘psycho-Ex.R’ failed
The error most likely occurred in:

> ### Name: assess
> ### Title: Compare a patient's score to a control group
> ### Aliases: assess
> 
> ### ** Examples
> 
> result <- assess(patient=124, mean=100, sd=15, n=100)
> print(result)
The Bayesian test for single case assessment (Crawford, Garthwaite, 2007) suggests that the patient's score (Raw = 124, Z = 1.60, percentile = 94.52) is not significantly different from the controls (M = 100, SD = 15, p = 0.06<b0>). The patient's score is higher than 94.26% (95% CI [90.74, 97.26]) of the control population.
> plot(result)
> 
> 
> 
> 
> cleanEx()
> nameEx("bayes_cor")
> ### * bayes_cor
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: bayes_cor
> ### Title: Bayesian Correlation Matrix.
> ### Aliases: bayes_cor
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D df <- psycho::affective
> ##D cor <- bayes_cor(df)
> ##D summary(cor)
> ##D print(cor)
> ##D plot(cor)
> ##D 
> ##D df <- select(psycho::affective, Adjusting, Tolerating)
> ##D df2 <- select(psycho::affective, -Adjusting, -Tolerating)
> ##D cor <- bayes_cor(df, df2)
> ##D summary(cor)
> ##D print(cor)
> ##D plot(cor)
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("bayes_cor.test")
> ### * bayes_cor.test
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: bayes_cor.test
> ### Title: Performs a Bayesian correlation.
> ### Aliases: bayes_cor.test
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D x <- psycho::affective$Concealing
> ##D y <- psycho::affective$Tolerating
> ##D 
> ##D bayes_cor.test(x, y)
> ##D summary(bayes_cor.test(x, y))
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("correlation")
> ### * correlation
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: correlation
> ### Title: Multiple Correlations.
> ### Aliases: correlation
> 
> ### ** Examples
> 
> df <- attitude
> 
> # Normal correlations
> results <- psycho::correlation(df)
> print(results)
Pearson Full correlation (p value correction: holm):

   - rating / complaints:   Results of the Pearson correlation showed a significant large, and positive association between rating and complaints (r(28) = 0.83, p < .001***).
   - rating / privileges:   Results of the Pearson correlation showed a non significant moderate, and positive association between rating and privileges (r(28) = 0.43, p > .1).
   - complaints / privileges:   Results of the Pearson correlation showed a significant large, and positive association between complaints and privileges (r(28) = 0.56, p < .05*).
   - rating / learning:   Results of the Pearson correlation showed a significant large, and positive association between rating and learning (r(28) = 0.62, p < .01**).
   - complaints / learning:   Results of the Pearson correlation showed a significant large, and positive association between complaints and learning (r(28) = 0.60, p < .01**).
   - privileges / learning:   Results of the Pearson correlation showed a non significant moderate, and positive association between privileges and learning (r(28) = 0.49, p = 0.07<b0>).
   - rating / raises:   Results of the Pearson correlation showed a significant large, and positive association between rating and raises (r(28) = 0.59, p < .01**).
   - complaints / raises:   Results of the Pearson correlation showed a significant large, and positive association between complaints and raises (r(28) = 0.67, p < .01**).
   - privileges / raises:   Results of the Pearson correlation showed a non significant moderate, and positive association between privileges and raises (r(28) = 0.45, p > .1).
   - learning / raises:   Results of the Pearson correlation showed a significant large, and positive association between learning and raises (r(28) = 0.64, p < .01**).
   - rating / critical:   Results of the Pearson correlation showed a non significant small, and positive association between rating and critical (r(28) = 0.16, p > .1).
   - complaints / critical:   Results of the Pearson correlation showed a non significant small, and positive association between complaints and critical (r(28) = 0.19, p > .1).
   - privileges / critical:   Results of the Pearson correlation showed a non significant small, and positive association between privileges and critical (r(28) = 0.15, p > .1).
   - learning / critical:   Results of the Pearson correlation showed a non significant small, and positive association between learning and critical (r(28) = 0.12, p > .1).
   - raises / critical:   Results of the Pearson correlation showed a non significant moderate, and positive association between raises and critical (r(28) = 0.38, p > .1).
   - rating / advance:   Results of the Pearson correlation showed a non significant small, and positive association between rating and advance (r(28) = 0.16, p > .1).
   - complaints / advance:   Results of the Pearson correlation showed a non significant small, and positive association between complaints and advance (r(28) = 0.22, p > .1).
   - privileges / advance:   Results of the Pearson correlation showed a non significant moderate, and positive association between privileges and advance (r(28) = 0.34, p > .1).
   - learning / advance:   Results of the Pearson correlation showed a significant large, and positive association between learning and advance (r(28) = 0.53, p < .05*).
   - raises / advance:   Results of the Pearson correlation showed a significant large, and positive association between raises and advance (r(28) = 0.57, p < .05*).
   - critical / advance:   Results of the Pearson correlation showed a non significant small, and positive association between critical and advance (r(28) = 0.28, p > .1).
> plot(results)
> 
> # Partial correlations with correction
> results <- psycho::correlation(df, type="partial",
+                                    method="spearman",
+                                    adjust="holm")
> print(results)
Spearman Partial correlation (p value correction: holm):

   - rating / complaints:   Results of the Spearman correlation showed a significant large, and positive association between rating and complaints (r(28) = 0.65, p < .01**).
   - rating / privileges:   Results of the Spearman correlation showed a non significant very small, and positive association between rating and privileges (r(28) = 0.034, p > .1).
   - complaints / privileges:   Results of the Spearman correlation showed a non significant small, and positive association between complaints and privileges (r(28) = 0.20, p > .1).
   - rating / learning:   Results of the Spearman correlation showed a non significant small, and positive association between rating and learning (r(28) = 0.29, p > .1).
   - complaints / learning:   Results of the Spearman correlation showed a non significant very small, and positive association between complaints and learning (r(28) = 0.023, p > .1).
   - privileges / learning:   Results of the Spearman correlation showed a non significant small, and positive association between privileges and learning (r(28) = 0.16, p > .1).
   - rating / raises:   Results of the Spearman correlation showed a non significant small, and positive association between rating and raises (r(28) = 0.10, p > .1).
   - complaints / raises:   Results of the Spearman correlation showed a non significant small, and positive association between complaints and raises (r(28) = 0.29, p > .1).
   - privileges / raises:   Results of the Spearman correlation showed a non significant very small, and positive association between privileges and raises (r(28) = 0.021, p > .1).
   - learning / raises:   Results of the Spearman correlation showed a non significant small, and positive association between learning and raises (r(28) = 0.17, p > .1).
   - rating / critical:   Results of the Spearman correlation showed a non significant small, and negative association between rating and critical (r(28) = -0.10, p > .1).
   - complaints / critical:   Results of the Spearman correlation showed a non significant very small, and positive association between complaints and critical (r(28) = 0.034, p > .1).
   - privileges / critical:   Results of the Spearman correlation showed a non significant very small, and positive association between privileges and critical (r(28) = 0.011, p > .1).
   - learning / critical:   Results of the Spearman correlation showed a non significant very small, and negative association between learning and critical (r(28) = -0.064, p > .1).
   - raises / critical:   Results of the Spearman correlation showed a non significant small, and positive association between raises and critical (r(28) = 0.22, p > .1).
   - rating / advance:   Results of the Spearman correlation showed a non significant small, and negative association between rating and advance (r(28) = -0.16, p > .1).
   - complaints / advance:   Results of the Spearman correlation showed a non significant small, and negative association between complaints and advance (r(28) = -0.11, p > .1).
   - privileges / advance:   Results of the Spearman correlation showed a non significant small, and positive association between privileges and advance (r(28) = 0.12, p > .1).
   - learning / advance:   Results of the Spearman correlation showed a non significant moderate, and positive association between learning and advance (r(28) = 0.41, p > .1).
   - raises / advance:   Results of the Spearman correlation showed a non significant small, and positive association between raises and advance (r(28) = 0.29, p > .1).
   - critical / advance:   Results of the Spearman correlation showed a non significant small, and positive association between critical and advance (r(28) = 0.13, p > .1).
> plot(results)
> 
> 
> 
> 
> cleanEx()
> nameEx("crawford.test")
> ### * crawford.test
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: crawford.test
> ### Title: Crawford-Garthwaite (2007) Bayesian test for single-case
> ###   analysis.
> ### Aliases: crawford.test
> 
> ### ** Examples
> 
> library(psycho)
> 
> crawford.test(patient = 125, mean=100, sd=15, n=100)
The Bayesian test for single case assessment (Crawford, Garthwaite, 2007) suggests that the patient's score (Raw = 125, Z = 1.67, percentile = 95.22) is significantly different from the controls (M = 100, SD = 15, p = 0.05<b0>). The patient's score is higher than 94.97% (95% CI [91.74, 97.74]) of the control population.
> plot(crawford.test(patient = 80, mean=100, sd=15, n=100))
> 
> crawford.test(patient = 10, controls = c(0, -2, 5, 2, 1, 3, -4, -2))
The Bayesian test for single case assessment (Crawford, Garthwaite, 2007) suggests that the patient's score (Raw = 10, Z = 3.24, percentile = 99.94) is significantly different from the controls (M = 0.38, SD = 2.97, p < .01**). The patient's score is higher than 99.08% (95% CI [95.39, 100.00]) of the control population.
> test <- crawford.test(patient = 7, controls = c(0, -2, 5, -6, 0, 3, -4, -2))
> plot(test)
> 
> 
> 
> 
> cleanEx()
> nameEx("crawford.test.freq")
> ### * crawford.test.freq
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: crawford.test.freq
> ### Title: Crawford-Howell (1998) frequentist t-test for single-case
> ###   analysis.
> ### Aliases: crawford.test.freq
> 
> ### ** Examples
> 
> library(psycho)
> 
> crawford.test.freq(patient = 10, controls = c(0, -2, 5, 2, 1, 3, -4, -2))
The Crawford-Howell (1998) t-test suggests that the patient's score (10) is significantly different from the controls (M = 0.38, SD = 2.97, t(7) = 3.05, p < .05*). The patient's score is higher than 98.15% of the control population.
> crawford.test.freq(patient = 7, controls = c(0, -2, 5, 2, 1, 3, -4, -2))
The Crawford-Howell (1998) t-test suggests that the patient's score (7) is not significantly different from the controls (M = 0.38, SD = 2.97, t(7) = 2.10, p = 0.07<b0>). However, the null hypothesis of no difference can be rejected at a one-tailed 5% significance level (one-tailed p < .05*). The patient's score is higher than 92.62% of the control population.
> 
> 
> 
> 
> cleanEx()
> nameEx("crawford_dissociation.test")
> ### * crawford_dissociation.test
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: crawford_dissociation.test
> ### Title: Crawford-Howell (1998) modified t-test for testing difference
> ###   between a patient<e2><80><99>s performance on two tasks.
> ### Aliases: crawford_dissociation.test
> 
> ### ** Examples
> 
> library(psycho)
> 
> case_X <- 142
> case_Y <- 7
> controls_X <- c(100, 125, 89, 105, 109, 99)
> controls_Y <- c(7, 8, 9, 6, 7, 10)
> 
> crawford_dissociation.test(case_X, case_Y, controls_X, controls_Y)
The Crawford-Howell (1998) t-test suggests no dissociation between test X and test Y (t(5) = 2.10, p = 0.09<b0>). The patient's score on test X is not significantly altered compared to its score on test Y.

         t df          p
1 2.097994  5 0.08998205
> 
> 
> 
> 
> cleanEx()
> nameEx("create_intervals")
> ### * create_intervals
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: create_intervals
> ### Title: Overlap of Two Empirical Distributions.
> ### Aliases: create_intervals
> 
> ### ** Examples
> 
> library(psycho)
> 
> x <- rnorm(100, 0, 1)
> 
> create_intervals(x, n=4)
  [1] (-1.06,0.0935] (0.0935,1.25]  (-1.06,0.0935] (1.25,2.4]     (0.0935,1.25] 
  [6] (-1.06,0.0935] (0.0935,1.25]  (0.0935,1.25]  (0.0935,1.25]  (-1.06,0.0935]
 [11] (1.25,2.4]     (0.0935,1.25]  (-1.06,0.0935] [-2.21,-1.06]  (0.0935,1.25] 
 [16] (-1.06,0.0935] (-1.06,0.0935] (0.0935,1.25]  (0.0935,1.25]  (0.0935,1.25] 
 [21] (0.0935,1.25]  (0.0935,1.25]  (-1.06,0.0935] [-2.21,-1.06]  (0.0935,1.25] 
 [26] (-1.06,0.0935] (-1.06,0.0935] [-2.21,-1.06]  (-1.06,0.0935] (0.0935,1.25] 
 [31] (1.25,2.4]     (-1.06,0.0935] (0.0935,1.25]  (-1.06,0.0935] [-2.21,-1.06] 
 [36] (-1.06,0.0935] (-1.06,0.0935] (-1.06,0.0935] (0.0935,1.25]  (0.0935,1.25] 
 [41] (-1.06,0.0935] (-1.06,0.0935] (0.0935,1.25]  (0.0935,1.25]  (-1.06,0.0935]
 [46] (-1.06,0.0935] (0.0935,1.25]  (0.0935,1.25]  (-1.06,0.0935] (0.0935,1.25] 
 [51] (0.0935,1.25]  (-1.06,0.0935] (0.0935,1.25]  [-2.21,-1.06]  (1.25,2.4]    
 [56] (1.25,2.4]     (-1.06,0.0935] (-1.06,0.0935] (0.0935,1.25]  (-1.06,0.0935]
 [61] (1.25,2.4]     (-1.06,0.0935] (0.0935,1.25]  (-1.06,0.0935] (-1.06,0.0935]
 [66] (0.0935,1.25]  [-2.21,-1.06]  (1.25,2.4]     (0.0935,1.25]  (1.25,2.4]    
 [71] (0.0935,1.25]  (-1.06,0.0935] (0.0935,1.25]  (-1.06,0.0935] [-2.21,-1.06] 
 [76] (0.0935,1.25]  (-1.06,0.0935] (-1.06,0.0935] (-1.06,0.0935] (-1.06,0.0935]
 [81] (-1.06,0.0935] (-1.06,0.0935] (0.0935,1.25]  [-2.21,-1.06]  (0.0935,1.25] 
 [86] (0.0935,1.25]  (0.0935,1.25]  (-1.06,0.0935] (0.0935,1.25]  (0.0935,1.25] 
 [91] (-1.06,0.0935] (0.0935,1.25]  (0.0935,1.25]  (0.0935,1.25]  (1.25,2.4]    
 [96] (0.0935,1.25]  [-2.21,-1.06]  (-1.06,0.0935] [-2.21,-1.06]  (-1.06,0.0935]
Levels: [-2.21,-1.06] (-1.06,0.0935] (0.0935,1.25] (1.25,2.4]
> create_intervals(x, n=4, equal_range=FALSE)
  [1] [-2.21,-0.494] (0.114,0.692]  [-2.21,-0.494] (0.692,2.4]    (0.114,0.692] 
  [6] [-2.21,-0.494] (0.114,0.692]  (0.692,2.4]    (0.114,0.692]  (-0.494,0.114]
 [11] (0.692,2.4]    (0.114,0.692]  [-2.21,-0.494] [-2.21,-0.494] (0.692,2.4]   
 [16] (-0.494,0.114] (-0.494,0.114] (0.692,2.4]    (0.692,2.4]    (0.114,0.692] 
 [21] (0.692,2.4]    (0.692,2.4]    (-0.494,0.114] [-2.21,-0.494] (0.114,0.692] 
 [26] (-0.494,0.114] (-0.494,0.114] [-2.21,-0.494] (-0.494,0.114] (0.114,0.692] 
 [31] (0.692,2.4]    (-0.494,0.114] (0.114,0.692]  (-0.494,0.114] [-2.21,-0.494]
 [36] (-0.494,0.114] (-0.494,0.114] (-0.494,0.114] (0.692,2.4]    (0.692,2.4]   
 [41] (-0.494,0.114] (-0.494,0.114] (0.692,2.4]    (0.114,0.692]  [-2.21,-0.494]
 [46] [-2.21,-0.494] (0.114,0.692]  (0.692,2.4]    (-0.494,0.114] (0.692,2.4]   
 [51] (0.114,0.692]  [-2.21,-0.494] (0.114,0.692]  [-2.21,-0.494] (0.692,2.4]   
 [56] (0.692,2.4]    (-0.494,0.114] [-2.21,-0.494] (0.114,0.692]  (-0.494,0.114]
 [61] (0.692,2.4]    (-0.494,0.114] (0.114,0.692]  (-0.494,0.114] [-2.21,-0.494]
 [66] (0.114,0.692]  [-2.21,-0.494] (0.692,2.4]    (0.114,0.692]  (0.692,2.4]   
 [71] (0.114,0.692]  [-2.21,-0.494] (0.114,0.692]  [-2.21,-0.494] [-2.21,-0.494]
 [76] (0.114,0.692]  (-0.494,0.114] (-0.494,0.114] (-0.494,0.114] [-2.21,-0.494]
 [81] [-2.21,-0.494] (-0.494,0.114] (0.692,2.4]    [-2.21,-0.494] (0.114,0.692] 
 [86] (0.114,0.692]  (0.692,2.4]    (-0.494,0.114] (0.114,0.692]  (0.114,0.692] 
 [91] [-2.21,-0.494] (0.692,2.4]    (0.692,2.4]    (0.692,2.4]    (0.692,2.4]   
 [96] (0.114,0.692]  [-2.21,-0.494] [-2.21,-0.494] [-2.21,-0.494] (-0.494,0.114]
Levels: [-2.21,-0.494] (-0.494,0.114] (0.114,0.692] (0.692,2.4]
> create_intervals(x, length=1)
  [1] (-1,0]  (0,1]   (-1,0]  (1,2]   (0,1]   (-1,0]  (0,1]   (0,1]   (0,1]  
 [10] (-1,0]  (1,2]   (0,1]   (-1,0]  [-3,-2] (1,2]   (-1,0]  (-1,0]  (0,1]  
 [19] (0,1]   (0,1]   (0,1]   (0,1]   (0,1]   (-2,-1] (0,1]   (-1,0]  (-1,0] 
 [28] (-2,-1] (-1,0]  (0,1]   (1,2]   (-1,0]  (0,1]   (-1,0]  (-2,-1] (-1,0] 
 [37] (-1,0]  (-1,0]  (1,2]   (0,1]   (-1,0]  (-1,0]  (0,1]   (0,1]   (-1,0] 
 [46] (-1,0]  (0,1]   (0,1]   (-1,0]  (0,1]   (0,1]   (-1,0]  (0,1]   (-2,-1]
 [55] (1,2]   (1,2]   (-1,0]  (-2,-1] (0,1]   (-1,0]  (2,3]   (-1,0]  (0,1]  
 [64] (0,1]   (-1,0]  (0,1]   (-2,-1] (1,2]   (0,1]   (2,3]   (0,1]   (-1,0] 
 [73] (0,1]   (-1,0]  (-2,-1] (0,1]   (-1,0]  (0,1]   (0,1]   (-1,0]  (-1,0] 
 [82] (-1,0]  (1,2]   (-2,-1] (0,1]   (0,1]   (1,2]   (-1,0]  (0,1]   (0,1]  
 [91] (-1,0]  (1,2]   (1,2]   (0,1]   (1,2]   (0,1]   (-2,-1] (-1,0]  (-2,-1]
[100] (-1,0] 
Levels: [-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3]
> 
> create_intervals(x, n=4, labels="median")
  [1] -0.3807557  0.5939013 -0.3807557  1.5868335  0.5939013 -0.3807557
  [7]  0.5939013  0.5939013  0.5939013 -0.3807557  1.5868335  0.5939013
 [13] -0.3807557 -1.4239060  0.5939013 -0.3807557 -0.3807557  0.5939013
 [19]  0.5939013  0.5939013  0.5939013  0.5939013 -0.3807557 -1.4239060
 [25]  0.5939013 -0.3807557 -0.3807557 -1.4239060 -0.3807557  0.5939013
 [31]  1.5868335 -0.3807557  0.5939013 -0.3807557 -1.4239060 -0.3807557
 [37] -0.3807557 -0.3807557  0.5939013  0.5939013 -0.3807557 -0.3807557
 [43]  0.5939013  0.5939013 -0.3807557 -0.3807557  0.5939013  0.5939013
 [49] -0.3807557  0.5939013  0.5939013 -0.3807557  0.5939013 -1.4239060
 [55]  1.5868335  1.5868335 -0.3807557 -0.3807557  0.5939013 -0.3807557
 [61]  1.5868335 -0.3807557  0.5939013 -0.3807557 -0.3807557  0.5939013
 [67] -1.4239060  1.5868335  0.5939013  1.5868335  0.5939013 -0.3807557
 [73]  0.5939013 -0.3807557 -1.4239060  0.5939013 -0.3807557 -0.3807557
 [79] -0.3807557 -0.3807557 -0.3807557 -0.3807557  0.5939013 -1.4239060
 [85]  0.5939013  0.5939013  0.5939013 -0.3807557  0.5939013  0.5939013
 [91] -0.3807557  0.5939013  0.5939013  0.5939013  1.5868335  0.5939013
 [97] -1.4239060 -0.3807557 -1.4239060 -0.3807557
> create_intervals(x, n=4, labels=FALSE)
  [1] 2 3 2 4 3 2 3 3 3 2 4 3 2 1 3 2 2 3 3 3 3 3 2 1 3 2 2 1 2 3 4 2 3 2 1 2 2
 [38] 2 3 3 2 2 3 3 2 2 3 3 2 3 3 2 3 1 4 4 2 2 3 2 4 2 3 2 2 3 1 4 3 4 3 2 3 2
 [75] 1 3 2 2 2 2 2 2 3 1 3 3 3 2 3 3 2 3 3 3 4 3 1 2 1 2
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("dprime")
> ### * dprime
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: dprime
> ### Title: Dprime and Other Signal Detection Theory indices.
> ### Aliases: dprime
> 
> ### ** Examples
> 
> library(psycho)
> 
> n_hit <- 9
> n_fa <- 2
> n_miss <- 1
> n_cr <- 7
> 
> indices <- psycho::dprime(n_hit, n_fa, n_miss, n_cr)
> 
> 
> df <- data.frame(Participant = c("A", "B", "C"),
+     n_hit = c(1, 2, 5),
+     n_fa = c(6, 8, 1))
> 
> indices <- psycho::dprime(n_hit=df$n_hit,
+     n_fa=df$n_fa,
+     n_targets=10,
+     n_distractors=10,
+     adjusted=FALSE)
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("find_best_model.lmerModLmerTest")
> ### * find_best_model.lmerModLmerTest
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: find_best_model.lmerModLmerTest
> ### Title: Returns the best combination of predictors for lmerTest objects.
> ### Aliases: find_best_model.lmerModLmerTest
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D library(lmerTest)
> ##D 
> ##D data <- standardize(iris)
> ##D fit <- lmerTest::lmer(Sepal.Length ~ Sepal.Width + Petal.Length + (1|Species), data=data)
> ##D 
> ##D best <- find_best_model(fit)
> ##D best_formula <- best$formula
> ##D best$table
> ##D 
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("find_best_model.stanreg")
> ### * find_best_model.stanreg
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: find_best_model.stanreg
> ### Title: Returns the best combination of predictors based on LOO
> ###   cross-validation indices.
> ### Aliases: find_best_model.stanreg
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D library(rstanarm)
> ##D 
> ##D data <- standardize(attitude)
> ##D fit <- rstanarm::stan_glm(rating ~ advance + privileges, data=data)
> ##D 
> ##D best <- find_best_model(fit)
> ##D best_formula <- best$formula
> ##D best$table
> ##D 
> ##D # To deactivate Kfold evaluation
> ##D best <- find_best_model(fit, K=0)
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("find_combinations.formula")
> ### * find_combinations.formula
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: find_combinations.formula
> ### Title: Generate all combinations of predictors of a formula.
> ### Aliases: find_combinations.formula
> 
> ### ** Examples
> 
> library(psycho)
> 
> f <- as.formula("Y ~ A + B + C + D")
> f <- as.formula("Y ~ A + B + C + D + (1|E)")
> f <- as.formula("Y ~ A + B + C + D + (1|E) + (1|F)")
> 
> find_combinations(f)
 [1] "Y ~ A + (1 | E) + (1 | F)"            
 [2] "Y ~ B + (1 | E) + (1 | F)"            
 [3] "Y ~ C + (1 | E) + (1 | F)"            
 [4] "Y ~ D + (1 | E) + (1 | F)"            
 [5] "Y ~ A + B + (1 | E) + (1 | F)"        
 [6] "Y ~ A + C + (1 | E) + (1 | F)"        
 [7] "Y ~ A + D + (1 | E) + (1 | F)"        
 [8] "Y ~ B + C + (1 | E) + (1 | F)"        
 [9] "Y ~ B + D + (1 | E) + (1 | F)"        
[10] "Y ~ C + D + (1 | E) + (1 | F)"        
[11] "Y ~ A + B + C + (1 | E) + (1 | F)"    
[12] "Y ~ A + B + D + (1 | E) + (1 | F)"    
[13] "Y ~ A + C + D + (1 | E) + (1 | F)"    
[14] "Y ~ B + C + D + (1 | E) + (1 | F)"    
[15] "Y ~ A + B + C + D + (1 | E) + (1 | F)"
[16] "Y ~ A * B + (1 | E) + (1 | F)"        
[17] "Y ~ A * C + (1 | E) + (1 | F)"        
[18] "Y ~ A * D + (1 | E) + (1 | F)"        
[19] "Y ~ B * C + (1 | E) + (1 | F)"        
[20] "Y ~ B * D + (1 | E) + (1 | F)"        
[21] "Y ~ C * D + (1 | E) + (1 | F)"        
[22] "Y ~ A * B + C + (1 | E) + (1 | F)"    
[23] "Y ~ A * B * C + (1 | E) + (1 | F)"    
[24] "Y ~ A * B + D + (1 | E) + (1 | F)"    
[25] "Y ~ A * B * D + (1 | E) + (1 | F)"    
[26] "Y ~ A * C + D + (1 | E) + (1 | F)"    
[27] "Y ~ A * C * D + (1 | E) + (1 | F)"    
[28] "Y ~ B * C + D + (1 | E) + (1 | F)"    
[29] "Y ~ B * C * D + (1 | E) + (1 | F)"    
[30] "Y ~ A * B + C + D + (1 | E) + (1 | F)"
[31] "Y ~ A * B * C + D + (1 | E) + (1 | F)"
[32] "Y ~ A * B * C * D + (1 | E) + (1 | F)"
> 
> 
> 
> 
> cleanEx()
> nameEx("find_matching_string")
> ### * find_matching_string
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: find_matching_string
> ### Title: Fuzzy string matching.
> ### Aliases: find_matching_string
> 
> ### ** Examples
> 
> library(psycho)
> find_matching_string("Hwo rea ouy", c("How are you", "Not this word", "Nice to meet you"))
[1] "How are you"
> 
> 
> 
> 
> cleanEx()
> nameEx("find_random_effects")
> ### * find_random_effects
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: find_random_effects
> ### Title: Find random effects in formula.
> ### Aliases: find_random_effects
> 
> ### ** Examples
> 
> library(psycho)
> find_random_effects("Y ~ X + (1|Group)")
[1] "(1|Group)"
> 
> 
> 
> 
> cleanEx()
> nameEx("find_season")
> ### * find_season
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: find_season
> ### Title: Find season of dates.
> ### Aliases: find_season
> 
> ### ** Examples
> 
> library(psycho)
> 
> dates <- c("2017-02-15", "2017-05-15", "2017-08-15", "2017-11-15")
> find_season(dates)
[1] Winter Spring Summer Fall  
Levels: Winter Spring Summer Fall
> 
> 
> 
> 
> cleanEx()
> nameEx("format_formula")
> ### * format_formula
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: format_formula
> ### Title: Clean and format formula.
> ### Aliases: format_formula
> 
> ### ** Examples
> 
> library(psycho)
> library(lme4)
Loading required package: Matrix
> 
> fit <- lme4::glmer(vs ~ wt + (1|gear), data=mtcars, family="binomial")
> fit <- lm(hp ~ wt, data=mtcars)
> 
> format_formula(get_formula(fit))
[1] "hp ~ wt"
> 
> 
> 
> 
> 
> cleanEx()

detaching ‘package:lme4’, ‘package:Matrix’

> nameEx("format_loadings")
> ### * format_loadings
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: format_loadings
> ### Title: Format the loadings of a factor analysis.
> ### Aliases: format_loadings
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D x <- psych::fa(psych::Thurstone.33, 2)
> ##D format_loadings(x)
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("get_R2.glm")
> ### * get_R2.glm
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_R2.glm
> ### Title: Pseudo-R-squared for Logistic Models.
> ### Aliases: get_R2.glm
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D fit <- glm(vs ~ wt, data=mtcars, family="binomial")
> ##D fit <- glm(Sex ~ Adjusting, data=psycho::affective, family="binomial")
> ##D 
> ##D get_R2(fit)
> ##D 
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("get_R2.lm")
> ### * get_R2.lm
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_R2.lm
> ### Title: R2 and adjusted R2 for Linear Models.
> ### Aliases: get_R2.lm
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D fit <- lm(Tolerating ~ Adjusting, data=psycho::affective)
> ##D 
> ##D get_R2(fit)
> ##D 
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("get_R2.merMod")
> ### * get_R2.merMod
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_R2.merMod
> ### Title: R2 and adjusted R2 for GLMMs.
> ### Aliases: get_R2.merMod
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D fit <- lmerTest::lmer(Tolerating ~ Adjusting + (1|Sex), data=psycho::affective)
> ##D fit <- lme4::glmer(Sex ~ Adjusting + (1|Salary), data=na.omit(psycho::affective), family="binomial")
> ##D 
> ##D get_R2(fit)
> ##D 
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("get_R2.stanreg")
> ### * get_R2.stanreg
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_R2.stanreg
> ### Title: R2 or Bayesian Models.
> ### Aliases: get_R2.stanreg
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D library(rstanarm)
> ##D 
> ##D fit <- rstanarm::stan_glm(Adjusting ~ Tolerating, data=psycho::affective)
> ##D 
> ##D get_R2(fit)
> ##D 
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("get_cfa_model")
> ### * get_cfa_model
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_cfa_model
> ### Title: Get CFA model.
> ### Aliases: get_cfa_model
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D x <- psych::fa(psych::Thurstone.33, 2)
> ##D loadings <- format_loadings(x)$loadings
> ##D get_cfa_model(loadings, treshold="max")
> ##D get_cfa_model(loadings, treshold=0.1)
> ## End(Not run)
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("get_contrasts.glmerMod")
> ### * get_contrasts.glmerMod
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_contrasts.glmerMod
> ### Title: Compute estimated marginal means and contrasts from glmerMod
> ###   models.
> ### Aliases: get_contrasts.glmerMod
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D require(lme4)
> ##D fit <- lme4::glmer(Sex ~ Birth_Season + (1|Salary), data=affective, family="binomial")
> ##D 
> ##D contrasts <- get_contrasts(fit, formula="Birth_Season", adjust="tukey")
> ##D contrasts$means
> ##D contrasts$contrasts
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("get_contrasts.lmerModLmerTest")
> ### * get_contrasts.lmerModLmerTest
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_contrasts.lmerModLmerTest
> ### Title: Compute estimated marginal means and contrasts from
> ###   lmerModLmerTest models.
> ### Aliases: get_contrasts.lmerModLmerTest
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D require(lmerTest)
> ##D fit <- lmerTest::lmer(Adjusting ~ Birth_Season + (1|Salary), data=affective)
> ##D 
> ##D contrasts <- get_contrasts(fit, formula="Birth_Season", adjust="tukey")
> ##D contrasts$means
> ##D contrasts$contrasts
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("get_contrasts.stanreg")
> ### * get_contrasts.stanreg
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_contrasts.stanreg
> ### Title: Compute estimated marginal means and contrasts from stanreg
> ###   models.
> ### Aliases: get_contrasts.stanreg
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D require(rstanarm)
> ##D fit <- rstanarm::stan_glm(Adjusting ~ Birth_Season * Sex, data=affective)
> ##D 
> ##D contrasts <- get_contrasts(fit, formula="Birth_Season * Sex")
> ##D contrasts$means
> ##D 
> ##D contrasts <- get_contrasts(fit, formula="Birth_Season")
> ##D contrasts$contrasts
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("get_data")
> ### * get_data
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_data
> ### Title: Extract the dataframe used in a model.
> ### Aliases: get_data
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(tidyverse)
> ##D library(psycho)
> ##D 
> ##D df <- mtcars %>%
> ##D   mutate(cyl = as.factor(cyl),
> ##D   gear = as.factor(gear))
> ##D 
> ##D fit <- lm(wt ~ mpg , data=df)
> ##D fit <- lm(wt ~ cyl, data=df)
> ##D fit <- lm(wt ~ mpg * cyl, data=df)
> ##D fit <- lm(wt ~ cyl * gear, data=df)
> ##D fit <- lmerTest::lmer(wt ~ mpg * gear + (1|cyl), data=df)
> ##D fit <- rstanarm::stan_lmer(wt ~ mpg * gear + (1|cyl), data=df)
> ##D 
> ##D get_data(fit)
> ##D 
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("get_formula")
> ### * get_formula
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_formula
> ### Title: Get formula of models.
> ### Aliases: get_formula
> 
> ### ** Examples
> 
> library(psycho)
> library(lme4)
Loading required package: Matrix
> 
> fit <- lme4::glmer(vs ~ wt + (1|gear), data=mtcars, family="binomial")
> fit <- lm(hp ~ wt, data=mtcars)
> 
> get_formula(fit)
hp ~ wt
> 
> 
> 
> 
> 
> cleanEx()

detaching ‘package:lme4’, ‘package:Matrix’

> nameEx("get_info")
> ### * get_info
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_info
> ### Title: Get information about objects.
> ### Aliases: get_info
> 
> ### ** Examples
> 
> library(psycho)
> library(lme4)
Loading required package: Matrix
> 
> fit <- lme4::glmer(vs ~ wt + (1|gear), data=mtcars, family="binomial")
> 
> info <- get_info(fit)
> info
$formula
vs ~ wt + (1 | gear)

$predictors
[1] "wt"

$outcome
[1] "vs"

$random
[1] "gear"

> 
> 
> 
> 
> 
> cleanEx()

detaching ‘package:lme4’, ‘package:Matrix’

> nameEx("get_info.lm")
> ### * get_info.lm
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_info.lm
> ### Title: Get information about models.
> ### Aliases: get_info.lm
> 
> ### ** Examples
> 
> library(psycho)
> library(lme4)
Loading required package: Matrix
> 
> fit <- lm(vs ~ wt, data=mtcars, family="binomial")
Warning: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
 extra argument ‘family’ will be disregarded
> 
> info <- get_info(fit)
> info
$formula
vs ~ wt

$predictors
[1] "wt"

$outcome
[1] "vs"

> 
> 
> 
> 
> cleanEx()

detaching ‘package:lme4’, ‘package:Matrix’

> nameEx("get_info.lmerModLmerTest")
> ### * get_info.lmerModLmerTest
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_info.lmerModLmerTest
> ### Title: Get information about models.
> ### Aliases: get_info.lmerModLmerTest
> 
> ### ** Examples
> 
> library(psycho)
> library(lme4)
Loading required package: Matrix
> 
> fit <- lme4::glmer(vs ~ wt + (1|gear), data=mtcars, family="binomial")
> 
> info <- get_info(fit)
> info
$formula
vs ~ wt + (1 | gear)

$predictors
[1] "wt"

$outcome
[1] "vs"

$random
[1] "gear"

> 
> 
> 
> 
> cleanEx()

detaching ‘package:lme4’, ‘package:Matrix’

> nameEx("get_loadings_max")
> ### * get_loadings_max
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_loadings_max
> ### Title: Get loadings max.
> ### Aliases: get_loadings_max
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D x <- psych::fa(psych::Thurstone.33, 2)
> ##D get_loadings_max(format_loadings(x)$loadings)
> ## End(Not run)
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("get_predicted.glm")
> ### * get_predicted.glm
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_predicted.glm
> ### Title: Compute predicted values of lm models.
> ### Aliases: get_predicted.glm
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D library(ggplot2)
> ##D 
> ##D fit <- glm(Sex ~ Adjusting, data=affective, family="binomial")
> ##D 
> ##D refgrid <- psycho::refdata(affective, "Adjusting")
> ##D predicted <- get_predicted(fit, newdata=refgrid)
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Sex_Predicted)) +
> ##D   geom_line() +
> ##D   geom_ribbon(aes(ymin=Sex_CI_2.5,
> ##D                   ymax=Sex_CI_97.5),
> ##D                   alpha=0.1)
> ##D 
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("get_predicted.lm")
> ### * get_predicted.lm
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_predicted.lm
> ### Title: Compute predicted values of lm models.
> ### Aliases: get_predicted.lm
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D library(ggplot2)
> ##D 
> ##D fit <- lm(Tolerating ~ Adjusting, data=affective)
> ##D 
> ##D refgrid <- psycho::refdata(affective, "Adjusting")
> ##D predicted <- get_predicted(fit, newdata=refgrid)
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Tolerating_Predicted)) +
> ##D   geom_line() +
> ##D   geom_ribbon(aes(ymin=Tolerating_CI_2.5,
> ##D                   ymax=Tolerating_CI_97.5),
> ##D                   alpha=0.1)
> ##D 
> ##D 
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("get_predicted.merMod")
> ### * get_predicted.merMod
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_predicted.merMod
> ### Title: Compute predicted values of lm models.
> ### Aliases: get_predicted.merMod
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D library(ggplot2)
> ##D 
> ##D fit <- lmerTest::lmer(Tolerating ~ Adjusting + (1|Salary), data=affective)
> ##D 
> ##D refgrid <- psycho::refdata(affective, "Adjusting")
> ##D predicted <- get_predicted(fit, newdata=refgrid)
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Tolerating_Predicted)) +
> ##D   geom_line()
> ##D 
> ##D predicted <- get_predicted(fit, newdata=refgrid, prob=0.95, iter=100)  # Takes a long time
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Tolerating_Predicted)) +
> ##D   geom_line() +
> ##D   geom_ribbon(aes(ymin=Tolerating_CI_2.5,
> ##D                   ymax=Tolerating_CI_97.5),
> ##D                   alpha=0.1)
> ##D 
> ##D 
> ##D 
> ##D fit <- lme4::glmer(Sex ~ Adjusting + (1|Salary), data=affective, family="binomial")
> ##D 
> ##D refgrid <- psycho::refdata(affective, "Adjusting")
> ##D predicted <- get_predicted(fit, newdata=refgrid)
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Sex_Predicted)) +
> ##D   geom_line()
> ##D 
> ##D predicted <- get_predicted(fit, newdata=refgrid, prob=0.95, iter=100)  # Takes a long time
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Sex_Predicted)) +
> ##D   geom_line() +
> ##D   geom_ribbon(aes(ymin=Sex_CI_2.5,
> ##D                   ymax=Sex_CI_97.5),
> ##D                   alpha=0.1)
> ##D 
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("get_predicted.stanreg")
> ### * get_predicted.stanreg
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: get_predicted.stanreg
> ### Title: Compute predicted values of stanreg models.
> ### Aliases: get_predicted.stanreg
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D library(ggplot2)
> ##D require(rstanarm)
> ##D 
> ##D fit <- rstanarm::stan_glm(Tolerating ~ Adjusting, data=affective)
> ##D 
> ##D refgrid <- psycho::refdata(affective, "Adjusting")
> ##D predicted <- get_predicted(fit, newdata=refgrid)
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Tolerating_Median)) +
> ##D   geom_line() +
> ##D   geom_ribbon(aes(ymin=Tolerating_CI_5,
> ##D                   ymax=Tolerating_CI_95),
> ##D                   alpha=0.1)
> ##D 
> ##D fit <- rstanarm::stan_glm(Sex ~ Adjusting, data=affective, family="binomial")
> ##D 
> ##D refgrid <- psycho::refdata(affective, "Adjusting")
> ##D predicted <- get_predicted(fit, newdata=refgrid)
> ##D 
> ##D ggplot(predicted, aes(x=Adjusting, y=Sex_Median)) +
> ##D   geom_line() +
> ##D   geom_ribbon(aes(ymin=Sex_CI_5,
> ##D                   ymax=Sex_CI_95),
> ##D                   alpha=0.1)
> ##D 
> ## End(Not run)
> 
> 
> 
> cleanEx()
> nameEx("interpret_R2")
> ### * interpret_R2
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_R2
> ### Title: R2 interpreation.
> ### Aliases: interpret_R2
> 
> ### ** Examples
> 
> library(psycho)
> interpret_R2(x=0.42)
[1] "large"
> interpret_R2(x=c(0.42, 0.2, 0.9, 0))
[1] "large"      "medium"     "large"      "very small"
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_R2_posterior")
> ### * interpret_R2_posterior
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_R2_posterior
> ### Title: R2 interpreation for a posterior distribution.
> ### Aliases: interpret_R2_posterior
> 
> ### ** Examples
> 
> library(psycho)
> posterior <- rnorm(1000, 0.4, 0.1)
> interpret_R2_posterior(posterior)
The R2 can be considered as large, medium or small with respective probabilities of 91.10%, 8.50% and 0.40%.
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_RMSEA")
> ### * interpret_RMSEA
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_RMSEA
> ### Title: RMSEA interpreation.
> ### Aliases: interpret_RMSEA
> 
> ### ** Examples
> 
> library(psycho)
> interpret_RMSEA(0.04)
[1] "good"
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_bf")
> ### * interpret_bf
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_bf
> ### Title: Bayes Factor Interpretation
> ### Aliases: interpret_bf
> 
> ### ** Examples
> 
> library(psycho)
> interpret_bf(x=10)
[1] "strong evidence (BF = 10) in favour of"
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_d")
> ### * interpret_d
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_d
> ### Title: Standardized difference (Cohen's d) interpreation.
> ### Aliases: interpret_d
> 
> ### ** Examples
> 
> library(psycho)
> interpret_d(-0.42)
[1] "small"
> interpret_d(-0.62)
[1] "medium"
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_d_posterior")
> ### * interpret_d_posterior
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_d_posterior
> ### Title: Standardized difference (Cohen's d) interpreation for a
> ###   posterior distribution.
> ### Aliases: interpret_d_posterior
> 
> ### ** Examples
> 
> library(psycho)
> posterior <- rnorm(1000, 0.6, 0.05)
> interpret_d_posterior(posterior)
The effect's size can be considered as medium or small with respective probabilities of 96.70% and 3.30%.
> interpret_d_posterior(rnorm(1000, 0.1, 1))
The effect's size can be considered as large, medium, small or very small with respective probabilities of 26.10%, 7.80%, 10.80% and 7.90%.
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_odds")
> ### * interpret_odds
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_odds
> ### Title: Omega Squared Interpretation
> ### Aliases: interpret_odds
> 
> ### ** Examples
> 
> library(psycho)
> interpret_odds(x=2)
[1] "small"
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_odds_posterior")
> ### * interpret_odds_posterior
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_odds_posterior
> ### Title: Odds ratio interpreation for a posterior distribution.
> ### Aliases: interpret_odds_posterior
> 
> ### ** Examples
> 
> library(psycho)
> posterior <- rnorm(1000, 0.6, 0.05)
> interpret_odds_posterior(posterior)
The effect's size can be considered as very small with a probability of 100%.
> interpret_odds_posterior(rnorm(1000, 0.1, 1))
The effect's size can be considered as medium, small or very small with respective probabilities of 0.10%, 6% and 46.50%.
> interpret_odds_posterior(rnorm(1000, 3, 1.5))
The effect's size can be considered as large, medium, small or very small with respective probabilities of 0.50%, 36.60%, 43.60% and 16.20%.
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_omega_sq")
> ### * interpret_omega_sq
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_omega_sq
> ### Title: Omega Squared Interpretation
> ### Aliases: interpret_omega_sq
> 
> ### ** Examples
> 
> library(psycho)
> interpret_omega_sq(x=0.05)
[1] "small"
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_r")
> ### * interpret_r
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_r
> ### Title: Correlation coefficient r interpreation.
> ### Aliases: interpret_r
> 
> ### ** Examples
> 
> library(psycho)
> interpret_r(-0.42)
[1] "moderate, and negative"
> 
> 
> 
> 
> cleanEx()
> nameEx("interpret_r_posterior")
> ### * interpret_r_posterior
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: interpret_r_posterior
> ### Title: Correlation coefficient r interpreation for a posterior
> ###   distribution.
> ### Aliases: interpret_r_posterior
> 
> ### ** Examples
> 
> library(psycho)
> posterior <- rnorm(1000, 0.5, 0.5)
> interpret_r_posterior(posterior)
The correlation can be considered as large, moderate, small or very small with respective probabilities of 48.20%, 17.50%, 12.50% and 5%.
> 
> 
> 
> 
> cleanEx()
> nameEx("is.standardized")
> ### * is.standardized
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: is.standardized
> ### Title: Check if a dataframe is standardized.
> ### Aliases: is.standardized
> 
> ### ** Examples
> 
> library(psycho)
> 
> df <- psycho::affective
> is.standardized(df)
[1] FALSE
> 
> dfZ <- psycho::standardize(df)
> is.standardized(dfZ)
[1] TRUE
> 
> 
> 
> 
> cleanEx()
> nameEx("mellenbergh.test")
> ### * mellenbergh.test
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: mellenbergh.test
> ### Title: Mellenbergh & van den Brink (1998) test for pre-post comparison.
> ### Aliases: mellenbergh.test
> 
> ### ** Examples
> 
> library(psycho)
> 
> mellenbergh.test(t0 = 4, t1 = 12, controls = c(0, -2, 5, 2, 1, 3, -4, -2))
The Mellenbergh & van den Brink (1998) test suggests that the change is not significant (d = 8, 90% CI [1.06, 14.94], z = 1.90, p = 0.06<b0>). However, the null hypothesis of no change can be rejected at a one-tailed 5% significance level (one-tailed p < .05*).
> mellenbergh.test(t0 = 8, t1 = 2, controls = 2.6)
The Mellenbergh & van den Brink (1998) test suggests that the change is not significant (d = -6, 90% CI [-12.07, 0.067], z = -1.63, p > .1).
> 
> 
> 
> 
> cleanEx()
> nameEx("model_to_priors")
> ### * model_to_priors
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: model_to_priors
> ### Title: Model to Prior.
> ### Aliases: model_to_priors
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(rstanarm)
> ##D library(psycho)
> ##D 
> ##D fit <- stan_glm(Sepal.Length ~ Petal.Width, data=iris)
> ##D priors <- model_to_priors(fit)
> ##D update(fit, prior=priors$prior)
> ##D 
> ##D fit <- stan_glmer(Subjective_Valence ~ Emotion_Condition + (1|Participant_ID), data=psycho::emotion)
> ##D priors <- model_to_priors(fit)
> ##D 
> ##D fit1 <- stan_glm(Subjective_Valence ~ Emotion_Condition,
> ##D     data=filter(psycho::emotion, Participant_ID == "1S"))
> ##D 
> ##D fit2 <- stan_glm(Subjective_Valence ~ Emotion_Condition,
> ##D     data=filter(psycho::emotion, Participant_ID == "1S"),
> ##D     prior=priors$prior, prior_intercept=priors$prior_intercept)
> ## End(Not run)
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("mpe")
> ### * mpe
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: mpe
> ### Title: Compute Maximum Probability of Effect (MPE).
> ### Aliases: mpe
> 
> ### ** Examples
> 
> library(psycho)
> library(rstanarm)
Loading required package: Rcpp
rstanarm (Version 2.17.4, packaged: 2018-04-13 01:51:52 UTC)
- Do not expect the default priors to remain the same in future rstanarm versions.
Thus, R scripts should specify priors explicitly, even if they are just the defaults.
- For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())
- Plotting theme set to bayesplot::theme_default().
> 
> fit <- rstanarm::stan_glm(rating ~ advance, data=attitude)

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).

Gradient evaluation took 0.000533 seconds
1000 transitions using 10 leapfrog steps per transition would take 5.33 seconds.
Adjust your expectations accordingly!


Iteration:    1 / 2000 [  0%]  (Warmup)
Iteration:  200 / 2000 [ 10%]  (Warmup)
Iteration:  400 / 2000 [ 20%]  (Warmup)
Iteration:  600 / 2000 [ 30%]  (Warmup)
Iteration:  800 / 2000 [ 40%]  (Warmup)
Iteration: 1000 / 2000 [ 50%]  (Warmup)
Iteration: 1001 / 2000 [ 50%]  (Sampling)
Iteration: 1200 / 2000 [ 60%]  (Sampling)
Iteration: 1400 / 2000 [ 70%]  (Sampling)
Iteration: 1600 / 2000 [ 80%]  (Sampling)
Iteration: 1800 / 2000 [ 90%]  (Sampling)
Iteration: 2000 / 2000 [100%]  (Sampling)

 Elapsed Time: 0.146658 seconds (Warm-up)
               0.104607 seconds (Sampling)
               0.251265 seconds (Total)


SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).

Gradient evaluation took 1.7e-05 seconds
1000 transitions using 10 leapfrog steps per transition would take 0.17 seconds.
Adjust your expectations accordingly!


Iteration:    1 / 2000 [  0%]  (Warmup)
Iteration:  200 / 2000 [ 10%]  (Warmup)
Iteration:  400 / 2000 [ 20%]  (Warmup)
Iteration:  600 / 2000 [ 30%]  (Warmup)
Iteration:  800 / 2000 [ 40%]  (Warmup)
Iteration: 1000 / 2000 [ 50%]  (Warmup)
Iteration: 1001 / 2000 [ 50%]  (Sampling)
Iteration: 1200 / 2000 [ 60%]  (Sampling)
Iteration: 1400 / 2000 [ 70%]  (Sampling)
Iteration: 1600 / 2000 [ 80%]  (Sampling)
Iteration: 1800 / 2000 [ 90%]  (Sampling)
Iteration: 2000 / 2000 [100%]  (Sampling)

 Elapsed Time: 0.133289 seconds (Warm-up)
               0.122532 seconds (Sampling)
               0.255821 seconds (Total)


SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).

Gradient evaluation took 1.5e-05 seconds
1000 transitions using 10 leapfrog steps per transition would take 0.15 seconds.
Adjust your expectations accordingly!


Iteration:    1 / 2000 [  0%]  (Warmup)
Iteration:  200 / 2000 [ 10%]  (Warmup)
Iteration:  400 / 2000 [ 20%]  (Warmup)
Iteration:  600 / 2000 [ 30%]  (Warmup)
Iteration:  800 / 2000 [ 40%]  (Warmup)
Iteration: 1000 / 2000 [ 50%]  (Warmup)
Iteration: 1001 / 2000 [ 50%]  (Sampling)
Iteration: 1200 / 2000 [ 60%]  (Sampling)
Iteration: 1400 / 2000 [ 70%]  (Sampling)
Iteration: 1600 / 2000 [ 80%]  (Sampling)
Iteration: 1800 / 2000 [ 90%]  (Sampling)
Iteration: 2000 / 2000 [100%]  (Sampling)

 Elapsed Time: 0.149154 seconds (Warm-up)
               0.104455 seconds (Sampling)
               0.253609 seconds (Total)


SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).

Gradient evaluation took 1.6e-05 seconds
1000 transitions using 10 leapfrog steps per transition would take 0.16 seconds.
Adjust your expectations accordingly!


Iteration:    1 / 2000 [  0%]  (Warmup)
Iteration:  200 / 2000 [ 10%]  (Warmup)
Iteration:  400 / 2000 [ 20%]  (Warmup)
Iteration:  600 / 2000 [ 30%]  (Warmup)
Iteration:  800 / 2000 [ 40%]  (Warmup)
Iteration: 1000 / 2000 [ 50%]  (Warmup)
Iteration: 1001 / 2000 [ 50%]  (Sampling)
Iteration: 1200 / 2000 [ 60%]  (Sampling)
Iteration: 1400 / 2000 [ 70%]  (Sampling)
Iteration: 1600 / 2000 [ 80%]  (Sampling)
Iteration: 1800 / 2000 [ 90%]  (Sampling)
Iteration: 2000 / 2000 [100%]  (Sampling)

 Elapsed Time: 0.146474 seconds (Warm-up)
               0.108537 seconds (Sampling)
               0.255011 seconds (Total)

> posterior <- psycho::analyze(fit)$values$effects$advance$posterior
> mpe <- psycho::mpe(posterior)
> print(mpe$MPE)
[1] 79.825
> print(mpe$values)
[1] 0.0000000 0.9729162
> 
> 
> 
> 
> 
> cleanEx()

detaching ‘package:rstanarm’, ‘package:Rcpp’

> nameEx("n_factors")
> ### * n_factors
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: n_factors
> ### Title: Find Optimal Factor Number.
> ### Aliases: n_factors
> 
> ### ** Examples
> 
> df <- dplyr::select_if(attitude, is.numeric)
> results <- psycho::n_factors(df)
> 
> summary(results)
# A tibble: 7 x 4
  n.Factors n.Methods Eigenvalues Cum.Variance
      <int>     <dbl>       <dbl>        <dbl>
1         1         5       3.72         0.531
2         2         3       1.14         0.694
3         3         1       0.847        0.815
4         4         0       0.613        0.902
5         5         0       0.324        0.949
6         6         0       0.219        0.980
7         7         0       0.140        1    
> plot(results)
> 
> # See details on methods
> psycho::values(results)$methods
                          Method n_optimal
1            Optimal Coordinates         1
2            Acceleration Factor         1
3              Parallel Analysis         1
4 Eigenvalues (Kaiser Criterion)         2
5                    Velicer MAP         1
6                            BIC         2
7       Sample Size Adjusted BIC         3
8               VSS Complexity 1         1
9               VSS Complexity 2         2
> 
> 
> 
> 
> cleanEx()
> nameEx("odds_to_d")
> ### * odds_to_d
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: odds_to_d
> ### Title: (Log) odds ratio to Cohen's d
> ### Aliases: odds_to_d
> 
> ### ** Examples
> 
> library(psycho)
> odds_to_d(x=2)
[1] 1.102658
> 
> 
> 
> 
> cleanEx()
> nameEx("odds_to_probs")
> ### * odds_to_probs
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: odds_to_probs
> ### Title: Convert (log)odds to probabilies.
> ### Aliases: odds_to_probs
> 
> ### ** Examples
> 
> library(psycho)
> odds_to_probs(-1.45)
[1] 0.1900016
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("omega_sq")
> ### * omega_sq
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: omega_sq
> ### Title: Partial Omega Squared.
> ### Aliases: omega_sq
> 
> ### ** Examples
> 
> library(psycho)
> 
> df <- psycho::affective
> 
> x <- aov(df$Tolerating ~ df$Salary)
> x <- aov(df$Tolerating ~ df$Salary * df$Sex)
> 
> omega_sq(x)
       df$Salary           df$Sex df$Salary:df$Sex 
    0.0013783984     0.0034163840     0.0007817444 
> 
> 
> 
> 
> cleanEx()
> nameEx("overlap")
> ### * overlap
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: overlap
> ### Title: Overlap of Two Empirical Distributions.
> ### Aliases: overlap
> 
> ### ** Examples
> 
> library(psycho)
> 
> x <- rnorm(100, 1, 0.5)
> y <- rnorm(100, 0, 1)
> overlap(x, y)
[1] 0.372753
> 
> 
> 
> 
> cleanEx()
> nameEx("percentile")
> ### * percentile
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: percentile
> ### Title: Transform z score to percentile.
> ### Aliases: percentile
> 
> ### ** Examples
> 
> library(psycho)
> percentile(-1.96)
[1] 2.49979
> 
> 
> 
> 
> cleanEx()
> nameEx("percentile_to_z")
> ### * percentile_to_z
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: percentile_to_z
> ### Title: Transform a percentile to a z score.
> ### Aliases: percentile_to_z
> 
> ### ** Examples
> 
> library(psycho)
> percentile_to_z(95)
[1] 1.644854
> 
> 
> 
> 
> cleanEx()
> nameEx("plot_loadings")
> ### * plot_loadings
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: plot_loadings
> ### Title: Plot loadings.
> ### Aliases: plot_loadings
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(psycho)
> ##D 
> ##D x <- psych::fa(psych::Thurstone.33, 2)
> ##D plot_loadings(format_loadings(x)$loadings)
> ## End(Not run)
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("power_analysis")
> ### * power_analysis
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: power_analysis
> ### Title: Power analysis for fitted models.
> ### Aliases: power_analysis
> 
> ### ** Examples
> 
> ## Not run: 
> ##D library(dplyr)
> ##D library(psycho)
> ##D 
> ##D fit <- lm(Sepal.Length ~ Sepal.Width, data=iris)
> ##D 
> ##D results <- power_analysis(fit, n_max=300, n_min=100, step=5, n_batch=20)
> ##D 
> ##D results %>%
> ##D   filter(Variable=="Sepal.Width") %>%
> ##D   select(n, p) %>%
> ##D   group_by(n) %>%
> ##D   summarise(p_median = median(p),
> ##D             p_mad = mad(p))
> ##D  
> ## End(Not run)
> 
> 
> 
> 
> cleanEx()
> nameEx("probs_to_odds")
> ### * probs_to_odds
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: probs_to_odds
> ### Title: Convert probabilities to (log)odds.
> ### Aliases: probs_to_odds
> 
> ### ** Examples
> 
> library(psycho)
> probs_to_odds(0.75)
[1] 3
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("refdata")
> ### * refdata
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: refdata
> ### Title: Create a reference grid.
> ### Aliases: refdata
> 
> ### ** Examples
> 
> library(psycho)
> 
> df <- psycho::affective
> newdata <- refdata(df, target="Sex")
> newdata <- refdata(df, target="Sex", factors="combinations")
> newdata <- refdata(df, target=c("Sex", "Salary", "Tolerating"), length.out=3)
> newdata <- refdata(df, target=c("Sex", "Salary", "Tolerating"), numerics=0)
> 
> 
> 
> 
> cleanEx()
> nameEx("reorder_matrix")
> ### * reorder_matrix
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: reorder_matrix
> ### Title: Reorder square matrix.
> ### Aliases: reorder_matrix
> 
> ### ** Examples
> 
> library(psycho)
> 
> r <- correlation(iris)
> r <- r$values$r
> r <- reorder_matrix(r)
> 
> 
> 
> 
> cleanEx()
> nameEx("rnorm_perfect")
> ### * rnorm_perfect
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: rnorm_perfect
> ### Title: Perfect Normal Distribution.
> ### Aliases: rnorm_perfect
> 
> ### ** Examples
> 
> library(psycho)
> x <- rnorm_perfect(10)
> plot(density(x))
> 
> 
> 
> 
> 
> cleanEx()
> nameEx("rope")
> ### * rope
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: rope
> ### Title: Region of Practical Equivalence (ROPE)
> ### Aliases: rope
> 
> ### ** Examples
> 
> library(psycho)
> 
> posterior <- rnorm(1000, 0, 0.01)
> results <- rope(posterior)
> results$decision
NULL
> 
> 
> 
> 
> cleanEx()
> nameEx("simulate_data_regression")
> ### * simulate_data_regression
> 
> flush(stderr()); flush(stdout())
> 
> ### Name: simulate_data_regression
> ### Title: Simulates data for single or multiple regression.
> ### Aliases: simulate_data_regression
> 
> ### ** Examples
> 
> library(psycho)
> 
> data <- simulate_data_regression(coefs=c(0.1, 0.8), sample=50, error=0)
Error in diag(x = 1, nrow = n_var + 1, ncol = n_var + 1, names = TRUE) : 
  unused argument (names = TRUE)
Calls: simulate_data_regression
Execution halted