How to conduct power analysis for unbalanced one-way ANOVA in R? I am looking for a way to conduct power analysis for unbalanced one-way ANOVA in R. I found the pwd package; however, it only allows me to calculate power for balanced one-way ANOVA. 
I would appreciate if you could provide any R codes, or introduce a R package me to perform power analysis for unbalanced one-way ANOVA. 
 A: I would probably use simulation to calculate the power. It is fairly easy to set up for a one-way ANOVA. Here is a quick and dirty R simulation with an example that compares 3 groups. To add more groups, just add the corresponding sample sizes sampsi, group means mus and standard deviation sds (note that the standard deviations are assumed to be equal in a traditional ANOVA). I assumed an $\alpha = 0.05$ in the example below.
# Number of simulations
n_sim <- 10000

# Sample size of each group
sampsi <- c(20, 50, 70)

# Mean of each group
mus <- c(10, 11, 12)

# Standard deviation of each group (assumed to be equal!)
sds <- c(5, 5, 5)

p_vals <- NULL

# Set seed for reproducibility
set.seed(142857)

for(i in 1:n_sim) {

  dat_tmp <- data.frame(
    y = rnorm(sum(sampsi), mean = rep(mus, times = sampsi), sd = rep(sds, times = sampsi))
    , group = factor(rep(seq_along(mus), times = sampsi))
  )
  
  mod <- anova(lm(y~group, data = dat_tmp))
  
  p_vals[i] <-  mod$`Pr(>F)`[1]
  
  rm(dat_tmp)
  
}

# Simulated power

cat("Simulated power is:", mean(p_vals <= 0.05)*100, "%")

Simulated power is: 30.22 %

