| Title: | Pervasiveness Functions for Correlational Data |
|---|---|
| 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. |
| Authors: | Denis Lajoie [aut, cre] |
| Maintainer: | Denis Lajoie <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0 |
| Built: | 2026-06-03 09:00:23 UTC |
| Source: | https://github.com/cran/pervasive |
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.
OPCP(formula, data)OPCP(formula, data)
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
A numeric value representing the OPCP.
# 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)# 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)
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.
OPCP_glm(formula, data)OPCP_glm(formula, data)
formula |
A formula specifying the dependent and independent variables. |
data |
A data frame containing the variables specified in the formula. |
A numeric value representing the OPCP.
#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)#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)
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.
OPCP_mat(data, round_digits = 2)OPCP_mat(data, round_digits = 2)
data |
A data frame containing the variables specified in the formula. |
round_digits |
The number of decimals to be included in the resulting table. |
A matrix of correlations and OPCPs.
# 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)# 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)
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.
pervasive_dic(formula, data, min_support = 0.03)pervasive_dic(formula, data, min_support = 0.03)
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. |
@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.
# 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# 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
This function provides similar information as pervasive_dic() and pervasive_tric() but should be the preferred option when the outcome variable is binary.
pervasive_dic_glm(formula, data, min_support = 0.03)pervasive_dic_glm(formula, data, min_support = 0.03)
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. |
@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.
# 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# 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
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.
pervasive_tric(formula, data, min_support = 0.03)pervasive_tric(formula, data, min_support = 0.03)
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. |
@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.
# 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# 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
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.
pervasive_tric_glm(formula, data, min_support = 0.03)pervasive_tric_glm(formula, data, min_support = 0.03)
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. |
@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.
# 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# 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