Skip to contents

Troubleshooting Guide and FAQ

This comprehensive guide addresses common issues, error messages, and frequently asked questions when using jjstatsplot in both jamovi and R.

Installation Issues

Q: jjstatsplot doesn’t appear in jamovi’s module list

Solutions: 1. Check jamovi version: Requires jamovi ≥ 1.2.19 Help → About jamovi (check version number)

  1. Refresh module library:
    • Close jamovi completely
    • Restart jamovi
    • Try searching again in jamovi library
  2. Manual installation:
    • Download .jmo file from GitHub releases
    • jamovi → Modules → Install from file
  3. Internet connection: Ensure stable internet for library access

Q: “Module failed to install” error

Solutions: 1. Clear module cache: - Close jamovi - Delete jamovi modules folder (varies by OS) - Restart jamovi and reinstall

  1. Permission issues: Run jamovi as administrator (Windows) or check write permissions

  2. Dependency conflicts: Uninstall conflicting modules temporarily

Q: R installation fails with dependency errors

# Common dependency installation issues:

# Issue: Package compilation fails
# Solution: Install binary packages
install.packages("jjstatsplot", type = "binary")

# Issue: ggstatsplot not found
# Solution: Install dependencies first
install.packages(c("ggstatsplot", "jmvcore", "R6"))
devtools::install_github("sbalci/jjstatsplot")

# Issue: devtools not available
# Solution: Install devtools first
install.packages("devtools")

Q: “No data to plot” error

Common Causes & Solutions:

  1. Missing variable selection:

    • jamovi: Ensure variables are dragged to appropriate boxes
    • R: Check variable names are correct and exist in data
  2. All missing values:

    # Check for missing data
    summary(your_data)
    
    # Remove rows with missing values for specific variables
    clean_data <- your_data[complete.cases(your_data[c("var1", "var2")]), ]
  3. Incorrect variable types:

    # Check variable types
    str(your_data)
    
    # Convert variable types if needed
    your_data$categorical_var <- factor(your_data$categorical_var)
    your_data$numeric_var <- as.numeric(your_data$numeric_var)

Q: “Insufficient data for analysis” message

Solutions: 1. Check sample sizes: - Minimum 10 observations for most analyses - At least 5 observations per group for group comparisons - Correlation analyses need at least 10 complete pairs

  1. Group-specific issues:

    # Check group sizes
    table(your_data$grouping_variable)
    
    # Remove small groups if necessary
    group_counts <- table(your_data$grouping_variable)
    large_groups <- names(group_counts[group_counts >= 5])
    filtered_data <- your_data[your_data$grouping_variable %in% large_groups, ]

Q: Variables show as “character” instead of “factor”

Solution:

# In R: Convert character to factor
your_data$category <- factor(your_data$category)

# In jamovi: 
# 1. Double-click variable name in data view
# 2. Change "Data Type" from "Text" to "Nominal" or "Ordinal"
# 3. Set appropriate factor levels if needed

Statistical Test Issues

Q: “Statistical test failed” or “Assumptions violated” warnings

Common Issues & Solutions:

  1. Normality violations:

    # Check normality
    shapiro.test(your_data$variable)
    
    # Solutions:
    # 1. Use non-parametric alternatives (usually automatic in jjstatsplot)
    # 2. Transform data
    log_transformed <- log(your_data$positive_variable)
    sqrt_transformed <- sqrt(your_data$variable)
    
    # 3. Use robust statistical methods (available in options)
  2. Homogeneity of variance violations:

    # Check variance homogeneity
    bartlett.test(variable ~ group, data = your_data)
    
    # Solutions:
    # 1. Use Welch's t-test (often default)
    # 2. Use non-parametric tests
    # 3. Transform data to stabilize variance
  3. Small sample sizes for specific tests:

    • Fisher’s exact test for small contingency tables
    • Bootstrap methods for small samples
    • Non-parametric alternatives

Q: Correlation analysis produces NaN or infinite values

Solutions:

# Check for issues
summary(your_data[, numeric_variables])

# Remove constant variables
non_constant <- sapply(your_data[numeric_variables], function(x) length(unique(x)) > 1)
valid_variables <- numeric_variables[non_constant]

# Check for extreme outliers
outlier_check <- function(x) {
  Q1 <- quantile(x, 0.25, na.rm = TRUE)
  Q3 <- quantile(x, 0.75, na.rm = TRUE)
  IQR <- Q3 - Q1
  extreme_outliers <- x < (Q1 - 3 * IQR) | x > (Q3 + 3 * IQR)
  return(sum(extreme_outliers, na.rm = TRUE))
}

sapply(your_data[valid_variables], outlier_check)

Plot Display Issues

Q: Plots appear blank or don’t display

Solutions:

  1. jamovi-specific:

    • Refresh analysis (click away and back)
    • Resize plot area
    • Check if plot is in “plot2” section for grouped analyses
  2. R-specific:

    # Check if plot object exists
    result <- jjhistostats(data = mtcars, dep = "mpg", grvar = NULL)
    
    # For single plots
    if (exists("result") && !is.null(result$plot)) {
      print(result$plot)
    }
    
    # For grouped plots
    if (exists("result") && !is.null(result$plot2)) {
      print(result$plot2)
    }
  3. Graphics device issues:

    # Reset graphics device
    dev.off()
    
    # For RStudio users
    # Go to Plots pane → Export → Copy to Clipboard

Q: Plot text is too small or overlapping

Solutions:

  1. In jamovi:

    • Increase plot size in results panel
    • Export plot at higher resolution
  2. In R:

    # Adjust plot size
    result <- jjhistostats(data = mtcars, dep = "mpg", grvar = NULL)
    
    # Modify plot theme
    improved_plot <- result$plot + 
      ggplot2::theme(
        text = ggplot2::element_text(size = 12),
        axis.text = ggplot2::element_text(size = 10),
        plot.title = ggplot2::element_text(size = 14)
      )
    
    print(improved_plot)

Q: Statistical annotations are cut off or overlapping

Solutions:

# Adjust plot margins
library(ggplot2)

result <- jjscatterstats(data = mtcars, dep = "mpg", group = "hp")

# Increase plot margins
fixed_plot <- result$plot + 
  theme(
    plot.margin = margin(t = 20, r = 20, b = 20, l = 20, unit = "pt")
  )

# For very long annotations, consider:
# 1. Shorter variable names
# 2. Custom subtitle/caption
# 3. Separate statistical table

Performance Issues

Q: Analysis takes very long time or jamovi freezes

Solutions:

  1. Large datasets:

    # Sample large datasets
    if (nrow(your_data) > 10000) {
      sampled_data <- your_data[sample(nrow(your_data), 5000), ]
    }
    
    # Or focus on specific subsets
    subset_data <- your_data[your_data$important_condition == "focus_group", ]
  2. Complex grouping:

    • Reduce number of groups
    • Combine similar categories
    • Use simpler analyses for exploration
  3. Memory issues:

    # Check memory usage
    object.size(your_data)
    
    # Clean workspace
    rm(list = ls()[!ls() %in% c("essential_objects")])
    gc()  # Garbage collection

Common Error Messages

“Error in eval(expr, envir, enclos): object ‘variable_name’ not found”

Cause: Variable name mismatch or typo

Solutions:

# Check available variables
names(your_data)

# Check for exact spelling
"variable_name" %in% names(your_data)

# Common issues:
# - Case sensitivity: "Variable" vs "variable"
# - Spaces: "Variable Name" vs "Variable_Name"
# - Special characters: accents, symbols

“Error: Aesthetics must be either length 1 or the same as the data”

Cause: Data length mismatch, often from grouping issues

Solutions:

# Check data consistency
table(your_data$grouping_variable, useNA = "always")

# Remove missing values in grouping variable
clean_data <- your_data[!is.na(your_data$grouping_variable), ]

# Ensure balanced groups if needed
balanced_data <- your_data %>%
  group_by(grouping_variable) %>%
  filter(n() >= 5) %>%
  ungroup()

“Warning: Computation failed in stat_*(): Non-numeric variable”

Cause: Numeric variable treated as categorical or vice versa

Solutions:

# Check variable type
class(your_data$problematic_variable)

# Convert to appropriate type
your_data$numeric_var <- as.numeric(as.character(your_data$numeric_var))
your_data$factor_var <- factor(your_data$factor_var)

# Handle factor levels that look numeric
your_data$category <- factor(your_data$category, 
                            levels = c("Low", "Medium", "High"))

Best Practices to Avoid Issues

Data Preparation

# 1. Always check data structure first
str(your_data)
summary(your_data)

# 2. Handle missing values explicitly
your_data_clean <- your_data %>%
  filter(!is.na(dependent_variable) & !is.na(grouping_variable))

# 3. Set appropriate variable types
your_data$categorical <- factor(your_data$categorical)
your_data$ordered_cat <- ordered(your_data$ordered_cat, 
                                levels = c("Low", "Med", "High"))

# 4. Check for outliers
boxplot(your_data$continuous_variable)

# 5. Verify sufficient sample sizes
table(your_data$grouping_variable)

Analysis Workflow

  1. Start simple: Begin with basic plots before adding grouping
  2. Check assumptions: Use diagnostic plots and tests
  3. Validate results: Compare with alternative methods
  4. Document choices: Keep track of data transformations and exclusions

Reporting Guidelines

  1. Report sample sizes: Always include n for each group
  2. Describe missing data: How were missing values handled?
  3. State assumptions: Were statistical assumptions met?
  4. Include effect sizes: Don’t rely only on p-values
  5. Show uncertainty: Include confidence intervals when available

Getting Additional Help

jamovi Community Resources

ggstatsplot Resources

jjstatsplot Specific

When Reporting Issues

Include the following information: 1. jamovi version (Help → About) 2. jjstatsplot version 3. Operating system 4. Sample data (if possible) 5. Exact error message 6. Steps to reproduce 7. Screenshots (for jamovi issues)

Creating Minimal Reproducible Examples

# For R issues, create minimal example:
library(ClinicoPath)

# Use built-in data
data(mtcars)

# Minimal code that reproduces the problem
result <- jjhistostats(data = mtcars, dep = "mpg", grvar = NULL)
result$plot  # If this fails, report it

This troubleshooting guide covers the most common issues encountered with jjstatsplot. For complex statistical questions, consider consulting with a statistician or posting detailed questions on statistical forums like Cross Validated (stats.stackexchange.com).