This function takes multiple mean and sample variance estimates and combines them.
combinevar(xbar = NULL, s_squared = NULL, n = NULL)
vector of means
vector of sample variances
vector of number of observations
Vector containing the combined mean and sample variance.
If a Monte Carlo simulation is run over 1000 loops and then again over another 1000 loops, one may wish to update the mean and variance from the first 1000 loops with the second set of simulation results.
# NOT RUN {
xbar <- c(5,5)
s<-c(2,4)
n <- c(10,10)
combinevar(xbar,s,n)
# }
Run the code above in your browser using DataLab