Next →

Output:


      

Plots:

Introduction to Statistical Analysis in R

R is widely used for statistical analysis. You can calculate summary statistics, perform hypothesis tests, and create models to analyze data.

Summary Statistics

# Sample data
scores <- c(85, 90, 78, 92, 88)

# Mean, median, and standard deviation
mean(scores)
median(scores)
sd(scores)
  • Mean: The arithmetic average of the values. In this case, it gives the average test score across all students.
  • Median: The middle value when the data is ordered. It shows the “typical” score and is less sensitive to outliers than the mean.
  • Standard Deviation (sd): A measure of how spread out the scores are around the mean. A small standard deviation means scores are close to the average, while a larger one means more variability.
  • Basic Hypothesis Testing

    # One-sample t-test
    t.test(scores, mu = 80)
    

    t.test(): This performs a one-sample t-test, which compares the average of your data (scores) against a hypothesized mean (in this case, 80).

    R makes it easy to explore data distributions, relationships, and test hypotheses for informed decision-making.