Function that will generate iter samples of size n from a gamma distribution with shape parameter alpha and rate parameter beta
问题 The function needs to return the mean and standard deviation of each sample. This is what I have: sample_gamma <- function(alpha, beta, n, iter) { mean = alpha/beta var = alpha/(beta)^2 sd = sqrt(var) gamma = rgamma(n,shape = alpha, scale = 1/beta) sample_gamma = data.frame(mean = replicate(n = iter, expr = mean)) } I'm very lost for this. I also need to create a data frame for this function. Thank you for your time. Edit: sample_gamma <- function(alpha, beta, n, iter) { output <- rgamma(iter