csgillespie / poweRlaw

This package implements both the discrete and continuous maximum likelihood estimators for fitting the power-law distribution to data. Additionally, a goodness-of-fit based approach is used to estimate the lower cutoff for the scaling region.
109 stars 24 forks source link

CheckForRemoteErrors(val) error with bootstrap function poweRlaw #74

Closed MarinkavP closed 6 years ago

MarinkavP commented 6 years ago

I am fitting some poweRlaw functions on some distributions, and I get a weird error when I use the bootstrap and bootstrap_p function. Below my code:

test_power <- conpl$new(data_test$Area)
test_power_est <- estimate_xmin(test_power)
test_power$setXmin(test_power_est)

bs <- bootstrap(test_power, no_of_sims=1000, threads=1)
Expected total run time for 1000 sims, using 1 threads is 258 seconds.
Error in checkForRemoteErrors(val) : 
  one node produced an error: unable to find required package 'poweRlaw'

bootstrap_p(test_power)
Expected total run time for 100 sims, using 1 threads is 26.4 seconds.
Error in checkForRemoteErrors(val) : 
  one node produced an error: could not find function "get_n"

This is weird because the poweRlaw packages is working fine and I can use the get_n function. The second error has been treated before as a bug, but has been closed for more than two years. I am using the latest version of the poweRlaw package: poweRlaw_0.70.1 and the latest R version 3.4.3 (2017-11-30). I do use rather small sample sizes (eg. 120 - 160), but the error does not seem to indicate that as a problem. I also used different sample sets of the main dataset and they all give this error. All the other functions from the poweRlaw package work fine (such as compare_distributions).

My data is the area of vegetation patches on the beach. Here are two datasets, which both cause this error:

c(0.633115, 1.5646, 0.211346, 0.128847, 0.922767, 8.64826, 2.54032, 1.28207, 0.409679, 0.211112, 3.10141, 0.806281, 0.634353, 2.98971, 0.168017, 0.128847, 0.239889, 1.87959, 6.75788, 0.385844, 0.146682, 0.148176, 0.38999, 15.0759, 1.34047, 0.295414, 1.68292, 0.688271, 3.10966, 0.284713, 0.620304, 0.756878, 1.55934, 0.474809, 0.802139, 0.201441, 0.617684, 3.53543, 0.128847, 1.82952, 0.807238, 2.81658, 1.14838, 3.69533, 0.856322, 0.603872, 1.01973, 0.137137, 0.635368, 0.178266, 0.137137, 0.525416, 1.35673, 0.262416, 0.279793, 1.68744, 0.334162, 0.60796, 0.375, 0.148176, 0.193005, 0.436486, 4.76834, 0.226051, 3.67997, 0.144876, 0.336607, 0.168017, 3.53236, 0.220086, 2.20703, 4.76042, 0.146682, 0.128847, 4.28577, 0.768191, 0.144876, 0.416829, 0.477823, 7.03946, 1.6067, 0.128847, 0.729935, 0.572193, 0.533219, 0.549854, 1.93158, 1.51688, 1.05369, 2.81915, 0.771659, 2.10096, 0.284392, 0.200017, 0.752047, 7.84534, 0.29984, 0.144876, 1.03854, 3.31909, 1.03762, 0.882633, 5.29801, 0.125265, 0.787644, 0.248799, 0.302221, 1.9035, 0.911636, 0.284392, 0.847253, 0.200017, 0.226051, 0.375, 2.13757, 0.564554, 0.793377, 4.64444, 0.520046, 1.15669, 0.862288, 0.766457, 0.332197)

c(0.81148, 4.94145, 1.65109, 0.145046, 0.698015, 13.6108, 0.657887, 0.580326, 0.795397, 0.12547, 0.33651, 0.200287, 0.575441, 0.246833, 7.70235, 0.168478, 1.52722, 20.4925, 0.443099, 0.383635, 3.04744, 0.549398, 0.176755, 0.275311, 0.137068, 0.328013, 2.64175, 33.3513, 0.210833, 0.145046, 0.624803, 0.280675, 6.44532, 0.476563, 30.4768, 9.1232, 2.95298, 0.449662, 2.33553, 0.755744, 2.33415, 2.75923, 1.01698, 0.28755, 9.92333, 0.34747, 0.238213, 0.129041, 0.137068, 0.137068, 0.137068, 2.65381, 0.155924, 0.234633, 0.327038, 0.137068, 0.338116, 0.468437, 0.12547, 5.76389, 0.953622, 0.147998, 0.389751, 9.08274, 0.346747, 0.381513, 0.332869, 4.95897, 0.12547, 0.260287, 0.260287, 3.75048, 0.568788, 2.85368, 2.7986, 0.458754, 0.644756, 0.883517, 53.2213, 0.14689, 0.229703, 0.168478, 2.62344, 0.487742, 0.914296, 0.521909, 0.12547, 1.11696, 0.176755, 0.442347, 32.31, 1.08528, 1.49872, 1.19342, 3.15826, 0.238213, 2.3087, 0.225219, 0.84795, 1.67818, 4.29463, 1.43879, 0.128854, 0.137129, 2.54925, 0.669622, 0.701911, 0.137068, 0.34747, 56.672, 0.478042, 2.4271, 0.147998, 2.7079, 0.826286, 0.28419, 0.137068, 0.147998, 62.0619, 0.362874, 1.30526, 0.12547, 1.60464, 1.29973, 2.70485, 5.37164, 16.9133, 0.339739, 3.08722, 0.464398, 0.305968, 0.701187, 13.1685, 1.19216, 1.84866, 10.8294, 0.145046, 0.275311, 0.14689, 0.275311, 5.02126, 0.268465, 4.16511, 9.26495, 0.607502, 4.21125)

csgillespie commented 6 years ago

Odd. I can't reproduce the error with your data.

So to double check the following produces an error:

install.packages("poweRlaw")
library(poweRlaw)
x = c(0.633115, 1.5646, 0.211346, 0.128847, 0.922767, 8.64826, 2.54032,
      1.28207, 0.409679, 0.211112, 3.10141, 0.806281, 0.634353, 2.98971,
      0.168017, 0.128847, 0.239889, 1.87959, 6.75788, 0.385844, 0.146682,
      0.148176, 0.38999, 15.0759, 1.34047, 0.295414, 1.68292, 0.688271,
      3.10966, 0.284713, 0.620304, 0.756878, 1.55934, 0.474809, 0.802139,
      0.201441, 0.617684, 3.53543, 0.128847, 1.82952, 0.807238, 2.81658,
      1.14838, 3.69533, 0.856322, 0.603872, 1.01973, 0.137137, 0.635368,
      0.178266, 0.137137, 0.525416, 1.35673, 0.262416, 0.279793, 1.68744,
      0.334162, 0.60796, 0.375, 0.148176, 0.193005, 0.436486, 4.76834,
      0.226051, 3.67997, 0.144876, 0.336607, 0.168017, 3.53236, 0.220086,
      2.20703, 4.76042, 0.146682, 0.128847, 4.28577, 0.768191, 0.144876,
      0.416829, 0.477823, 7.03946, 1.6067, 0.128847, 0.729935, 0.572193,
      0.533219, 0.549854, 1.93158, 1.51688, 1.05369, 2.81915, 0.771659,
      2.10096, 0.284392, 0.200017, 0.752047, 7.84534, 0.29984, 0.144876,
      1.03854, 3.31909, 1.03762, 0.882633, 5.29801, 0.125265, 0.787644,
      0.248799, 0.302221, 1.9035, 0.911636, 0.284392, 0.847253, 0.200017,
      0.226051, 0.375, 2.13757, 0.564554, 0.793377, 4.64444, 0.520046,
      1.15669, 0.862288, 0.766457, 0.332197)
test_power <- conpl$new(x)
test_power_est <- estimate_xmin(test_power)
test_power$setXmin(test_power_est)
bs <- bootstrap(test_power, no_of_sims=2, threads=1)
MarinkavP commented 6 years ago

Oke, so I checked and at home on another computer, I don't have any problem. It is clearly a computer related thing, I encountered the problem at my work computer, which is more restricted (I do have administrator rights).

I also have this problem on my work computer: https://stackoverflow.com/questions/5700505/windows-7-update-packages-problem-unable-to-move-temporary-installation So there is definitely some restrictions at my computer, that cause some problems in R.

csgillespie commented 6 years ago

This seems to be a problem with your set-up and not the package.