Home » OC Curve

Recent Posts

Recent Comments

No comments to show.

Archives

Categories

OC Curve

The Operating Characteristic (OC) curve shows how the power of a test changes with different effect sizes or sample sizes. This curve helps assess how likely you are to detect a true effect at different effect sizes.

  • X-axis: Effect size (or sample size).
  • Y-axis: Power of the test.

Plotting the OC Curve in R

# Function to calculate power for different sample sizes

sample_sizes <- seq(10, 100, by = 5) # Sample sizes from 10 to 100
power_values <- sapply(sample_sizes, function(n) pwr.t.test(d = effect_size, n = n, sig.level = alpha, type = “two.sample”)$power)

# Plot the OC curve

plot(sample_sizes, power_values, type = “l”, col = “blue”, lwd = 2, xlab = “Sample Size”, ylab = “Power”, main = “Operating Characteristic (OC) Curve”) abline(h = 0.80, col = “red”, lty = 2) # Reference line at 80% power

Interpretation of the OC Curve

  • The curve shows how power increases with increasing sample size.
  • The red horizontal line at 0.80 represents the commonly desired power level of 80%.
  • You can see that as the sample size increases, the power also increases. If the sample size is too small, power is low, meaning there is a higher chance of failing to detect a true effect.

Problem Using OC Curve in R

Let’s work through an example in the pharmaceutical industry where a new drug is being tested. Suppose we are testing the effectiveness of the new drug against a placebo. We expect the new drug to reduce blood pressure by at least 5 mmHg, with a standard deviation of 10 mmHg. We want to know the power of detecting this effect with a sample size of 30 patients in each group.

# Parameters for the example

effect_size <- 5 / 10  # Effect size (difference in means divided by standard deviation)
n <- 30 # Sample size per group

# Power analysis for detecting a reduction in blood pressure

power_calculation <- pwr.t.test(d = effect_size, n = n, sig.level = alpha, type = “two.sample”)

# Print the result

print(power_calculation

The result will show the power of detecting a 5 mmHg reduction in blood pressure with a sample size of 30 per group. If the power is less than 0.80, you may need to increase the sample size.

# OC Curve for effect size

effect_sizes <- seq(0.1, 1, by = 0.1) # Different effect sizes power_values <- sapply(effect_sizes, function(d) pwr.t.test(d = d, n = n, sig.level = alpha, type = “two.sample”)$power)

# Plot the OC curve

plot(effect_sizes, power_values, type = “l”, col = “blue”, lwd = 2, xlab = “Effect Size”, ylab = “Power”, main = “OC Curve for Effect Size”) abline(h = 0.80, col = “red”, lty = 2) # Reference line at 80% power