Background: I have my dataset as a csv file called D
( please load it to your R ):
D = read.csv("https://docs.google.com/uc?id=0B5V8AyEFBTmXWU40TUZGTURQWlU&export=download")
I use the following function to obtain 2 quantities from my data ( please source to your R ):
source("https://docs.google.com/uc?id=0B5V8AyEFBTmXWTk0LWhaMkY2b3M&export=download")
The 2 quantities are obtained as follows:
b = BF.d.pvalue(t = D$t.value, n1 = D$n1, n2 = D$n2)
BF = b[1, ] ; p.value = b[2, ]
Subsetting Details: I have subsetted p.value
larger than .05
and their corresponding BF
s:
pvalue.05_1 = p.value[p.value > .05] ;
BF.pvalue.05_1 = BF[p.value > .05]`
I have further subsetted BF.pvalue.05_1
that are between 1/10
and 1/3
:
BF.pvalue.05_1_.1_.33 = BF.pvalue.05_1[BF.pvalue.05_1 > 1/10 & BF.pvalue.05_1 <= 1/3]
Question: Now I'm wondering how I can find the corresponding p.value
for BF.pvalue.05_1_.1_.33
above?
The preferred way to do this is to combine your data to a dataframe
and then using the subset
command for filtering.
myDf = data.frame(p = p.value, BF = BF)
head(myDf)
# p BF
# 1 2.274873e-06 6.241835e+03
# 2 3.811612e-02 1.736017e+00
# 3 0.000000e+00 2.592434e+147
# 4 0.000000e+00 1.982820e+130
# 5 0.000000e+00 1.315152e+29
# 6 9.992007e-15 4.442134e+11
Now, whenever you subset your data rowwise , you will have access to both the p
value and the BF
value.
firstSubset = subset(myDf, p > .05)
dim(firstSubset)
# [1] 175 2
secondSubset = subset(firstSubset, BF > .1 & BF < 1/3)
dim(secondSubset)
# [1] 76 2
head(secondSubset)
# p BF
# 28 0.8518770 0.3131790
# 34 0.9358011 0.2910234
# 35 0.9302671 0.2911639
# 52 0.6825720 0.3101911
# 88 0.7201547 0.2770751
# 96 0.6472360 0.2868055
Alternatively, you can use both conditions simultaniousely
secondSubset = subset(myDf, (BF > .1) & (BF < 1/3) & (p > .05))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.