fa_Jensens_method: Scatter plot of Jensen's method

fa_Jensens_methodR Documentation

Scatter plot of Jensen's method

Description

Takes a factor analysis, data frame and name of the criterion variable as inputs and returns a ggplot2 scatter plot with Jensen's method applied.

Usage

fa_Jensens_method(
  fa,
  df,
  criterion,
  reverse_factor = F,
  loading_reversing = T,
  check_overlap = TRUE,
  n_factor = 1,
  indicator_criterion_method = "auto",
  .weights = NA,
  ...
)

Arguments

fa

(fa obj) A factor analysis object from fa().

df

(data frame) A data frame that contains indicators and criterion.

criterion

(chr) The name of the criterion variable.

reverse_factor

(lgl) Whether to reverse the factor. Used when factor analysis results in a reversed factor.

loading_reversing

(lgl) Whether to use loading reversing to avoid inflated results. Defaults to TRUE.

n_factor

(int) Which factor to use? Default is 1st factor. Only relevant for multifactor analysis.

indicator_criterion_method

(chr / num) Which method to use to compute indicator-criterion relationships?

Details

#indicator_criterion_method By default the function tries to automatically detect which kind of indicators are supplied. If indicators have any factors, logicals or numeric variables with less than 5 unique values, it it will call the hetcor function from polycor. If all are numeric with many levels, it will call the Pearson correlation (wtd.cors) from package weights with the supplied weights. Alternatively, one can input a numeric vector with the desired indicator-criterion relationships. These could be betas from complicated models.

Examples

#load a subset of okcupid data
data(okcupid_social_prudence)
library(psych); library(polycor)
#estimate latent correlations
cors = polycor::hetcor(okcupid_social_prudence[-1]) %>% magrittr::extract2("correlations")
#factor analyze normally
fa = fa(cors)
#apply Jensen's method
fa_Jensens_method(fa, okcupid_social_prudence, criterion = "CA")
#output shows that indicators with larger loadings tend to be more positively related to cognitive ability

Deleetdk/kirkegaard documentation built on April 22, 2024, 5:22 p.m.