| Title: | Pervasiveness Functions for Correlational Data |
| Version: | 1.0 |
| Description: | Analysis of pervasiveness of effects in correlational data. The Observed Proportion (or Percentage) of Concordant Pairs (OPCP) is Kendall's Tau expressed on a 0 to 1 metric instead of the traditional -1 to 1 metric to facilitate interpretation. As its name implies, it represents the proportion of concordant pairs in a sample (with an adjustment for ties). Pairs are concordant when a participant who has a larger value on a variable than another participant also has a larger value on a second variable. The OPCP is therefore an easily interpretable indicator of monotonicity. The pervasive functions are essentially wrappers for the 'arules' package by Hahsler et al. (2025)<doi:10.32614/CRAN.package.arules> and serve to count individuals who actually display the pattern(s) suggested by a regression. For more details, see the paper "Considering approaches to pervasiveness in the context of personality psychology" now accepted at the journal Personality Science. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Imports: | arules, dplyr, tibble, psych, methods, stats |
| Suggests: | knitr, rmarkdown, psychTools |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2025-10-31 19:07:41 UTC; pdl8039 |
| Author: | Denis Lajoie [aut, cre] |
| Maintainer: | Denis Lajoie <denis.lajoie@umoncton.ca> |
| Depends: | R (≥ 4.1.0) |
| Repository: | CRAN |
| Date/Publication: | 2025-11-04 19:00:02 UTC |
Calculate Observed Proportion of Concordant Pairs (OPCP)
Description
This function calculates the Observed Proportion of Concordant Pairs (OPCP) using Kendall's Tau as a measure of association. The pervasive functions also provide the OPCP.
Usage
OPCP(formula, data)
Arguments
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
Value
A numeric value representing the OPCP.
Examples
# Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_vars <- spi_sc |>
dplyr::select(age, Agree, Consc, Neuro, Extra, Open)
formula <- age ~ Agree + Consc + Neuro + Extra + Open
OPCP(formula = formula, data = spi_sc_vars)
Calculate Observed Proportion of Concordant Pairs (OPCP)
Description
This function calculates the Observed Proportion of Concordant Pairs (OPCP) using Kendall's Tau as a measure of association. The pervasive functions also provide the OPCP.
Usage
OPCP_glm(formula, data)
Arguments
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
Value
A numeric value representing the OPCP.
Examples
#Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_vars <- spi_sc |>
dplyr::select(sex, Agree, Consc, Neuro, Extra, Open)
spi_sc_vars$sex = spi_sc_vars$sex -1
formula <- sex ~ Agree + Consc + Neuro + Extra + Open
OPCP_glm(formula = formula, data = spi_sc_vars)
Calculate Observed Proportion of Concordant Pairs (OPCP)
Description
This function provides a matrix that contains Pearson correlations in the lower triangle and Observed Proportions of Concordant Pairs (OPCPs) in the upper triangle between multiple variables.
Usage
OPCP_mat(data, round_digits = 2)
Arguments
data |
A data frame containing the variables specified in the formula. |
round_digits |
The number of decimals to be included in the resulting table. |
Value
A matrix of correlations and OPCPs.
Examples
# Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_age_sex_B5 <- spi_sc |>
dplyr::select(age, sex, Agree, Consc, Neuro, Extra, Open)
OPCP_mat(data = spi_sc_age_sex_B5)
Association Rule Mining With Dichotomized Data
Description
This function provides the same information as pervasive_tric but with dichotomized data instead of trichotomized data. Trichotomized data is generally to be preferred when possible. Researchers interested in mixing trichotomized variables with dichotomized variables should use the arules package directly.
Usage
pervasive_dic(formula, data, min_support = 0.03)
Arguments
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
min_support |
The minimum proportion of rows that a rule must have to be considered for top rules. |
Value
@return A list with the following components:
-
OPCP: Observed proportion of concordant pairs. -
adj_r_squared: Adjusted R-squared value for the regression model. -
exact_match_lhs,exact_match_rhs: The left and right-hand side of the rule suggested by the regression model, respectively -
exact_match_quality: Quality metrics for the rule suggested by the regression. -
exact_match_lhs_opp,exact_match_rhs_opp: The left and right-hand side of the rule suggested by the low end of the regression model, respectively -
exact_match_quality_opp: Quality metrics for the rule suggested by the low end of the regression. -
top_rule_lhs,top_rule_rhs,top_rule_quality: Information relevant to the highest lift rule meeting min_support for high values of the dependent variable. -
top_rule_opp_lhs,top_rule_opp_rhs,top_rule_opp_quality: Information relevant to the highest lift rule meeting min_support for low values of the dependent variable. -
quality_table: A table summarizing the quality statistics for extracted association rules. -
freq_tables: Frequency tables (cutoffs and membership) for dichotomization binning.
Examples
# Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_vars <- spi_sc |>
dplyr::select(age, Agree, Consc, Neuro, Extra, Open)
formula <- age ~ Agree + Consc + Neuro + Extra + Open
example <- pervasive_dic(formula = formula, data = spi_sc_vars)
example
Association Rule Mining With Dichotomized Data
Description
This function provides similar information as pervasive_dic() and pervasive_tric() but should be the preferred option when the outcome variable is binary.
Usage
pervasive_dic_glm(formula, data, min_support = 0.03)
Arguments
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
min_support |
The minimum proportion of rows that a rule must have to be considered for top rules. |
Value
@return A list with the following components:
-
OPCP: Observed proportion of concordant pairs. -
adj_r_squared: Adjusted R-squared value for the regression model. -
exact_match_lhs,exact_match_rhs: The left and right-hand side of the rule suggested by the regression model, respectively -
exact_match_quality: Quality metrics for the rule suggested by the regression. -
exact_match_lhs_opp,exact_match_rhs_opp: The left and right-hand side of the rule suggested by the low end of the regression model, respectively -
exact_match_quality_opp: Quality metrics for the rule suggested by the low end of the regression. -
top_rule_lhs,top_rule_rhs,top_rule_quality: Information relevant to the highest lift rule meeting min_support for high values of the dependent variable. -
top_rule_opp_lhs,top_rule_opp_rhs,top_rule_opp_quality: Information relevant to the highest lift rule meeting min_support for low values of the dependent variable. -
quality_table: A table summarizing the quality statistics for extracted association rules. -
freq_tables: Frequency tables (cutoffs and membership) for dichotomization binning.
Examples
# Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_vars <- spi_sc |>
dplyr::select(sex, Agree, Consc, Neuro, Extra, Open)
spi_sc_vars$sex = spi_sc_vars$sex -1
formula <- sex ~ Agree + Consc + Neuro + Extra + Open
example <- pervasive_dic_glm(formula = formula, data = spi_sc_vars)
example
Association Rule Mining With Trichotomized Data
Description
This function extracts a specific set of association rules and reports quality measures for these rules. The OPCP and adjusted R-square for the regression model analyzed are also reported for a fuller pervasiveness context of the regression.
Usage
pervasive_tric(formula, data, min_support = 0.03)
Arguments
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
min_support |
The minimum proportion of rows that a rule must have to be considered for top rules. |
Value
@return A list with the following components:
-
OPCP: Observed proportion of concordant pairs. -
adj_r_squared: Adjusted R-squared value for the regression model. -
exact_match_lhs,exact_match_rhs: The left and right-hand side of the rule suggested by the regression model, respectively -
exact_match_quality: Quality metrics for the rule suggested by the regression. -
exact_match_lhs_opp,exact_match_rhs_opp: The left and right-hand side of the rule suggested by the low end of the regression model, respectively -
exact_match_quality_opp: Quality metrics for the rule suggested by the low end of the regression. -
top_rule_lhs,top_rule_rhs,top_rule_quality: Information relevant to the highest lift rule meeting min_support for high values of the dependent variable. -
top_rule_opp_lhs,top_rule_opp_rhs,top_rule_opp_quality: Information relevant to the highest lift rule meeting min_support for low values of the dependent variable. -
quality_table: A table summarizing the quality statistics for extracted association rules. -
freq_tables: Frequency tables (cutoffs and membership) for trichotomization binning.
Examples
# Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_vars <- spi_sc |>
dplyr::select(age, Agree, Consc, Neuro, Extra, Open)
formula <- age ~ Agree + Consc + Neuro + Extra + Open
example <- pervasive_tric(formula = formula, data = spi_sc_vars)
#From the results, it appears we would be rather unlikely to meet individuals
#with the patterns of personality traits suggested for old and young people
#by a linear regression when data is trichotomized.
example
Association Rule Mining With Trichotomized Data and a Binary outcome
Description
This function extracts a specific set of association rules and reports quality measures for these rules. The OPCP for the logistic regression model analyzed is also reported for a fuller pervasiveness context of the regression.
Usage
pervasive_tric_glm(formula, data, min_support = 0.03)
Arguments
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
min_support |
The minimum proportion of rows that a rule must have to be considered for top rules. |
Value
@return A list with the following components:
-
OPCP: Observed proportion of concordant pairs. -
adj_r_squared: Adjusted R-squared value for the regression model. -
exact_match_lhs,exact_match_rhs: The left and right-hand side of the rule suggested by the regression model, respectively -
exact_match_quality: Quality metrics for the rule suggested by the regression. -
exact_match_lhs_opp,exact_match_rhs_opp: The left and right-hand side of the rule suggested by the low end of the regression model, respectively -
exact_match_quality_opp: Quality metrics for the rule suggested by the low end of the regression. -
top_rule_lhs,top_rule_rhs,top_rule_quality: Information relevant to the highest lift rule meeting min_support for high values of the dependent variable. -
top_rule_opp_lhs,top_rule_opp_rhs,top_rule_opp_quality: Information relevant to the highest lift rule meeting min_support for low values of the dependent variable. -
quality_table: A table summarizing the quality statistics for extracted association rules. -
freq_tables: Frequency tables (cutoffs and membership) for trichotomization binning.
Examples
# Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_vars <- spi_sc |>
dplyr::select(age, Agree, Consc, Neuro, Extra, Open)
formula <- age ~ Agree + Consc + Neuro + Extra + Open
example <- pervasive_tric(formula = formula, data = spi_sc_vars)
#From the results, it appears we would be rather unlikely to meet
#individuals with the patterns of personality traits suggested for
#old and young people by a linear regression when data is trichotomized.
example