### Setup R environment for 'effectsize' and 'see' packages Source: https://easystats.github.io/see/reference/articles/effectsize Loads the necessary 'effectsize' and 'see' R packages and loads example datasets 'mtcars' and 'iris' for demonstration purposes. ```R library(effectsize) library(see) data(mtcars) data(iris) ``` -------------------------------- ### R Example: Plotting a Described Distribution Source: https://easystats.github.io/see/reference/reference/plot.see_parameters_distribution This R code example demonstrates how to use the `plot()` method with an object generated by `parameters::describe_distribution()`. It sets up a reproducible example, generates sample data, describes its distribution, and then plots the result, showing the basic usage of the `plot.see_parameters_distribution` method. ```R library(parameters) set.seed(333) x <- sample(1:100, 1000, replace = TRUE) result <- describe_distribution(x) result #> #> Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing #> ------------------------------------------------------------------------------- #> 50.18 | 28.66 | 48.75 | [1.00, 100.00] | 0.02 | -1.16 | 1000 | 0 plot(result) ``` -------------------------------- ### Setup R Environment and Fit Bayesian Models Source: https://easystats.github.io/see/reference/articles/bayestestR Loads necessary R packages (`bayestestR`, `insight`, `see`, `rstanarm`, `ggplot2`) and sets a modern theme. It then fits two example Bayesian models: a fixed-effects model using `stan_glm` and downloads a pre-existing `brms` model with random effects and zero-inflation. ```R library(bayestestR) library(insight) library(see) library(rstanarm) library(ggplot2) theme_set(theme_modern()) set.seed(123) # model with fixed effects only model <<- rstanarm::stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0) # model with fixed and random effects as well as zero-inflation component model2 <<- insight::download_model("brms_zi_3") ``` -------------------------------- ### Install the 'see' R package Source: https://easystats.github.io/see/reference/index Instructions for installing the 'see' package from various sources: CRAN for the stable release, r-universe for the latest development version, or GitHub for direct development access. Choose the command based on your desired version and source. ```R install.packages("see") ``` ```R install.packages("see", repos = "https://easystats.r-universe.dev") ``` ```R remotes::install_github("easystats/see") ``` -------------------------------- ### R Example: Plotting Support Intervals Source: https://easystats.github.io/see/reference/reference/plot.see_si This R example demonstrates how to generate and plot support intervals using `bayestestR::si()` and the `plot` method for `see_si` objects. It includes setting up a `stan_glm` model and visualizing its support intervals. ```R library(rstanarm) library(bayestestR) set.seed(123) m <<- suppressWarnings(stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0)) result <- si(m, verbose = FALSE) result #> Support Interval #> #> Parameter | BF = 1 SI | Effects | Component #> --------------------------------------------------------------------- #> (Intercept) | [ 4.39, 5.18] | fixed | conditional #> Petal.Width | [-0.16, 2.00] | fixed | conditional #> Speciesversicolor | [-1.68, 0.21] | fixed | conditional #> Speciesvirginica | [-0.59, 1.54] | fixed | conditional #> Petal.Width:Speciesversicolor | [-0.61, 1.73] | fixed | conditional #> Petal.Width:Speciesvirginica | [-1.27, 0.77] | fixed | conditional plot(result) ``` -------------------------------- ### R Example: Plotting Estimated Contrasts with modelbased Source: https://easystats.github.io/see/reference/reference/plot.see_estimate_contrasts Illustrates a practical example of using the `plot` method with `estimate_contrasts` and `estimate_means` from the `modelbased` package. It demonstrates the workflow of fitting a linear model, estimating contrasts, and then visualizing them. ```R # \donttest{ library(modelbased) model <- lm(Sepal.Width ~ Species, data = iris) contrasts <- estimate_contrasts(model) #> We selected `contrast=c("Species")`. means <- estimate_means(model) #> We selected `by=c("Species")`. plot(contrasts, means) # } ``` -------------------------------- ### R Example: Plotting Posterior Predictive Checks with `performance` Source: https://easystats.github.io/see/reference/reference/print.see_performance_pp_check Provides R code examples demonstrating how to perform posterior predictive checks using `check_predictions` from the `performance` package and visualize the results with the `plot` method, including a specific example for discrete count models. ```R library(performance) model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris) check_predictions(model) # dot-plot style for count-models d <- iris d$poisson_var <- rpois(150, 1) model <- glm( poisson_var ~ Species + Petal.Length + Petal.Width, data = d, family = poisson() ) out <- check_predictions(model) plot(out, type = "discrete_dots") ``` -------------------------------- ### Example of applying theme_azurelight to a ggplot in R Source: https://easystats.github.io/see/reference/reference/theme_azurelight This example demonstrates how to use `theme_azurelight` with `ggplot2` to create a scatter plot with the custom theme applied. It loads necessary libraries and uses the `iris` dataset. ```R library(ggplot2) library(see) data(iris) ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) + geom_point2(size = 2.5) + scale_color_social() + theme_azurelight() ``` -------------------------------- ### R Example for Plotting Principal Components Analysis Results Source: https://easystats.github.io/see/reference/reference/plot.see_parameters_pca This R code example demonstrates the practical application of the `plot()` method for visualizing principal component analysis. It shows how to load the `parameters` library, prepare data from `mtcars`, perform PCA using `principal_components()`, and then generate a plot of the results, including the output of the PCA object. ```R library(parameters) data(mtcars) result <- principal_components(mtcars[, 1:7], n = "all", threshold = 0.2) result #> # Loadings from Principal Component Analysis (no rotation) #> #> Variable | PC1 | PC2 | PC3 | PC4 | PC5 | PC6 | Complexity #> ------------------------------------------------------------------- #> mpg | -0.93 | | | -0.30 | | | 1.30 #> cyl | 0.96 | | | | | -0.21 | 1.18 #> disp | 0.95 | | | -0.23 | | | 1.16 #> hp | 0.87 | 0.36 | | | 0.30 | | 1.64 #> drat | -0.75 | 0.48 | 0.44 | | | | 2.47 #> wt | 0.88 | -0.35 | 0.26 | | | | 1.54 #> qsec | -0.54 | -0.81 | | | | | 1.96 #> #> The 6 principal components accounted for 99.30% of the total variance of the original data (PC1 = 72.66%, PC2 = 16.52%, PC3 = 4.93%, PC4 = 2.26%, PC5 = 1.85%, PC6 = 1.08%). #> plot(result) ``` -------------------------------- ### General Updates for see 0.2.1 Source: https://easystats.github.io/see/reference/news/index Version 0.2.1 of the 'see' package introduces more comprehensive examples on the package website and adds new color palettes for plotting. ```APIDOC see package 0.2.1 General: - More comprehensive examples available on the package website. - Added new color-palettes. ``` -------------------------------- ### R Example: Plotting Compared Model Parameters Source: https://easystats.github.io/see/reference/reference/plot.see_compare_parameters An R code example demonstrating the usage of `plot()` with `parameters::compare_parameters()` output. It sets up three linear models, compares their parameters, and then generates a plot of the comparison. ```R data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) lm3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) result <- parameters::compare_parameters(lm1, lm2, lm3) plot(result) ``` -------------------------------- ### Comparing Multiple Linear Model Performances in R Source: https://easystats.github.io/see/reference/articles/performance This example demonstrates how to compare the performance of several linear models using `compare_performance()`. It shows how to fit multiple models, compute their performance metrics, and then visualize the results. ```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(Sepal.Length ~ Species * Sepal.Width + Petal.Length + Petal.Width, data = iris) result <- compare_performance(lm1, lm2, lm3, lm4) result #> # Comparison of Model Performance Indices #> #> Name | Model | AIC (weights) | AICc (weights) | BIC (weights) | R2 #> --------------------------------------------------------------------- #> lm1 | lm | 231.5 (<.001) | 231.7 (<.001) | 243.5 (<.001) | 0.619 #> lm2 | lm | 106.2 (<.001) | 106.6 (<.001) | 121.3 (<.001) | 0.837 #> lm3 | lm | 187.1 (<.001) | 187.9 (<.001) | 208.2 (<.001) | 0.727 #> lm4 | lm | 78.8 (>.999) | 80.1 (>.999) | 105.9 (>.999) | 0.871 #> #> Name | R2 (adj.) | RMSE | Sigma #> -------------------------------- #> lm1 | 0.614 | 0.510 | 0.515 #> lm2 | 0.833 | 0.333 | 0.338 #> lm3 | 0.718 | 0.431 | 0.440 #> lm4 | 0.865 | 0.296 | 0.305 plot(result) ``` -------------------------------- ### R example for plotting simulated model parameters Source: https://easystats.github.io/see/reference/reference/plot.see_parameters_simulate This R code demonstrates how to simulate parameters from a linear model using `parameters::simulate_parameters()` and then visualize the results using the `plot()` method from the `see` package. It includes model fitting, parameter simulation, and the plotting call, along with the output of the simulated parameters. ```R library(parameters) m <<- lm(mpg ~ wt + cyl + gear, data = mtcars) result <- simulate_parameters(m) result #> # Fixed Effects #> #> Parameter | Coefficient | 95% CI | p #> --------------------------------------------------- #> (Intercept) | 42.19 | [33.75, 51.65] | < .001 #> wt | -3.39 | [-4.99, -1.75] | < .001 #> cyl | -1.54 | [-2.40, -0.70] | < .001 #> gear | -0.47 | [-2.11, 1.07] | 0.530 #> #> Uncertainty intervals (equal-tailed) and p-values (two-tailed) #> computed using a simulated multivariate normal distribution #> approximation. plot(result) ``` -------------------------------- ### R Example: Plotting Bayes Factors for Model Comparison Source: https://easystats.github.io/see/reference/reference/plot.see_bayesfactor_models Demonstrates how to use the `plot` method with `bayestestR::bayesfactor_models` to visualize model comparison results. It shows examples with single and multiple pies, and different value displays (probability vs. Bayes Factor), along with custom fill scales. ```R library(bayestestR) library(see) lm0 <- lm(qsec ~ 1, data = mtcars) lm1 <- lm(qsec ~ drat, data = mtcars) lm2 <- lm(qsec ~ wt, data = mtcars) lm3 <- lm(qsec ~ drat + wt, data = mtcars) result <- bayesfactor_models(lm1, lm2, lm3, denominator = lm0) plot(result, n_pies = "one", value = "probability", sort = TRUE) + scale_fill_pizza(reverse = TRUE) plot(result, n_pies = "many", value = "BF", log = TRUE) + scale_fill_pizza(reverse = FALSE) ``` -------------------------------- ### Setup R Environment for 'parameters' Package Analysis Source: https://easystats.github.io/see/reference/articles/parameters This R code block initializes the environment by loading essential packages such as 'parameters', 'effectsize', 'insight', 'see', 'glmmTMB', 'lme4', 'lavaan', 'metafor', and 'ggplot2'. It also loads sample datasets, sets a random seed for reproducibility, and applies a modern ggplot2 theme for consistent plotting aesthetics. ```R library(parameters) library(effectsize) library(insight) library(see) library(glmmTMB) library(lme4) library(lavaan) library(metafor) library(ggplot2) data("Salamanders") data("iris") data("sleepstudy") data("qol_cancer") set.seed(12345) sleepstudy$grp <- sample.int(5, size = 180, replace = TRUE) theme_set(theme_modern()) ``` -------------------------------- ### Prepare Data for 'see' Color Scale Examples in R Source: https://easystats.github.io/see/reference/articles/seecolorscales Loads `ggplot2` and `see` libraries, then prepares the `iris` dataset by adding new group variables and creates three custom data frames (`d1`, `d2`, `d3`) with varying numbers of groups for demonstrating line geoms. Finally, it sets a modern theme for plots. ```R library(ggplot2) library(see) data(iris) iris$group4 <- as.factor(sample(1:4, size = nrow(iris), replace = TRUE)) iris$group5 <- as.factor(sample(1:5, size = nrow(iris), replace = TRUE)) d1 <- data.frame( x = rep(1:20, 3), y = c( seq(2, 4, length.out = 20), seq(3, 6, length.out = 20), seq(5, 3, length.out = 20) ), group = rep(factor(1:3), each = 20) ) d2 <- data.frame( x = rep(1:20, 4), y = c( seq(2, 4, length.out = 20), seq(3, 6, length.out = 20), seq(5, 3, length.out = 20), seq(4, 2.5, length.out = 20) ), group = rep(factor(1:4), each = 20) ) d3 <- data.frame( x = rep(1:20, 5), y = c( seq(2, 4, length.out = 20), seq(3, 6, length.out = 20), seq(5, 3, length.out = 20), seq(4, 2.5, length.out = 20), seq(3.5, 4.5, length.out = 20) ), group = rep(factor(1:5), each = 20) ) theme_set(theme_modern(legend.position = "bottom")) ``` -------------------------------- ### R Example: Plotting Model Performance Comparison with performance and see Source: https://easystats.github.io/see/reference/reference/plot.see_compare_performance This R code demonstrates how to use `performance::compare_performance` to compare multiple linear models and then visualize the comparison using the `plot` method from the `see` package. It shows model creation, performance comparison, and the final plotting step. ```R library(performance) data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) lm3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) result <- compare_performance(lm1, lm2, lm3) result # # Comparison of Model Performance Indices # # Name | Model | AIC (weights) | AICc (weights) | BIC (weights) | R2 # --------------------------------------------------------------------- # lm1 | lm | 231.5 (<.001) | 231.7 (<.001) | 243.5 (<.001) | 0.619 # lm2 | lm | 106.2 (0.566) | 106.6 (0.611) | 121.3 (0.964) | 0.837 # lm3 | lm | 106.8 (0.434) | 107.6 (0.389) | 127.8 (0.036) | 0.840 # # Name | R2 (adj.) | RMSE | Sigma # -------------------------------- # lm1 | 0.614 | 0.510 | 0.515 # lm2 | 0.833 | 0.333 | 0.338 # lm3 | 0.835 | 0.330 | 0.336 plot(result) ``` -------------------------------- ### R: `ggplot2` Examples with `scale_color_pizza` Source: https://easystats.github.io/see/reference/reference/scale_color_pizza These examples demonstrate the practical application of `scale_fill_pizza_d()` for discrete fill and `scale_color_pizza_c()` for continuous color in `ggplot2` visualizations, using the `iris` dataset and `theme_modern()` from the `see` package. ```R library(ggplot2) library(see) ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + geom_boxplot() + theme_modern() + scale_fill_pizza_d() ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Sepal.Length)) + geom_point() + theme_modern() + scale_color_pizza_c() ``` -------------------------------- ### R Example: Plotting bayestestR Point Estimates Source: https://easystats.github.io/see/reference/reference/plot.see_point_estimate Demonstrates how to use the `plot` method for `see_point_estimate` objects. This example sets up a `stan_glm` model, calculates point estimates using `bayestestR::point_estimate()`, and then visualizes the results using the `plot` method. ```R library(rstanarm) library(bayestestR) set.seed(123) m <<- suppressWarnings(stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0)) result <- point_estimate(m, centrality = "median") result plot(result) ``` -------------------------------- ### Update: R `see` Package Compatibility with `performance` API Source: https://easystats.github.io/see/reference/news/index Code and examples within the `see` package were updated to align with new API decisions made for the *performance* package, ensuring seamless integration. ```R ## Internal API adjustments for `performance` package compatibility. ``` -------------------------------- ### R Example: Plotting Bayesian Meta-Analysis Model Parameters Source: https://easystats.github.io/see/reference/reference/plot.see_parameters_brms_meta This R code example demonstrates the full workflow for plotting parameters from a Bayesian meta-analysis model. It includes loading necessary libraries, preparing data, fitting a `brms` model, extracting parameters with `model_parameters()`, and finally visualizing them using the specialized `plot()` method. ```R # \donttest{ library(parameters) library(brms) library(metafor) data(dat.bcg) dat <- escalc( measure = "RR", ai = tpos, bi = tneg, ci = cpos, di = cneg, data = dat.bcg ) dat$author <- make.unique(dat$author) # model set.seed(123) priors <- c( prior(normal(0, 1), class = Intercept), prior(cauchy(0, 0.5), class = sd) ) model <- suppressWarnings( brm(yi | se(vi) ~ 1 + (1 | author), data = dat, refresh = 0, silent = 2) ) # result mp <- model_parameters(model) plot(mp) # } ``` -------------------------------- ### Prepare data and set ggplot2 theme for 'see' package examples Source: https://easystats.github.io/see/reference/articles/seecolorscales_dark Loads necessary R packages (`ggplot2`, `see`), prepares sample dataframes (`d1`, `d2`, `d3`) with varying numbers of groups (three, four, and five) for demonstration. It also modifies the `iris` dataset and sets a global `ggplot2` theme (`theme_abyss`) suitable for dark backgrounds. ```R library(ggplot2) library(see) data(iris) iris$group4 <- as.factor(sample(1:4, size = nrow(iris), replace = TRUE)) iris$group5 <- as.factor(sample(1:5, size = nrow(iris), replace = TRUE)) d1 <- data.frame( x = rep(1:20, 3), y = c( seq(2, 4, length.out = 20), seq(3, 6, length.out = 20), seq(5, 3, length.out = 20) ), group = rep(factor(1:3), each = 20) ) d2 <- data.frame( x = rep(1:20, 4), y = c( seq(2, 4, length.out = 20), seq(3, 6, length.out = 20), seq(5, 3, length.out = 20), seq(4, 2.5, length.out = 20) ), group = rep(factor(1:4), each = 20) ) d3 <- data.frame( x = rep(1:20, 5), y = c( seq(2, 4, length.out = 20), seq(3, 6, length.out = 20), seq(5, 3, length.out = 20), seq(4, 2.5, length.out = 20), seq(3.5, 4.5, length.out = 20) ), group = rep(factor(1:5), each = 20) ) theme_set(theme_abyss(legend.position = "bottom")) ``` -------------------------------- ### Setup R Libraries for Data Analysis Source: https://easystats.github.io/see/reference/articles/datawizard Loads essential R packages 'datawizard', 'see', and 'ggplot2' for data manipulation, visualization, and statistical modeling. It also sets a modern theme for ggplot2 plots. ```R library(datawizard) library(see) library(ggplot2) theme_set(theme_modern()) ``` -------------------------------- ### Example of plotting density estimation with rstanarm and bayestestR Source: https://easystats.github.io/see/reference/reference/plot.see_estimate_density Demonstrates how to use the `plot()` method on an `estimate_density` object derived from a `stan_glm` model. It initializes a model, calculates density estimation, and then plots the result, illustrating a typical workflow for visualizing posterior distributions. ```R library(rstanarm) library(bayestestR) set.seed(123) m <<- suppressWarnings(stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0)) result <- estimate_density(m) plot(result) ``` -------------------------------- ### R `see` Package `geom_point_borderless` Example with Fill Aesthetic Source: https://easystats.github.io/see/reference/reference/geom_point2 Illustrates the use of `geom_point_borderless` from the `see` package, highlighting that its color aesthetic is 'fill' instead of 'color'. This example applies the function to the Iris dataset, coloring points by species. ```R ggplot(iris, aes(x = Petal.Width, y = Sepal.Length, fill = Species)) + geom_point_borderless(size = 4) + theme_modern() ``` -------------------------------- ### R: Example of plotting ROPE results Source: https://easystats.github.io/see/reference/reference/plot.see_rope This R example demonstrates how to use the `plot` method on a `see_rope` object. It involves loading `rstanarm` and `bayestestR`, fitting a `stan_glm` model, calculating ROPE, and then plotting the `result` object, showing the output of the `rope` function. ```R library(rstanarm) library(bayestestR) set.seed(123) m <<- suppressWarnings(stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0)) result <- rope(m) #> Possible multicollinearity between Petal.Width:Speciesversicolor and #> Petal.Width (r = 0.87), Petal.Width:Speciesvirginica and #> Petal.Width:Speciesversicolor (r = 0.79). This might lead to #> inappropriate results. See 'Details' in '?rope'. result #> # Proportion of samples inside the ROPE [-0.08, 0.08]: #> #> Parameter | inside ROPE #> ------------------------------------------- #> (Intercept) | 0.00 % #> Petal.Width | 3.89 % #> Speciesversicolor | 4.63 % #> Speciesvirginica | 8.50 % #> Petal.Width:Speciesversicolor | 6.79 % #> Petal.Width:Speciesvirginica | 10.74 % #> plot(result) ``` -------------------------------- ### Example Usage of plot.see_p_direction in R Source: https://easystats.github.io/see/reference/reference/plot.see_p_direction This R code example demonstrates how to plot the probability of direction results. It initializes a `stan_glm` model, calculates the probability of direction using `p_direction`, and then visualizes the `result` object using the `plot` method. ```R library(rstanarm) library(bayestestR) set.seed(123) m <<- suppressWarnings(stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0)) result <- p_direction(m) plot(result) ``` -------------------------------- ### R Examples: Applying theme_modern to ggplot Source: https://easystats.github.io/see/reference/reference/theme_modern Demonstrates how to apply the `theme_modern` to `ggplot2` visualizations. The examples show basic usage and how to enable inner tick marks using the `show.ticks` argument, enhancing plot readability. Requires `ggplot2` and `see` packages. ```R library(ggplot2) library(see) ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + geom_point() + scale_color_see() + theme_modern() # for a slightly better orientation, tick marks can be added ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + geom_point() + scale_color_see() + theme_modern(show.ticks = TRUE) ``` -------------------------------- ### R Examples for Okabe-Ito Color Palette Retrieval Source: https://easystats.github.io/see/reference/reference/okabeito_colors Illustrates practical usage of `okabeito_colors()` in R, showing how to retrieve the full palette, select specific colors, and apply options like `original_names` and `black_first`. ```R okabeito_colors() #> orange light blue green amber blue red purple #> "#E69F00" "#56B4E9" "#009E73" "#F5C710" "#0072B2" "#D55E00" "#CC79A7" #> grey black #> "#999999" "#000000" okabeito_colors(c("red", "light blue", "orange")) #> red light blue orange #> "#D55E00" "#56B4E9" "#E69F00" okabeito_colors(original_names = TRUE) #> orange sky blue bluish green amber blue #> "#E69F00" "#56B4E9" "#009E73" "#F5C710" "#0072B2" #> vermillion reddish purple grey black #> "#D55E00" "#CC79A7" "#999999" "#000000" okabeito_colors(black_first = TRUE) #> black orange light blue green amber blue red #> "#000000" "#E69F00" "#56B4E9" "#009E73" "#F5C710" "#0072B2" "#D55E00" #> purple grey #> "#CC79A7" "#999999" ``` -------------------------------- ### Plotting Model Parameters for SEM Models Source: https://easystats.github.io/see/reference/articles/parameters This example demonstrates how to extract and plot model parameters from Structural Equation Models (SEM) created with the `lavaan` package. It shows the typical workflow of defining a model structure, fitting the model, and then visualizing its parameters. ```R structure <- " visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9 " model <- lavaan::cfa(structure, data = HolzingerSwineford1939) result <- model_parameters(model) plot(result) ``` -------------------------------- ### Load R Packages for Correlation Plotting Source: https://easystats.github.io/see/reference/articles/correlation Loads the necessary R packages: 'correlation' for statistical analysis, 'see' for visualization, and 'ggplot2' for advanced plotting capabilities. These packages are essential for running the subsequent examples. ```R library(correlation) library(see) library(ggplot2) ``` -------------------------------- ### Calculate Practical Significance (R) Source: https://easystats.github.io/see/reference/articles/parameters Demonstrates the calculation of practical significance for a linear model using the p_significance() function. The snippet includes an example of plotting the resulting practical significance values. ```R data(qol_cancer) model <- lm(QoL ~ time + age + education, data = qol_cancer) result <- p_significance(model) plot(result) ``` -------------------------------- ### R: Display all available Material Design colors Source: https://easystats.github.io/see/reference/reference/material_colors This example demonstrates how to use `material_colors()` without any arguments to retrieve and display a named character vector of all available Material Design colors and their corresponding hex codes. ```R material_colors() #> red pink purple deep purple indigo blue #> "#f44336" "#E91E63" "#9C27B0" "#673AB7" "#3F51B5" "#2196F3" #> light blue cyan teal green light green lime #> "#03A9F4" "#00BCD4" "#009688" "#4CAF50" "#8BC34A" "#CDDC39" #> yellow amber orange deep orange brown grey #> "#FFEB3B" "#FFC107" "#FF9800" "#FF5722" "#795548" "#9E9E9E" #> blue grey #> "#607D8B" ``` -------------------------------- ### Example Usage of geom_violindot in R Source: https://easystats.github.io/see/reference/reference/geom_violindot Illustrates how to use `geom_violindot` with `ggplot2` to create a violin-dot plot, demonstrating basic setup and theme application. ```R library(ggplot2) library(see) ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + geom_violindot() + theme_modern() ``` -------------------------------- ### R: `golden_ratio` function examples Source: https://easystats.github.io/see/reference/reference/golden_ratio Illustrates how to call the `golden_ratio` function without arguments to retrieve the golden ratio constant, and with an argument to multiply a given number by the golden ratio. ```R golden_ratio() #> [1] 1.618034 golden_ratio(10) #> [1] 16.18034 ``` -------------------------------- ### R Examples: Applying See Color Palettes in ggplot2 Source: https://easystats.github.io/see/reference/reference/scale_color_see Demonstrates how to use `scale_fill_see`, `scale_colour_see`, and `scale_color_see` functions from the `see` package to customize `ggplot2` plots with various color palettes for discrete and continuous data. ```R library(ggplot2) library(see) ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + geom_boxplot() + theme_modern() + scale_fill_see() ``` ```R ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Species)) + geom_point() + theme_abyss() + scale_colour_see(palette = "light") ``` ```R ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Sepal.Length)) + geom_point() + theme_modern() + scale_color_see(discrete = FALSE) ``` -------------------------------- ### R: Get specific Flat UI color hex codes Source: https://easystats.github.io/see/reference/reference/flat_colors This R example illustrates how to use the `flat_colors()` function by passing specific color names as arguments. It demonstrates retrieving the hex codes for 'dark red' and 'teal' from the Flat UI palette. ```R flat_colors("dark red", "teal") #> dark red teal #> "#c0392b" "#16a085" ``` -------------------------------- ### Calculate p-value Function and Plot Consonance (R) Source: https://easystats.github.io/see/reference/articles/parameters Demonstrates the use of the p_function() to calculate and visualize the p-value function and consonance/compatibility plot for a linear model. It includes examples for default plotting and customizing confidence interval levels and line sizes. ```R data(iris) model <- lm(Sepal.Length ~ Species, data = iris) result <- p_function(model) plot(result) ``` ```R result <- p_function(model, ci_levels = c(0.5, 0.7, emph = 0.9)) plot(result, size_line = c(0.6, 1.2)) ``` -------------------------------- ### R Example: Generating and Plotting an ROC Curve Source: https://easystats.github.io/see/reference/reference/plot.see_performance_roc Illustrates a complete R workflow for creating a ROC curve. It includes loading necessary libraries, preparing sample data, fitting a binomial generalized linear model, generating ROC data using `performance::performance_roc`, and finally plotting the result using the `see` package's `plot` method. ```R library(performance) data(iris) set.seed(123) iris$y <- rbinom(nrow(iris), size = 1, .3) folds <- sample(nrow(iris), size = nrow(iris) / 8, replace = FALSE) test_data <- iris[folds, ] train_data <- iris[-folds, ] model <- glm(y ~ Sepal.Length + Sepal.Width, data = train_data, family = "binomial") result <- performance_roc(model, new_data = test_data) result #> AUC: 37.66% plot(result) ``` -------------------------------- ### R: Examples of Applying Social Color Palettes in ggplot2 Source: https://easystats.github.io/see/reference/reference/scale_color_social These R code examples demonstrate how to integrate `scale_fill_social` and `scale_color_social` from the `see` package with `ggplot2`. The first two examples apply discrete fill scales to boxplots and violin plots of the `iris` dataset, showcasing default and 'ice' palettes. The third example illustrates a continuous color scale for a scatter plot, mapping `Sepal.Length` to color. ```R library(ggplot2) library(see) ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + geom_boxplot() + theme_modern() + scale_fill_social() ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + geom_violin() + theme_modern() + scale_fill_social(palette = "ice") ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Sepal.Length)) + geom_point() + theme_modern() + scale_color_social(discrete = FALSE) ``` -------------------------------- ### Modeling Count Data with Poisson GLM and Model Checks in R Source: https://easystats.github.io/see/reference/articles/performance This example shows how to fit a Generalized Linear Model (GLM) with a Poisson family for count data in R and then perform a general model check using `check_model`. ```R model <- glm( count ~ spp + mined + cover, family = poisson(), data = Salamanders ) check_model(model) ``` -------------------------------- ### Citing the 'see' R Package Source: https://easystats.github.io/see/reference/articles/performance Demonstrates how to obtain citation information for the 'see' package in R, including BibTeX entry for publications. ```R citation("see") ``` -------------------------------- ### R Example: Retrieve all blue-brown hex codes Source: https://easystats.github.io/see/reference/reference/bluebrown_colors Demonstrates how to retrieve all available blue-brown color hex codes by calling the `bluebrown_colors` function without any arguments. The output shows the color names and their corresponding hex values. ```R bluebrown_colors() #> lightblue blue darkblue grey lightbrown brown darkbrown #> "#6DC0E0" "#5B93AE" "#1F4454" "#dbdbdb" "#92673C" "#61381A" "#391D07" ``` -------------------------------- ### R Example: Apply Abyss Theme to ggplot Source: https://easystats.github.io/see/reference/reference/theme_abyss Demonstrates how to apply the `theme_abyss` to a ggplot visualization using the `iris` dataset. This example creates a scatter plot with white points and then applies the custom theme. ```R library(ggplot2) library(see) ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length)) + geom_point(color = "white") + theme_abyss() ``` -------------------------------- ### Perform Practical Equivalence Test with Multiple CIs Source: https://easystats.github.io/see/reference/articles/bayestestR This example extends the practical equivalence test by specifying multiple confidence intervals (89% and 95%) for the HDI calculation. It uses the `equivalence_test` function on a `model` object, providing a more comprehensive view of parameter equivalence against the ROPE. ```R result <- equivalence_test(model, ci = c(0.89, 0.95)) result ``` -------------------------------- ### Cite 'see' R package Source: https://easystats.github.io/see/reference/articles/seecolorscales_dark Demonstrates how to cite the 'see' R package in publications using the `citation()` function, providing both a plain text and BibTeX entry for academic referencing. ```R citation("see") #> To cite package 'see' in publications use: #> #> Lüdecke et al., (2021). see: An R Package for Visualizing Statistical #> Models. Journal of Open Source Software, 6(64), 3393. #> https://doi.org/10.21105/joss.03393 #> #> A BibTeX entry for LaTeX users is #> #> @Article{, #> title = {{see}: An {R} Package for Visualizing Statistical Models}, #> author = {Daniel Lüdecke and Indrajeet Patil and Mattan S. Ben-Shachar and Brenton M. Wiernik and Philip Waggoner and Dominique Makowski}, #> journal = {Journal of Open Source Software}, #> year = {2021}, #> volume = {6}, #> number = {64}, #> pages = {3393}, #> doi = {10.21105/joss.03393}, #> } ``` -------------------------------- ### R Example: Plotting Iris Data with `geom_poolpoint` Source: https://easystats.github.io/see/reference/reference/geom_poolpoint Demonstrates how to use `geom_poolpoint` with the `iris` dataset to label points with row names, applying `scale_color_flat_d()` and `theme_modern()` for styling. This example visualizes Petal.Width against Sepal.Length, colored by Species. ```R library(ggplot2) library(see) ggplot(iris, aes(x = Petal.Width, y = Sepal.Length, color = Species)) + geom_poolpoint(label = rownames(iris)) + scale_color_flat_d() + theme_modern() ``` -------------------------------- ### R Example: Visualizing n_factors Results with plot.see_n_factors Source: https://easystats.github.io/see/reference/reference/plot.see_n_factors Demonstrates practical usage of the `plot.see_n_factors` method in R. It shows how to apply `parameters::n_factors` to the `mtcars` dataset and then visualize the results using the `plot()` function with different `type` arguments ('bar', 'line', 'area') to illustrate the method agreement procedure. ```R data(mtcars) result <- parameters::n_factors(mtcars, type = "PCA") result plot(result) # type = "bar" by default plot(result, type = "line") plot(result, type = "area") ``` -------------------------------- ### Example of plotting model assumptions for linear models in R Source: https://easystats.github.io/see/reference/reference/plot.see_check_model This example demonstrates how to use the `plot` method with the `check_model` function from the `performance` package to visualize diagnostic plots for a simple linear regression model in R. ```R library(performance) model <- lm(qsec ~ drat + wt, data = mtcars) plot(check_model(model)) ``` -------------------------------- ### Citing the 'see' Package in R Source: https://easystats.github.io/see/reference/articles/parameters This R code snippet demonstrates how to obtain the citation information for the 'see' package, which is essential for proper attribution in publications. It outputs both a standard citation format and a BibTeX entry for LaTeX users. ```R citation("see") #> To cite package 'see' in publications use: #> #> Lüdecke et al., (2021). see: An R Package for Visualizing Statistical #> Models. Journal of Open Source Software, 6(64), 3393. #> https://doi.org/10.21105/joss.03393 #> #> A BibTeX entry for LaTeX users is #> #> @Article{, #> title = {{see}: An {R} Package for Visualizing Statistical Models}, #> author = {Daniel Lüdecke and Indrajeet Patil and Mattan S. Ben-Shachar and Brenton M. Wiernik and Philip Waggoner and Dominique Makowski}, #> journal = {Journal of Open Source Software}, #> year = {2021}, #> volume = {6}, #> number = {64}, #> pages = {3393}, #> doi = {10.21105/joss.03393}, #> } ``` -------------------------------- ### R Example: Plotting Iris Data with `geom_pooljitter` Source: https://easystats.github.io/see/reference/reference/geom_poolpoint Illustrates the application of `geom_pooljitter` to the `iris` dataset, showing how to add jittered, labeled points while using `scale_color_flat_d()` and `theme_modern()`. This example also visualizes Petal.Width against Sepal.Length, colored by Species. ```R ggplot(iris, aes(x = Petal.Width, y = Sepal.Length, color = Species)) + geom_pooljitter(label = rownames(iris)) + scale_color_flat_d() + theme_modern() ``` -------------------------------- ### Load the 'see' R package Source: https://easystats.github.io/see/reference/index Loads the 'see' package into the current R session, making its functions and plotting methods available for use. For a more integrated experience with the entire 'easystats' ecosystem, it is recommended to load the 'easystats' package instead. ```R library("see") ``` -------------------------------- ### Cite 'see' R Package Source: https://easystats.github.io/see/reference/articles/datawizard Demonstrates how to cite the 'see' R package in publications, providing both the output from the `citation()` function and a BibTeX entry for LaTeX users. ```R citation("see") #> To cite package 'see' in publications use: #> #> Lüdecke et al., (2021). see: An R Package for Visualizing Statistical #> Models. Journal of Open Source Software, 6(64), 3393. #> https://doi.org/10.21105/joss.03393 #> #> A BibTeX entry for LaTeX users is #> #> @Article{, #> title = {{see}: An {R} Package for Visualizing Statistical Models}, #> author = {Daniel Lüdecke and Indrajeet Patil and Mattan S. Ben-Shachar and Brenton M. Wiernik and Philip Waggoner and Dominique Makowski}, #> journal = {Journal of Open Source Software}, #> year = {2021}, #> volume = {6}, #> number = {64}, #> pages = {3393}, #> doi = {10.21105/joss.03393}, #> } ``` -------------------------------- ### Project License Details Source: https://easystats.github.io/see/reference/LICENSE-text This snippet specifies the copyright year and the entity holding the copyright for the 'see' project, as part of its licensing information. ```Text YEAR: 2023 COPYRIGHT HOLDER: see authors ```