loglinear_analysis function

Loglinear analysis

Loglinear analysis

Conduct a loglinear analysis

loglinear_analysis( data = NULL, dv_name = NULL, iv_1_name = NULL, iv_2_name = NULL, iv_1_values = NULL, iv_2_values = NULL, output = "all", round_p = 3, round_chi_sq = 2, mosaic_plot = TRUE, report_as_field = FALSE )

Arguments

  • data: a data object (a data frame or a data.table)
  • dv_name: name of the dependent variable
  • iv_1_name: name of the first independent variable
  • iv_2_name: name of the second independent variable
  • iv_1_values: restrict all analyses to observations having these values for the first independent variable
  • iv_2_values: restrict all analyses to observations having these values for the second independent variable
  • output: type of the output. If output_type = "all", the function will return a results summary and print a mosaic plot. (default = "all")
  • round_p: number of decimal places to which to round p-values (default = 3)
  • round_chi_sq: number of decimal places to which to round chi-squared test statistics (default = 2)
  • mosaic_plot: If mosaic_plot = TRUE, a mosaic plot will be printed (default = TRUE)
  • report_as_field: If report_as_field = TRUE, reports summary will follow the format suggested by Andy Field (2012) (ISBN: 978-1-4462-0045-2, p. 851)

Examples

loglinear_analysis(data = data.frame(Titanic), "Survived", "Sex", "Age")