2014-06-12 8 views
0

두 개의 샘플이 있는데, 평균 (sd)과 크기가 있습니다.단일 값이없는 가중 평균 (sd)

i.e. 
6.27 +/- 5.9 (size 34) 
5.91 +/- 4.9 (size 6) 
나는 두 개의 샘플을 연결하고 평균과 SD가 어떻게

?

TY를 미리 입력하십시오.

+4

; 이것은 통계 질문이며 아마도 http://stats.stackexchange.com/에 속할 것입니다. – MrFlick

답변

1

여기에 하나 개의 방법이 정말 특정 R 프로그래밍 질문하지

mean_1 <- 6.27 
sd_1 <- 5.9 

mean_2 <- 5.91 
sd_2 <- 4.9 

n_1 <- 34 
n_2 <- 6 

# the combined mean 
mean_combined <- weighted.mean(c(mean_1, mean_2), c(n_1, n_2)) 
# [1] 6.216 

# the combined standard deviation (if the samples are not correlated) 
sd_combined <- sqrt(sd_1^2 + sd_2^2) 
# [1] 7.66942 

# the pooled standard deviation 
# (under the assumption that both samples are from the same population) 
sd_pooled <- sqrt((n_1 * sd_1^2 + n_2 * sd_2^2 + 
        n_1 * (mean_1 - mean_combined) + 
        n_2 * (mean_2 - mean_combined))/(n_1 + n_2)) 
# [1] 5.761076