Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SocialFacts

R-CMD-check

SocialFacts brings a tool to produce easily multiple indicators commonly used in social sciences :

  • Odds Ratio, with p.value and CI
  • Average Marginal Effects, with CI
  • A cramer's V table, to check correlation between your categorical variables
  • A gt table with Yule's Q value compute against the vars_dep argument.
  • A new tool called Average Attributable Fraction, described by Ferguson and al. here : We use the original graphPAF library, and facilitate it's use to produce a table which resume all of this tools in one place.

Installation

You can install the development version of SocialFacts like so:

devtools::install_github("Geminy3/SocialFacts")

of install it via CRAN :

install.packages("SocialFacts")

Example

This is a basic example which shows you how to solve a common problem:

library(SocialFacts)
## basic example code

### Fit a logistic model
model <- glm(var_dep ~ some + var + you + have, data = data, family = binomial(...))

### You can check the correlation between your categorical data
get_cramer(var = c("var_1", "var_2"), metric = 'cramer', data = data)

### To compute and store the AAF
resAAF <- get_AAF(model = model, nvar = 3, vars_dep = "var_dep", data = data)

### To get the summary table
resume_tab <- result_tab(result_tab(model = model, var_ref = "var_dep", var_names = c("var_1", "var_2"),
                       res_AAF = resAAF$res, data = data)

### To view the table
resume_tab

### To export the table
resume_tab |>
  gtsave(filename = "~/the/path/to/store/it/TAB_RECAP.png", expand = 10)

About

❗ This is a read-only mirror of the CRAN R package repository. SocialFacts — Average Attributable Fraction and Other Relevant Social Sciences Indicators. Homepage: https://github.com/Geminy3/SocialFactshttps://geminy3.github.io/SocialFacts/ Report bugs for this package: https://github.com/Geminy3/Social ...

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages