grandMean <- function(meanX, nX){
return(sum(meanX*nX)/sum(nX))
}
grandSTD <- function(meanX, stdX, nX){
gmean <- grandMean(meanX, nX)
ssr <- sum((nX-1)*stdX*stdX) + sum(nX*meanX*meanX)
ssm <- 2*sum(nX*meanX)*gmean
ssg <- sum(nX)*gmean*gmean
return(sqrt((ssr-ssm+ssg)/(sum(nX)-1)))
}
沒有留言:
張貼留言