Replace “Your Name” with your actual name.

Instructions

Please complete this exam on your own. Include your R code, interpretations, and answers within this document.

Part 1: Types of Data and Measurement Errors

Question 1: Data Types in Psychological Research

  1. Differences Between Data Types:
    • Nominal: Categorical data without an inherent order. Example: Types of psychological disorders (e.g., depression, anxiety, schizophrenia).
    • Ordinal: Ordered categories, but intervals are not equal. Example: Satisfaction ratings (e.g., strongly disagree to strongly agree).
    • Interval: Equal intervals between values, but no true zero. Example: IQ scores.
    • Ratio: Has a true zero, allowing meaningful ratios. Example: Reaction time (measured in milliseconds).
  2. Identifying Levels of Measurement:
    • Depression inventory (0-63): Interval (Assumes equal intervals between scores)
    • Response time (ms): Ratio (Has a true zero, where 0 means no response time)
    • Likert scale (1-7): Ordinal (Ordered categories with subjective spacing)
    • Diagnostic categories: Nominal (Categories with no inherent order)
    • Age (years): Ratio (Has a meaningful zero point)

Question 2: Measurement Error

  1. Random vs. Systematic Error:
    • Random Error: Unpredictable variations in measurement (e.g., participant fatigue affecting memory recall on different trials).
    • Systematic Error: Consistent bias in measurement (e.g., a faulty timer always overestimating reaction time by 10ms).
  2. Impact on Validity & Minimization Strategies:
    • Measurement error can introduce bias and reduce the reliability of stress-academic performance studies.
    • Strategies: Increase sample size, improve measurement tools, and conduct reliability checks.

Part 2: Descriptive Statistics and Basic Probability

Question 3: Descriptive Analysis

set.seed(123)
n <- 50
data <- data.frame(
  participant_id = 1:n,
  reaction_time = rnorm(n, mean = 300, sd = 50),
  accuracy = rnorm(n, mean = 85, sd = 10),
  gender = sample(c("Male", "Female"), n, replace = TRUE),
  condition = sample(c("Control", "Experimental"), n, replace = TRUE),
  anxiety_pre = rnorm(n, mean = 25, sd = 8),
  anxiety_post = NA
)
data$anxiety_post <- ifelse(
  data$condition == "Experimental",
  data$anxiety_pre - rnorm(n, mean = 8, sd = 3),
  data$anxiety_pre - rnorm(n, mean = 3, sd = 2)
)
data$anxiety_post <- pmax(data$anxiety_post, 0)
data$reaction_time[sample(1:n, 3)] <- NA
data$accuracy[sample(1:n, 2)] <- NA
head(data)
##   participant_id reaction_time  accuracy gender    condition anxiety_pre
## 1              1      271.9762  87.53319 Female      Control    31.30191
## 2              2      288.4911  84.71453 Female Experimental    31.15234
## 3              3      377.9354  84.57130 Female Experimental    27.65762
## 4              4      303.5254  98.68602   Male      Control    16.93299
## 5              5      306.4644  82.74229 Female      Control    24.04438
## 6              6      385.7532 100.16471 Female      Control    22.75684
##   anxiety_post
## 1     29.05312
## 2     19.21510
## 3     20.45306
## 4     13.75199
## 5     17.84736
## 6     19.93397

Descriptive Statistics Calculation

data %>% 
  group_by(condition) %>% 
  summarise(
    Mean_Reaction = mean(reaction_time, na.rm = TRUE),
    SD_Reaction = sd(reaction_time, na.rm = TRUE),
    Mean_Accuracy = mean(accuracy, na.rm = TRUE),
    SD_Accuracy = sd(accuracy, na.rm = TRUE)
  )
## # A tibble: 2 × 5
##   condition    Mean_Reaction SD_Reaction Mean_Accuracy SD_Accuracy
##   <chr>                <dbl>       <dbl>         <dbl>       <dbl>
## 1 Control               301.        48.5          85.5        9.86
## 2 Experimental          296.        38.4          88.1        8.20

Anxiety Change Calculation

data <- data %>% mutate(anxiety_change = anxiety_pre - anxiety_post)
data %>% group_by(condition) %>% summarise(Mean_Anxiety_Change = mean(anxiety_change, na.rm = TRUE))
## # A tibble: 2 × 2
##   condition    Mean_Anxiety_Change
##   <chr>                      <dbl>
## 1 Control                     3.79
## 2 Experimental                8.64

Question 4: Probability Calculations

# Probability of reaction time > 450ms
p1 <- 1 - pnorm(450, mean = 350, sd = 75)

# Probability of reaction time between 300ms and 400ms
p2 <- pnorm(400, mean = 350, sd = 75) - pnorm(300, mean = 350, sd = 75)
p1; p2
## [1] 0.09121122
## [1] 0.4950149

Part 3: Data Cleaning and Manipulation

clean_data <- na.omit(data)
clean_data <- clean_data %>% mutate(performance_category = case_when(
  accuracy >= 90 ~ "High",
  accuracy >= 70 & accuracy < 90 ~ "Medium",
  accuracy < 70 ~ "Low"
))
filtered_data <- clean_data %>% filter(condition == "Experimental" & reaction_time < mean(reaction_time, na.rm = TRUE))

Part 4: Visualization and Correlation Analysis

par(mar = c(5, 5, 4, 2) + 0.1) # Increase margins
numeric_data <- clean_data %>% select(reaction_time, accuracy, anxiety_pre, anxiety_post, anxiety_change)
corPlot(numeric_data)


Part 5: Reflection and Application

Question 7: Reflection

  1. Research Question: I am interested in studying the impact of mindfulness meditation on test anxiety. I would collect pre- and post-test anxiety scores, reaction times, and performance metrics. I would use paired t-tests to compare pre- and post-anxiety scores and ANOVA to analyze differences between groups. Measurement errors such as participant stress levels and environmental distractions would need to be controlled.

  2. Learning R for Data Analysis:

    • Advantages: Greater flexibility, reproducibility, and efficiency in handling large datasets.
    • Challenges: Steeper learning curve compared to point-and-click software like SPSS.

Submission Instructions

Knit to HTML and submit the RPubs link.