OLSengine: Assisted Simplicity Tutorial

msoto-perez

r Sys.Date()

1. Introduction

The philosophy of Assisted Simplicity aims to bridge the gap between complex computation and methodological rigor.

2. Case Study: Heteroskedasticity

In social sciences, variance often increases with the scale of the predictor. Let’s see how OLSengine handles this.

library(OLSengine)

# 1. Simulate data with non-constant variance
set.seed(123)
n <- 200
x <- rnorm(n, 50, 10)
y <- 10 + 0.5 * x + rnorm(n, 0, x * 0.2) # Heteroskedasticity
df <- data.frame(y, x)

# 2. Run the engine
model <- paper_engine(y ~ x, data = df, model = "ols")

Aduana Feedback

The “Aduana” messages provide critical guidance:

Correcting the Model

Following the advice, we apply robust standard errors:

model_robust <- paper_engine(y ~ x, data = df, model = "ols", robust = TRUE)
model_robust$tables$Table2_OLS_Estimation
##               Predictor    B   SE    t      p CI_95_Low CI_95_High   f2
## (Intercept) (Intercept) 9.70 4.28 2.27   0.02      1.26      18.14   NA
## x                     x 0.51 0.09 5.72 < .001      0.34       0.69 0.23

3. Case Study 2: Experimental Logic (ANOVA/T-Test)

In experimental research, we often compare groups. OLSengine automatically checks for normality and variance homogeneity to decide if a Parametric or Non-Parametric approach is needed.

# Simulating 3 groups with non-normal distribution
set.seed(789)
group_data <- data.frame(
  score = c(rgamma(30, 2, 0.5), rgamma(30, 5, 0.5), rgamma(30, 3, 0.5)),
  group = rep(c("Control", "Treatment A", "Treatment B"), each = 30)
)

# Run ANOVA engine with "auto" non-parametric detection
model_anova <- paper_engine(score ~ group, data = group_data, model = "anova", non_parametric = "auto")

# View the result (it will automatically use Kruskal-Wallis if normality fails)
model_anova$tables$Table1_ANOVA_Results
## NULL

4. Case Study 3: Binary Outcomes (Logistic Regression)

When the outcome is binary (e.g., Success/Failure), the engine calculates Odds Ratios and Classification Accuracy.

# Simulating binary data
set.seed(101)
n_logit <- 100
age <- rnorm(n_logit, 40, 10)
passed <- rbinom(n_logit, 1, plogis(-5 + 0.12 * age))
logit_df <- data.frame(passed, age)

# Run Logit engine
model_logit <- paper_engine(passed ~ age, data = logit_df, model = "logit")

# View Odds Ratios and Accuracy
model_logit$tables$Table3_Logit_Estimation
## NULL

5. Visualizing for Publication

Finally, OLSengine provides grayscale, publication-ready plots without the need for extra libraries.

# Forest plot for our robust OLS model
plot_engine(model_robust)

Conclusion

OLSengine simplifies the transition from raw data to paper-ready results, ensuring that every step is backed by a rigorous methodological audit.