Description Usage Arguments Details Value See Also Examples
inspect_bfactor_scale
checks if an object is a character
vector of length
1 that is eligible to represent one of
the Bayes factor interpretation scales available in the pcal
package. This
can be useful to validate inputs in user-defined functions.
1 |
x |
An arbitrary object. |
inspect_bfactor_scale
conducts a series of tests to check if x
is a character vector of length
1 that is eligible to
represent one of the Bayes factor interpretation scales available in the
pcal
package. Namely, inspect_bfactor_scale
checks if:
x
is NULL
or empty.
x
is NA
or NaN
.
x
is an atomic vector of length
1
The typeof
x
is character
The value of x
is either "Jeffreys" or "Kass-Raftery" (not case
sensitive).
inspect_bfactor_scale
does not return any output. There are two
possible scenarios:
The call is silent if x
is a character vector of
length
1 that is eligible to represent one of the Bayes
factor interpretation scales available in the pcal
package.
An informative error message is thrown otherwise.
bfactor_interpret
for the interpretation of Bayes
factors.
bfactor_log_interpret
for the interpretation of the
logarithms of Bayes factors.
inspect_bfactor
to check if an object is a numeric
vector of valid Bayes factor values.
inspect_bfactor_log
to check if an object is a
numeric vector of valid logarithmic Bayes factor values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Calls that pass silently:
x1 <- "Jeffreys"
x2 <- "jeffreys"
x3 <- "kass-raftery"
x4 <- "Kass-Raftery"
inspect_bfactor_scale(x1)
inspect_bfactor_scale(x2)
inspect_bfactor_scale(x3)
inspect_bfactor_scale(x4)
# Calls that throw informative error messages:
mylist <- list(
NULL, NA, NaN, 10, "Bayes", "Jeff",
"kassraftery", c("jeffreys", "kass-raftery")
)
try(inspect_bfactor_scale(mylist[[1]]))
try(inspect_bfactor_scale(mylist[[2]]))
try(inspect_bfactor_scale(mylist[[3]]))
try(inspect_bfactor_scale(mylist[[4]]))
try(inspect_bfactor_scale(mylist[[5]]))
try(inspect_bfactor_scale(mylist[[6]]))
try(inspect_bfactor_scale(mylist[[7]]))
try(inspect_bfactor_scale(mylist[[8]]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.