我在R中使用poweRlaw
包,并尝试计算p值以确定是否可以/不能排除幂律适合我所拥有的分布。使用bootstrap_p
运行引导程序,我得到下图,其中包含我的参数和p值的估计值,但是如您所见,我没有得到p值的估计值,它固定为零。
有人对发生的事情有任何建议吗?下面是可复制的示例。
library(tidyverse)
library(poweRlaw)
df <- structure(list(var = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 119, 120, 121,
122, 123, 125, 126, 127, 128, 129, 131, 133, 134, 135, 136, 137,
140, 141, 143, 147, 148, 149, 150, 151, 153, 156, 157, 158, 159,
160, 161, 162, 163, 165, 168, 173, 174, 175, 179, 180, 183, 185,
188, 189, 191, 194, 195, 199, 200, 204, 207, 209, 212, 221, 225,
226, 232, 233, 248, 249, 256, 260, 262, 264, 270, 292, 297, 305,
313, 321, 334, 340, 349, 350, 356, 387, 395, 413, 416, 422, 435,
477, 527, 554, 635, 792), freq = c(10687, 7414, 6443, 6078, 5665,
5314, 4919, 4511, 4212, 3669, 3370, 3121, 2884, 2508, 2274, 2085,
1849, 1673, 1557, 1359, 1226, 1130, 1023, 905, 755, 697, 668,
570, 506, 465, 414, 387, 330, 303, 253, 254, 234, 210, 170, 149,
129, 114, 130, 117, 94, 91, 70, 71, 54, 59, 54, 60, 37, 35, 35,
39, 32, 32, 14, 21, 19, 24, 16, 20, 14, 12, 15, 16, 10, 14, 14,
10, 6, 8, 10, 7, 8, 5, 10, 4, 5, 5, 2, 8, 1, 3, 9, 6, 7, 3, 2,
4, 4, 6, 1, 1, 4, 4, 4, 2, 2, 4, 1, 3, 5, 5, 4, 2, 2, 2, 2, 2,
2, 1, 2, 4, 4, 1, 1, 3, 1, 3, 4, 2, 2, 3, 1, 1, 2, 3, 4, 1, 2,
3, 1, 2, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2,
2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-202L))
df
df2 <- df %>%
tidyr::uncount(freq) %>%
dplyr::arrange(var) %>%
pull(var)
df2
m_power = displ$new(df2)
est_power = estimate_xmin(m_power)
m_power$setXmin(est_power)
bs_p = bootstrap_p(m_power, no_of_sims = 1000, threads = 4, seed = 1
#,xmins = seq(4, 20, 4)
)
plot(bs_p) #zero pvalue