我需要从包BSDA中的 SIGN.test 函数中提取 p 值:
> library(BSDA)
> x <- c(7.8, 6.6, 6.5, 7.4, 7.3, 7., 6.4, 7.1, 6.7, 7.6, 6.8)
> t1=SIGN.test(x,md=6.5)
One-sample Sign-Test
data: x
s = 9, p-value = 0.02148
alternative hypothesis: true median is not equal to 6.5
95 percent confidence interval:
6.571273 7.457455
sample estimates:
median of x
7
但我收到以下错误:
> t1$p.value
Error in t1$p.value : $ operator is invalid for atomic vectors
我也试过str(t1)
了也没用。
> str(t1)
num [1:3, 1:3] 0.935 0.95 0.988 6.6 6.571 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:3] "Lower Achieved CI" "Interpolated CI" "Upper Achieved CI"
..$ : chr [1:3] "Conf.Level" "L.E.pt" "U.E.pt"