Publications by Amir Freund

Stargazer Tables

05.02.2025

1 Required Libraries library(stargazer) library(afcommon) 2 Prepare Dataset We’ll use the mtcars dataset and create some categorical variables to demonstrate the functionality. # Load and prepare the data data <- mtcars # Create categorical variables data$size_cat <- cut(data$wt, breaks = c(-Inf, 2.5, 3.5, Inf), ...

2828 sym 1 tbl

RMarkdown Header

05.02.2025

--- title: 'RMarkdown Header' subtitle: 'Template for RMarkdown files.' author: 'Amir Freund' date: '`r Sys.Date()`' output: html_document: code_folding: hide # show / hide toc: true # table of content true toc_depth: 3 # upto three depths of headings (specified by #, ## and ###) toc_float: # Allows the TOC to float on ...

1811 sym

Coefficient Visualization

05.02.2025

1 Required libraries library(ggplot2) library(gt) library(afcommon) 2 Data Preparation We’ll use the mtcars dataset to demonstrate the coefficient visualization functions. # Prepare data data(mtcars) mtcars$am <- as.factor(mtcars$am) # Create multiple models predicting mpg m1 <- lm(mpg ~ wt, data = mtcars) m2 <- lm(mpg ~ wt + am, data =...

797 sym 1 img 1 tbl

Descriptive Statistics

05.02.2025

1 Required libraries and source files library(tidyverse) library(explore) library(gt) library(viridis) library(afcommon) 2 Creating Sample Dataset We’ll create a dataset with the following variables: - salary: normally distributed numeric variable - sales: right-skewed numeric variable - gender: binary variable - student_status: binary v...

1210 sym 9 img 4 tbl

Interactive (Plotly) Analysis

05.02.2025

Required Libraries library(dplyr) library(plotly) library(htmlwidgets) library(htmltools) library(DT) Process the mtcars dataset mtcars_processed <- mtcars %>% mutate( car_name = rownames(.), # Convert binary variables to factors vs = factor(vs, levels = c(0, 1), labels = c("V-shape", "Straight")), am = factor(am, levels...

533 sym

Descriptive Statistics

05.02.2025

1 Required libraries and source files library(tidyverse) library(explore) library(gt) library(viridis) source("../Common/af_descriptive.R") 2 Creating Sample Dataset We’ll create a dataset with the following variables: - salary: normally distributed numeric variable - sales: right-skewed numeric variable - gender: binary variable - stud...

1210 sym 9 img 4 tbl

RMarkdown Header

05.02.2025

--- title: 'RMarkdown Header' author: 'Amir Freund' date: '`r Sys.Date()`' output: html_document: code_folding: hide # show / hide toc: true # table of content true toc_depth: 3 # upto three depths of headings (specified by #, ## and ###) toc_float: # Allows the TOC to float on the page. collapsed: false # Ensures...

1811 sym

Multilevel Regression Analysis

04.02.2025

1 Required libraries and source files library(ggplot2) library(dplyr) library(gt) library(lme4) library(performance) library(sjPlot) 2 Introduction This document demonstrates multilevel regression analysis using a simulated dataset. We’ll create nested data representing students within schools, fit several multilevel models, calculate IC...

3637 sym 1 img 2 tbl

Moderation Analysis

04.02.2025

1 Required libraries and source files library(sjPlot) library(ggplot2) 2 Prepare the dataset data(mtcars) set.seed(123) df <- mtcars # Create binary variables df$manual <- as.factor(df$am) levels(df$manual) <- c("Automatic", "Manual") df$heavy <- as.factor(df$wt > median(df$wt)) levels(df$heavy) <- c("Light", "Heavy") # Create categ...

6020 sym 5 img 1 tbl

Mediate Analysis

04.02.2025

1 Required libraries and source files library(mediation) library(dplyr) library(ggplot2) library(gt) source("../Common/af_mediation.R") source("../Common/af_regression.R") 2 Creating Example Dataset We’ll create a simulated dataset to demonstrate the mediation analysis functions: set.seed(123) n <- 1000 # Create variables with known ...

1128 sym 2 img 1 tbl