Reputation: 329
I have a variable (v_1) calculated as the ratio of the mean for variable 2 (v_2) and variable 3 (v_3). How do I calculate a confidence interval for this ratio?
v_2<-c(1,5,6,3,4,9,7,3,2,5,6,7)
v_3<-c(7,11,22,5,4,3,8)
v_2_mean<-mean(v_2)
v_3_mean<-mean(v_3)
v_1<-v_2_mean/v_3_mean
Upvotes: 0
Views: 224
Reputation: 8936
This page on cross validated suggests that if you are willing to make the assumption of Gaussian distribution in both samples, the mratios
package contains the function ttestratio()
which will perform a t-test for the ratio. More importantly for you, it will also calculate a confidence interval:
v_2 <- c(1,5,6,3,4,9,7,3,2,5,6,7)
v_3 <- c(7,11,22,5,4,3,8)
mratios::ttestratio(v_2, v_3)$conf.int[1:2]
# [1] 0.3000213 1.6524510
Upvotes: 2