### Install easystats Development Version from GitHub Source: https://github.com/easystats/easystats/blob/main/README.md Installs the development version of the easystats package directly from the GitHub repository using the remotes package. Requires the remotes package to be installed. ```R remotes::install_github("easystats/easystats") ``` -------------------------------- ### Install easystats from CRAN Source: https://github.com/easystats/easystats/blob/main/README.md Installs the latest release version of the easystats package from the official CRAN repository. ```R install.packages("easystats") ``` -------------------------------- ### Install Suggested easystats Dependencies Source: https://github.com/easystats/easystats/blob/main/README.md Runs a function provided by the easystats package to install additional suggested packages required for the full functionality of the easystats ecosystem. ```R easystats::install_suggested() ``` -------------------------------- ### Install easystats Development Version from r-universe Source: https://github.com/easystats/easystats/blob/main/README.md Installs the development version of the easystats package from the easystats r-universe repository. ```R install.packages("easystats", repos = "https://easystats.r-universe.dev") ``` -------------------------------- ### Getting All Performance Indices for Linear Models in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Demonstrates using the `model_performance()` function from the `performance` package to obtain a comprehensive set of performance metrics for a linear regression model. ```R m1 <- lm(mpg ~ wt + cyl, data = mtcars) model_performance(m1) ``` -------------------------------- ### Get easystats Citation Information Source: https://github.com/easystats/easystats/blob/main/README.md Displays the recommended citation information for the easystats package, including authors, year, journal, and a BibTeX entry for use in publications. ```R citation("easystats") ``` -------------------------------- ### Getting All Performance Indices for Mixed Models in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Illustrates how to use the `model_performance()` function from the `performance` package to retrieve various performance indices for a linear mixed-effects model fitted with the `lme4` package. ```R library(lme4) m3 <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy) model_performance(m3) ``` -------------------------------- ### Calculate Point Estimates (MAP, Median, Mean) in bayestestR (R) Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md This R code snippet demonstrates how to compute different point estimates from a simulated posterior distribution using the `map_estimate()` and `point_estimate()` functions from the `bayestestR` package. It shows how to get the default median, the mean, and the MAP estimate. ```R set.seed(1) posterior <- rchisq(100, 3) map_estimate(posterior) #> MAP = 1.46 point_estimate(posterior) #> Median = 2.31 point_estimate(posterior, centrality = "mean") #> Mean = 2.96 point_estimate(posterior, centrality = "map") #> MAP = 1.46 ``` -------------------------------- ### Compute Credible Intervals (HDI, ETI) in bayestestR (R) Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md This R code snippet shows how to calculate the 89% Highest Density Interval (HDI) and Equal-Tailed Interval (ETI) for the `posterior` distribution created in the previous example. These functions (`hdi()` and `eti()`) from the `bayestestR` package are used to quantify the uncertainty around the point estimate. ```R hdi(posterior) #> # Highest Density Interval #> #> 89% HDI #> [0.11, 6.05] eti(posterior) #> # Equal-Tailed Interval #> #> 89% ETI #> [0.42, 7.27] ``` -------------------------------- ### Visualizing Model Comparison with performance and see (R) Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Shows how to visualize the output of `compare_performance()` using the `plot()` function, which is enhanced by the `see` package. It requires the `see` library to be loaded and takes the result of `compare_performance()` as input to generate a plot of the model performance indices. ```R library(see) plot(compare_performance(lm1, lm2, lm3, lm4)) ``` -------------------------------- ### Visualizing Correlation Matrix - correlation/see - R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Illustrates how to compute a correlation matrix using `correlation::correlation()` and `summary()` and visualize it using `see::plot()`. Requires the `correlation` and `see` packages. ```R library(correlation) library(see) results <- summary(correlation(iris)) plot(results) ``` -------------------------------- ### Visualizing Residual Normality Check - performance/see - R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Illustrates how to perform a normality check on model residuals using `performance::check_normality()` and visualize the results as a Q-Q plot using `see::plot()`. Requires the `performance` and `see` packages. ```R library(performance) library(see) model <- lm(wt ~ mpg, data = mtcars) check <- check_normality(model) #> Warning: Non-normality of residuals detected (p = 0.016). plot(check, type = "qq") ``` -------------------------------- ### Visualizing Bayesian HDI - bayestestR/see - R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Shows how to fit a Bayesian model using `rstanarm`, compute Highest Density Intervals (HDI) using `bayestestR::hdi()`, and visualize the results using `see::plot()`. Requires the `bayestestR`, `rstanarm`, and `see` packages. ```R library(bayestestR) library(rstanarm) library(see) model <- stan_glm(wt ~ mpg, data = mtcars, refresh = 0) result <- hdi(model, ci = c(0.5, 0.75, 0.89, 0.95)) plot(result) ``` -------------------------------- ### Comparing Multiple Models with performance::compare_performance (R) Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Demonstrates how to compare multiple linear regression models using the `compare_performance()` function from the `performance` package. It loads the `iris` dataset, fits four different linear models (`lm1` through `lm4`), and then calls `compare_performance()` with these models to generate a table of performance indices like AIC, BIC, R2, RMSE, and Sigma. ```R data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) lm3 <- lm(Sepal.Length ~ Species * Sepal.Width, data = iris) lm4 <- lm(Sep.Length ~ Species * Sepal.Width + Petal.Length + Petal.Width, data = iris) compare_performance(lm1, lm2, lm3, lm4) ``` -------------------------------- ### Visualizing Model Assumptions with performance in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Shows how to use the `check_model()` function from the `performance` package, in conjunction with the `see` package, to generate diagnostic plots for visually assessing regression model assumptions. ```R library(see) model <- lm(mpg ~ wt + am + gear + vs * cyl, data = mtcars) check_model(model) ``` -------------------------------- ### Visualizing Effect Size (Omega Squared) - effectsize/see - R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Demonstrates how to compute omega squared effect size for an ANOVA model using `effectsize::omega_squared()` and visualize the results using `see::plot()`. Requires the `effectsize` and `see` packages. ```R library(effectsize) library(see) model <- aov(wt ~ am * cyl, data = mtcars) plot(omega_squared(model)) ``` -------------------------------- ### Fitting Model and Extracting Results with ggplot2 Workflow (R) Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md This snippet demonstrates the initial steps of a typical workflow for visualizing statistical model results using the ggplot2 package in R. It involves loading the ggplot2 library, fitting a linear model using the base R `lm` function, and then using the `fortify` function (often from ggplot2 or a related package) to convert the model object's results into a dataframe suitable for plotting. ```R library(ggplot2) # step-1 model <- lm(mpg ~ factor(cyl) * wt, data = mtcars) # step-2 results <- fortify(model) ``` -------------------------------- ### Comparing Models using Bayes Factors with performance::test_bf (R) Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Demonstrates how to compare models specifically using Bayes Factors within a Bayesian framework. The `test_bf()` function computes Bayes Factors for model comparison, typically comparing each model against a specified denominator model (defaulting to the first model provided). It outputs a table summarizing the Bayes Factors. ```R test_bf(lm1, lm2, lm3, lm4) ``` -------------------------------- ### Visualizing Marginal Means - modelbased/see - R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Shows how to compute marginal means from a linear model using `modelbased::estimate_means()` and visualize them using `see::plot()`. Requires the `modelbased` and `see` packages. ```R library(modelbased) library(see) model <- lm(mpg ~ wt * as.factor(cyl), data = mtcars) means <- estimate_means(model) plot(means) ``` -------------------------------- ### Extracting Parameters from Linear Model in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2020_parameters/paper.md Demonstrates the basic usage of the `parameters()` function to extract parameters from a standard linear model fitted using `lm` in R. ```R library(parameters) model <- lm(Sepal.Length ~ Species, data = iris) parameters(model) ``` -------------------------------- ### Plotting Model Parameters with see in R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Illustrates how to use the plot() function from the see package to visualize the parameters extracted from a linear model object using the parameters package. This creates a dot-and-whisker plot of regression estimates. Requires loading the parameters, see, and ggplot2 libraries. ```R library(parameters) library(see) library(ggplot2) model <- lm(wt ~ am * cyl, data = mtcars) plot(parameters(model)) ``` -------------------------------- ### Setting a ggplot2 Theme with see in R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Shows how to apply a custom ggplot2 theme provided by the see package using the ggplot2::theme_set function. This sets the specified theme as the default for all subsequent ggplot2 plots in the current R session. ```R ggplot2::theme_set(see::theme_modern()) ``` -------------------------------- ### Plotting Model Parameters in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2020_parameters/paper.md Shows how to visualize the extracted model parameters using the `plot()` function provided by the `see` package, which integrates with the `parameters` package. ```R library(see) model <- lm(Sepal.Length ~ Petal.Width * Species, data=iris) plot(parameters(model)) ``` -------------------------------- ### Testing Model Performance with performance::test_performance (R) Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Illustrates the use of the generic `test_performance()` function to perform statistical tests comparing multiple models. For linear models, this function computes tests like Vuong's Test. It takes multiple model objects as input and outputs a table showing test statistics and p-values (or Bayes Factors) comparing each model against the first model (`lm1` in this case). ```R test_performance(lm1, lm2, lm3, lm4) ``` -------------------------------- ### Checking Heteroscedasticity with performance in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Demonstrates how to use the `check_heteroscedasticity()` function from the `performance` package to test for non-constant error variance in a linear regression model. ```R data(cars) model <- lm(dist ~ speed, data = cars) check_heteroscedasticity(model) ``` -------------------------------- ### Extracting Robust Parameters in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2020_parameters/paper.md Illustrates how to obtain robust standard errors and confidence intervals for model parameters by setting the `robust` argument to `TRUE` in the `parameters()` function. Requires packages like `sandwich` or `clubSandwich`. ```R parameters(model, robust = TRUE) ``` -------------------------------- ### Extracting Parameters from Mixed Model in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2020_parameters/paper.md Shows how to use the `parameters()` function with a linear mixed model fitted using `lmer` from the `lme4` package, demonstrating control over output digits. ```R library(lme4) model <- lmer( Sepal.Length ~ Sepal.Width * Petal.Length + (1 | Species), data = iris ) parameters(model, digits = 3) ``` -------------------------------- ### Plotting easystats Package Dependencies in R Source: https://github.com/easystats/easystats/blob/main/README.md This snippet demonstrates how to visualize the dependency network of the easystats package using the deepdep package. It loads deepdep and then calls plot_dependencies to show dependencies up to depth 2, excluding the timestamp. ```R library(deepdep) plot_dependencies("easystats", depth = 2L, show_stamp = FALSE) ``` -------------------------------- ### Calculating Eta-Squared Effect Sizes for ANOVA in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Demonstrates how to calculate partial and generalized Eta-squared effect sizes for an ANOVA model using the `eta_squared()` function. It prepares the `ChickWeight` data and fits an `aov` model before applying the function with different arguments. ```R options(contrasts = c('contr.sum', 'contr.poly')) data("ChickWeight") # keep only complete cases and convert `Time` to a factor ChickWeight <- subset(ChickWeight, ave(weight, Chick, FUN = length) == 12) ChickWeight$Time <- factor(ChickWeight$Time) model <- aov(weight ~ Diet * Time + Error(Chick / Time), data = ChickWeight) eta_squared(model, partial = TRUE) eta_squared(model, generalized = "Time") ``` -------------------------------- ### Computing R-squared for Mixed Models in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Illustrates how to use the `r2()` function from the `performance` package to compute conditional and marginal R-squared values for a linear mixed-effects model, requiring the `lme4` package. ```R library(lme4) model <- lmer( Petal.Length ~ Petal.Width + (1 | Species), data = iris ) r2(model) ``` -------------------------------- ### Standardizing Linear Model Parameters in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Shows how to standardize parameters of a linear model (`lm`) using `standardize_parameters()` and how to refit the model with standardized data using `standardize()`. It uses the `mtcars` dataset and a model predicting `mpg` from `cyl` and `am`. ```R model <- lm(mpg ~ cyl * am, data = mtcars) standardize(model) standardize_parameters(model) ``` -------------------------------- ### Checking Overdispersion with performance in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Illustrates the use of the `check_overdispersion()` function from the `performance` package to detect overdispersion in a Poisson regression model, requiring the `glmmTMB` package. ```R library(glmmTMB) data(Salamanders) model <- glm(count ~ spp + mined, family = poisson, data = Salamanders) check_overdispersion(model) ``` -------------------------------- ### Converting Test Statistics to Effect Sizes in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Demonstrates how to use `F_to_eta2`, `t_to_d`, and `t_to_r` functions from the `effectsize` package to convert common test statistics (F and t) into corresponding effect size measures (partial eta-squared, Cohen's d, and correlation coefficient r), along with their confidence intervals. ```R F_to_eta2(f = c(40.72, 33.77), df = c(2, 1), df_error = c(18, 9)) #'> Eta2 (partial) | 90% CI #'> ----------------------------- #'> 0.82 | [0.66, 0.89] #'> 0.79 | [0.49, 0.89] t_to_d(t = -5.14, df_error = 22) #'> d | 95% CI #'> ---------------------- #'> -2.19 | [-3.23, -1.12] t_to_r(t = -5.14, df_error = 22) #'> r | 95% CI #'> ---------------------- #'> -0.74 | [-0.85, -0.49] ``` -------------------------------- ### Computing R-squared for Linear Models in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Demonstrates how to use the `r2()` function from the `performance` package to calculate the coefficient of determination (R-squared) for a standard linear regression model. ```R model <- lm(mpg ~ wt + cyl, data = mtcars) r2(model) ``` -------------------------------- ### Calculate and Visualize Probability of Direction for Bayesian Model in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md This R code snippet demonstrates how to fit a Bayesian linear regression model using `rstanarm`, calculate the Probability of Direction (`pd`) for its parameters using `p_direction()` from `bayestestR`, and visualize the results using the `plot()` function from the `see` package. ```R library(rstanarm) library(see) model <- stan_glm(Petal.Width ~ Petal.Length * Sepal.Width, data = iris) result_pd <- p_direction(model) print(result_pd) plot(result_pd) ``` -------------------------------- ### Compute MAP-based p-value in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md This snippet demonstrates how to compute the MAP-based p-value for a distribution using the `p_map()` function from the `bayestestR` package. It calculates the odds against the null hypothesis based on the density at 0 and the Maximum A Posteriori. ```R p_map(distribution_normal(1000, mean = 1)) ``` -------------------------------- ### Converting Between Different Effect Size Types in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Illustrates the conversion between various effect size metrics using functions like `r_to_d`, `d_to_oddsratio`, `oddsratio_to_riskratio`, and `oddsratio_to_r`, enabling comparisons and transformations between different types of effect sizes (correlation r, Cohen's d, Odds Ratio, Risk Ratio). ```R r_to_d(0.7) #'> [1] 1.960392 d_to_oddsratio(1.96) #'> [1] 34.98946 oddsratio_to_riskratio(34.99, p0 = 0.4) #'> [1] 2.397232 oddsratio_to_r(34.99) #'> [1] 0.6999301 ``` -------------------------------- ### Calculate Pearson Correlation in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_correlation/paper.md Demonstrates the core workflow of the correlation package, showing how to compute pairwise Pearson correlations for the iris dataset and displaying the resulting long-format dataframe output. ```R results <- correlation(iris) results # Parameter1 | Parameter2 | r | 95% CI | t | df | p | Method | n_Obs # --------------------------------------------------------------------------------------------- # Sepal.Length | Sepal.Width | -0.12 | [-0.27, 0.04] | -1.44 | 148 | 0.152 | Pearson | 150 # Sepal.Length | Petal.Length | 0.87 | [ 0.83, 0.91] | 21.65 | 148 | < .001 | Pearson | 150 # Sepal.Length | Petal.Width | 0.82 | [ 0.76, 0.86] | 17.30 | 148 | < .001 | Pearson | 150 # Sepal.Width | Petal.Length | -0.43 | [-0.55, -0.29] | -5.77 | 148 | < .001 | Pearson | 150 # Sepal.Width | Petal.Width | -0.37 | [-0.50, -0.22] | -4.79 | 148 | < .001 | Pearson | 150 # Petal.Length | Petal.Width | 0.96 | [ 0.95, 0.97] | 43.39 | 148 | < .001 | Pearson | 150 ``` -------------------------------- ### Extracting Mixed Model Parameters with Kenward-Roger DF in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2020_parameters/paper.md Demonstrates specifying the degrees of freedom approximation method, such as 'kenward' (Kenward-Roger), when extracting parameters from a linear mixed model using `parameters()`, which can improve accuracy. ```R parameters(model, digits = 3, df_method = "kenward") ``` -------------------------------- ### Standardizing GLM Parameters (Odds Ratios) in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Illustrates standardizing parameters for a generalized linear model (GLM) with a binomial family using `standardize_parameters()`. The `exponentiate = TRUE` argument is used to obtain standardized odds ratios, demonstrating its application to GLMs. ```R model <- glm(am ~ cyl + hp, family = "binomial", data = mtcars) standardize_parameters(model, exponentiate = TRUE) ``` -------------------------------- ### Perform Practical Equivalence Test in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md Implements the "HDI+ROPE decision rule" to test for practical equivalence against a null hypothesis defined by a ROPE. It checks if the HDI of a parameter's posterior distribution is completely outside (rejected), completely inside (accepted), or overlapping (undecided) the ROPE. Requires a model object, typically from a Bayesian package like rstanarm. ```R library(rstanarm) model <- stan_glm(mpg ~ wt + gear, data = mtcars) equivalence_test(model) ``` -------------------------------- ### Estimating Effect Sizes from R htest Objects Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Shows how the `effectsize()` function can directly compute effect sizes from standard R hypothesis test objects (`htest`), such as the output of `oneway.test` (yielding eta-squared) and `chisq.test` (yielding Cramer's V), simplifying the process of obtaining effect sizes from common statistical tests. ```R aov1 <- oneway.test(salary ~ n_comps, data = hardlyworking, var.equal = TRUE) effectsize(aov1) #'> Eta2 | 90% CI #'> ------------------- #'> 0.20 | [0.14, 0.24] xtab <- rbind(c(762, 327, 468), c(484, 239, 477), c(484, 239, 477)) Xsq <- chisq.test(xtab) effectsize(Xsq) #'> Cramer's V | 95% CI #'> ------------------------- #'> 0.07 | [0.05, 0.09] ``` -------------------------------- ### Visualizing Model Results with ggplot2 in R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Demonstrates a basic ggplot2 plot visualizing model results, showing observed data points (mpg vs wt, colored by cyl) and fitted lines based on model predictions (.fitted vs wt, colored by cyl). This snippet assumes 'results' is a dataframe containing the original data and model predictions. ```R ggplot(results) + geom_point(aes(x = wt, y = mpg, color = factor(cyl))) + geom_line(aes(x = wt, y = .fitted, color = `factor(cyl)`)) ``` -------------------------------- ### Computing Intraclass Correlation Coefficient (ICC) in R Source: https://github.com/easystats/easystats/blob/main/publications/ludecke_2021_performance/paper.md Shows how to use the `icc()` function from the `performance` package to calculate the Intraclass Correlation Coefficient for a mixed-effects model fitted using the `brms` package. ```R library(brms) set.seed(123) model <- brm(mpg ~ wt + (1 | cyl) + (1 + wt | gear), data = mtcars ) icc(model) ``` -------------------------------- ### Compute Proportion of HDI within ROPE in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md Computes the proportion of the Highest Density Interval (HDI) of a posterior distribution that falls within a specified Region Of Practical Equivalence (ROPE). If no range is provided, an appropriate range is automatically determined using `rope_range()`. This index helps assess the practical equivalence of a parameter to a null value. ```R rope(distribution_normal(1000, mean = 1), range = c(-0.5, 0.5)) ``` -------------------------------- ### Summarize Correlation Results as Matrix in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_correlation/paper.md Shows how to transform the long-format output from the correlation function into a more traditional square correlation matrix using the summary method. ```R summary(results) # Parameter | Petal.Width | Petal.Length | Sepal.Width # ------------------------------------------------------- # Sepal.Length | 0.82*** | 0.87*** | -0.12 # Sepal.Width | -0.37*** | -0.43*** | # Petal.Length | 0.96*** | | ``` -------------------------------- ### Compute Bayes Factor for Parameters in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md Computes Bayes factors against a specified null value or interval using prior and posterior samples of a parameter. It indicates how much the evidence for the null has changed from the prior to the posterior. For a point null, it uses the Savage-Dickey density ratio. Requires both prior and posterior samples for the parameter. ```R prior <- distribution_normal(1000, mean = 0, sd = 1) posterior <- distribution_normal(1000, mean = 1, sd = 0.7) bayesfactor_parameters(posterior, prior, direction = "two-sided", null = 0) ``` -------------------------------- ### Customizing Plot Appearance - ggplot2 - R Source: https://github.com/easystats/easystats/blob/main/publications/luedecke_2021_see/paper.md Demonstrates how to modify the title and y-axis labels of a plot generated by `plot(parameters(model))` using `ggplot2` functions `labs()` and `scale_y_discrete()`. Requires a plot object created from `parameters()` output. ```R plot(parameters(model)) + labs(title = "A Dot-and-Whisker Plot") + scale_y_discrete(labels = c( "transmission * cylinders", "cylinders", "transmission" )) ``` -------------------------------- ### Calculating Cramér's V for Contingency Table in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Demonstrates how to calculate Cramér's V, a measure of association between two categorical variables, using the `cramers_v()` function. It takes a contingency table (matrix `M`) as input and outputs the Cramér's V value with a confidence interval. ```R M <- rbind(c(150, 130, 35, 55), c(100, 50, 10, 40), c(165, 65, 2, 25)) cramers_v(M) ``` -------------------------------- ### Interpreting Cohen's d Effect Size in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md Demonstrates the use of the `interpret_d()` function to apply predefined interpretation rules, such as Cohen's (1988) guidelines, to effect size values (specifically Cohen's d), providing qualitative labels like "very small", "medium", or "large" based on the numerical value. ```R interpret_d(c(0.02, 0.52, 0.86), rules = "cohen1988") #'> [1] "very small" "medium" "large" #'> (Rules: cohen1988) ``` -------------------------------- ### Compute Probability of Direction (pd) in R Source: https://github.com/easystats/easystats/blob/main/publications/makowski_2019_bayestestR/paper.md Computes the Probability of Direction (pd), also known as the Maximum Probability of Effect (MPE). This index represents the probability that a parameter's posterior distribution is strictly positive or negative, whichever is more probable. It is calculated as the proportion of the posterior distribution with the same sign as the median. ```R p_direction(distribution_normal(100, 0.4, 0.2)) ``` -------------------------------- ### Estimate Cohen's d using effectsize in R Source: https://github.com/easystats/easystats/blob/main/publications/benshachar_2020_effectsize/paper.md This snippet demonstrates how to use the `cohens_d()` function from the 'effectsize' package to calculate Cohen's d for the difference between two groups. It uses a formula interface (`mpg ~ am`) and specifies the data source (`mtcars`). The output shows the estimated Cohen's d value and its 95% confidence interval. ```R cohens_d(mpg ~ am, data = mtcars) #> Cohen's d | 95% CI #> -------------------------- #> -1.48 | [-2.27, -0.67] #> #> - Estimated using pooled SD. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.