Skip to contents

Generate Diversity Profiles for Parametric Indices

Usage

diversity.profile(
  x,
  group,
  q = seq(0, 3, 0.1),
  ci.conf = 0.95,
  R = 1000,
  parameter = c("hill", "renyi", "tsallis"),
  ci.type = c("perc", "bca"),
  parallel = c("no", "multicore", "snow"),
  ncpus = getOption("boot.ncpus", 1L),
  cl = NULL
)

Arguments

x

A numeric or factor vector of observations.

group

A factor vector indicating the group of each observation. Must have the same length as x.

q

The order of the parametric index.

ci.conf

Confidence level of the bootstrap interval. Default is 0.95.

R

Integer specifying the number of permutations. Default is 1000.

parameter

The parametric index. Options include "hill", "renyi" and "tsallis". Default is "hill".

ci.type

A vector of character strings representing the type of intervals required. The options are c("perc", "bca").

parallel

The type of parallel operation to be used (if any). If missing, the default is taken from the option "boot.parallel" (and if that is not set, "no").

ncpus

integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs.

cl

An optional parallel or snow cluster for use if parallel = "snow". If not supplied, a cluster on the local machine is created for the duration of the boot call.

Value

A list of data frames with the following columns for each factor level in group.

q
observed
mean
lower
upper

Examples


library(EvaluateCore)
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
library(ggplot2)

pdata <- cassava_CC

qual <- c("CUAL", "LNGS", "PTLC", "DSTA", "LFRT", "LBTEF", "CBTR", "NMLB",
          "ANGB", "CUAL9M", "LVC9M", "TNPR9M", "PL9M", "STRP", "STRC",
          "PSTR")

# Convert qualitative data columns to factor
pdata[, qual] <- lapply(pdata[, qual], as.factor)

str(pdata)
#> 'data.frame':	168 obs. of  26 variables:
#>  $ CUAL  : Factor w/ 4 levels "Dark green","Green purple",..: 3 1 2 2 2 2 4 2 2 1 ...
#>  $ LNGS  : Factor w/ 3 levels "Long","Medium",..: 3 1 2 2 2 2 2 1 1 1 ...
#>  $ PTLC  : Factor w/ 5 levels "Dark green","Green purple",..: 3 4 4 4 4 5 4 2 2 5 ...
#>  $ DSTA  : Factor w/ 5 levels "Absent","Central part",..: 1 5 5 5 5 5 5 4 2 5 ...
#>  $ LFRT  : Factor w/ 4 levels "25-50% leaf retention",..: 1 1 1 1 3 2 2 2 2 2 ...
#>  $ LBTEF : Factor w/ 6 levels "0","1","2","3",..: 3 1 2 1 4 5 4 4 3 2 ...
#>  $ CBTR  : Factor w/ 3 levels "Cream","White",..: 2 2 2 2 1 2 1 1 1 1 ...
#>  $ NMLB  : Factor w/ 9 levels "0","1","2","3",..: 3 1 2 1 4 4 4 3 3 4 ...
#>  $ ANGB  : Factor w/ 4 levels "150-300","450-600",..: 1 4 1 4 2 2 2 1 2 2 ...
#>  $ CUAL9M: Factor w/ 5 levels "Dark green","Green",..: 1 1 3 5 3 3 5 5 5 4 ...
#>  $ LVC9M : Factor w/ 5 levels "Dark green","Green",..: 4 3 3 3 3 1 3 1 4 3 ...
#>  $ TNPR9M: Factor w/ 5 levels "1","2","3","4",..: 5 5 4 2 5 4 2 5 5 5 ...
#>  $ PL9M  : Factor w/ 2 levels "Long (25-30cm)",..: 2 2 1 1 1 1 1 1 2 2 ...
#>  $ STRP  : Factor w/ 4 levels "Absent","Intermediate",..: 2 3 1 1 1 1 4 1 1 4 ...
#>  $ STRC  : Factor w/ 2 levels "Absent","Present": 2 2 1 2 1 1 2 1 1 2 ...
#>  $ PSTR  : Factor w/ 2 levels "Irregular","Tending toward horizontal": 1 2 2 2 1 2 2 2 1 2 ...
#>  $ NMSR  : num  6 2 6 2 20 13 4 14 10 5 ...
#>  $ TTRN  : num  3 0.5 3 2 5 ...
#>  $ TFWSR : num  1.4 2.6 1.2 1.6 5 7 4.2 2.8 2.8 4 ...
#>  $ TTRW  : num  0.7 0.65 0.6 1.6 1.25 ...
#>  $ TFWSS : num  1 2.8 2.8 2.4 16 12 9 4.4 6.2 5 ...
#>  $ TTSW  : num  0.5 0.7 1.4 2.4 4 ...
#>  $ TTPW  : num  2.4 5.4 4 4 21 19 13.2 7.2 9 9 ...
#>  $ AVPW  : num  1.2 1.35 2 4 5.25 4.75 3.3 2.4 1.8 2.25 ...
#>  $ ARSR  : num  2 0 2 0 3 0 0 6 0 0 ...
#>  $ SRDM  : num  42 39.8 29.7 43 37.9 37 38.9 36.9 41 37.9 ...

important_q <- c(0, 1, 2)
important_labels <- c("0D", "1D", "2D")

# Hill profile - Percentile CIs ----

hill_profile1 <-
  diversity.profile(x = pdata$CUAL, group = pdata$LNGS,
                    parameter = "hill", ci.type = "perc")
hill_profile1
#> $Long
#>      q observed     mean    lower    upper
#> 1  0.0 3.000000 3.000000 3.000000 3.000000
#> 2  0.1 2.970041 2.964462 2.921973 2.992033
#> 3  0.2 2.940750 2.930107 2.849671 2.984036
#> 4  0.3 2.912153 2.896950 2.781453 2.976133
#> 5  0.4 2.884272 2.864995 2.716325 2.968355
#> 6  0.5 2.857124 2.834239 2.656209 2.960670
#> 7  0.6 2.830721 2.804671 2.602732 2.953078
#> 8  0.7 2.805073 2.776274 2.551969 2.945159
#> 9  0.8 2.780186 2.749025 2.501417 2.937217
#> 10 0.9 2.756060 2.722897 2.464737 2.929259
#> 11 1.0 2.732695 2.697860 2.427838 2.921292
#> 12 1.1 2.710085 2.673881 2.392008 2.913319
#> 13 1.2 2.688224 2.650925 2.353206 2.905344
#> 14 1.3 2.667101 2.628957 2.316516 2.897373
#> 15 1.4 2.646704 2.607939 2.282076 2.889409
#> 16 1.5 2.627019 2.587835 2.253681 2.881457
#> 17 1.6 2.608031 2.568607 2.229592 2.873521
#> 18 1.7 2.589722 2.550218 2.211941 2.865606
#> 19 1.8 2.572075 2.532631 2.184150 2.857716
#> 20 1.9 2.555070 2.515811 2.158142 2.849891
#> 21 2.0 2.538688 2.499723 2.133687 2.842105
#> 22 2.1 2.522908 2.484333 2.110520 2.836021
#> 23 2.2 2.507711 2.469607 2.088735 2.830098
#> 24 2.3 2.493075 2.455515 2.073086 2.824371
#> 25 2.4 2.478981 2.442025 2.059344 2.818799
#> 26 2.5 2.465409 2.429108 2.040443 2.813378
#> 27 2.6 2.452337 2.416737 2.022650 2.808105
#> 28 2.7 2.439748 2.404883 2.005895 2.802977
#> 29 2.8 2.427621 2.393522 1.990189 2.797990
#> 30 2.9 2.415938 2.382628 1.975378 2.793141
#> 31 3.0 2.404680 2.372180 1.961350 2.788426
#> 
#> $Medium
#>      q observed     mean    lower    upper
#> 1  0.0 4.000000 3.618000 3.000000 4.000000
#> 2  0.1 3.775167 3.474824 2.928394 3.868584
#> 3  0.2 3.586424 3.349383 2.858040 3.748178
#> 4  0.3 3.427791 3.239260 2.789234 3.638082
#> 5  0.4 3.293906 3.142220 2.722250 3.540660
#> 6  0.5 3.180150 3.056280 2.657334 3.456909
#> 7  0.6 3.082659 2.979729 2.594704 3.381874
#> 8  0.7 2.998274 2.911120 2.534539 3.312275
#> 9  0.8 2.924454 2.849246 2.476981 3.244719
#> 10 0.9 2.859178 2.793112 2.420320 3.191025
#> 11 1.0 2.800853 2.741898 2.356336 3.145961
#> 12 1.1 2.748230 2.694932 2.298126 3.101231
#> 13 1.2 2.700330 2.651663 2.243046 3.049204
#> 14 1.3 2.656390 2.611637 2.200438 3.015513
#> 15 1.4 2.615811 2.574478 2.160960 2.990795
#> 16 1.5 2.578125 2.539874 2.110282 2.958994
#> 17 1.6 2.542961 2.507562 2.068316 2.924667
#> 18 1.7 2.510025 2.477321 2.029977 2.913831
#> 19 1.8 2.479080 2.448961 1.998256 2.905417
#> 20 1.9 2.449934 2.422318 1.968838 2.883376
#> 21 2.0 2.422430 2.397251 1.941573 2.857773
#> 22 2.1 2.396434 2.373634 1.916310 2.833450
#> 23 2.2 2.371835 2.351358 1.892905 2.810305
#> 24 2.3 2.348536 2.330324 1.871219 2.788239
#> 25 2.4 2.326451 2.310443 1.851119 2.767126
#> 26 2.5 2.305505 2.291636 1.832482 2.748871
#> 27 2.6 2.285629 2.273830 1.815192 2.739765
#> 28 2.7 2.266761 2.256959 1.799140 2.731614
#> 29 2.8 2.248843 2.240961 1.784226 2.724880
#> 30 2.9 2.231821 2.225780 1.770357 2.716554
#> 31 3.0 2.215647 2.211366 1.757448 2.703064
#> 
#> $Short
#>      q observed     mean    lower    upper
#> 1  0.0 4.000000 3.870000 3.000000 4.000000
#> 2  0.1 3.933810 3.789634 2.936838 3.985467
#> 3  0.2 3.870196 3.713869 2.875438 3.971064
#> 4  0.3 3.809136 3.642581 2.815944 3.956798
#> 5  0.4 3.750595 3.575609 2.758478 3.942676
#> 6  0.5 3.694521 3.512766 2.703140 3.928704
#> 7  0.6 3.640856 3.453847 2.650006 3.914887
#> 8  0.7 3.589527 3.398636 2.606810 3.901233
#> 9  0.8 3.540459 3.346915 2.569479 3.887745
#> 10 0.9 3.493567 3.298466 2.515887 3.874428
#> 11 1.0 3.448767 3.253078 2.476843 3.861288
#> 12 1.1 3.405970 3.210545 2.436475 3.848328
#> 13 1.2 3.365087 3.170670 2.379326 3.835552
#> 14 1.3 3.326031 3.133266 2.328644 3.822963
#> 15 1.4 3.288713 3.098159 2.278574 3.810563
#> 16 1.5 3.253050 3.065183 2.237378 3.798356
#> 17 1.6 3.218958 3.034185 2.200363 3.786343
#> 18 1.7 3.186359 3.005022 2.160763 3.774525
#> 19 1.8 3.155176 2.977560 2.117549 3.762905
#> 20 1.9 3.125338 2.951677 2.078397 3.751483
#> 21 2.0 3.096774 2.927259 2.042918 3.740260
#> 22 2.1 3.069420 2.904202 2.010325 3.729235
#> 23 2.2 3.043214 2.882408 1.980602 3.718410
#> 24 2.3 3.018098 2.861788 1.953460 3.707783
#> 25 2.4 2.994016 2.842261 1.935903 3.697354
#> 26 2.5 2.970917 2.823750 1.912012 3.687122
#> 27 2.6 2.948751 2.806187 1.890173 3.677086
#> 28 2.7 2.927474 2.789507 1.870174 3.667245
#> 29 2.8 2.907041 2.773651 1.851826 3.657596
#> 30 2.9 2.887412 2.758565 1.834963 3.648139
#> 31 3.0 2.868549 2.744198 1.819435 3.638871
#> 
#> attr(,"R")
#> [1] 1000
#> attr(,"conf")
#> [1] 0.95
#> attr(,"parameter")
#> [1] "hill"
#> attr(,"ci.type")
#> [1] "perc"

hill_profile1_df <- dplyr::bind_rows(hill_profile1, .id = "group")

hill_points1_df <- hill_profile1_df %>%
  filter(q %in% important_q) %>%
  mutate(order_label = factor(q, levels = important_q,
                              labels = important_labels))

ggplot(hill_profile1_df, aes(x = q, y = mean,
                             color = group, fill = group)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), alpha = 0.2, color = NA) +
  geom_line(linewidth = 1) +
  geom_vline(xintercept = c(0, 1, 2), linetype = "dashed",
             color = "grey60") +
  geom_point(data = hill_points1_df, aes(shape = order_label),
    size = 3, stroke = 1, inherit.aes = TRUE) +
  scale_shape_manual(values = c(17, 18, 15), name = "Important q")  +
  labs(x = "Order (q)", y = "Hill number",
    color = "Group", fill = "Group") +
  theme_bw()


ggplot(hill_profile1_df, aes(x = q, y = mean)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), fill = "grey80") +
  geom_line(color = "black", linewidth = 1) +
  facet_wrap(~ group, scales = "free_y") +
  labs(x = "Order (q)", y = "Hill number") +
  theme_bw()


# Rényi profile - Percentile CIs ----

renyi_profile1 <-
  diversity.profile(pdata$CUAL, group = pdata$LNGS,
                    parameter = "renyi", ci.type = "perc")
renyi_profile1
#> $Long
#>      q  observed      mean     lower    upper
#> 1  0.0 1.0986123 1.0986123 1.0986123 1.098612
#> 2  0.1 1.0885756 1.0865618 1.0702441 1.096196
#> 3  0.2 1.0786646 1.0747426 1.0430139 1.093809
#> 4  0.3 1.0688928 1.0631763 1.0169968 1.091453
#> 5  0.4 1.0592726 1.0518810 0.9922425 1.089129
#> 6  0.5 1.0498155 1.0408710 0.9687767 1.086839
#> 7  0.6 1.0405315 1.0301576 0.9466030 1.084581
#> 8  0.7 1.0314297 1.0197490 0.9257060 1.082357
#> 9  0.8 1.0225177 1.0096505 0.9060549 1.080167
#> 10 0.9 1.0138021 0.9998651 0.8876062 1.078012
#> 11 1.0 1.0052882 0.9903937 0.8703073 1.075892
#> 12 1.1 0.9969801 0.9812351 0.8540994 1.073806
#> 13 1.2 0.9888807 0.9723868 0.8389295 1.071756
#> 14 1.3 0.9809920 0.9638447 0.8247041 1.069741
#> 15 1.4 0.9733151 0.9556036 0.8113880 1.067721
#> 16 1.5 0.9658499 0.9476575 0.7989085 1.065502
#> 17 1.6 0.9585956 0.9399994 0.7872048 1.063285
#> 18 1.7 0.9515507 0.9326219 0.7744250 1.061072
#> 19 1.8 0.9447130 0.9255171 0.7655213 1.058863
#> 20 1.9 0.9380796 0.9186766 0.7530072 1.056660
#> 21 2.0 0.9316472 0.9120919 0.7405494 1.054463
#> 22 2.1 0.9254122 0.9057544 0.7287438 1.052595
#> 23 2.2 0.9193702 0.8996552 0.7204869 1.050761
#> 24 2.3 0.9135169 0.8937856 0.7102029 1.048959
#> 25 2.4 0.9078477 0.8881370 0.6999060 1.047190
#> 26 2.5 0.9023576 0.8827007 0.6901195 1.045453
#> 27 2.6 0.8970416 0.8774683 0.6808507 1.043747
#> 28 2.7 0.8918947 0.8724316 0.6735163 1.042073
#> 29 2.8 0.8869118 0.8675825 0.6655820 1.040430
#> 30 2.9 0.8820876 0.8629132 0.6576276 1.038818
#> 31 3.0 0.8774170 0.8584161 0.6500998 1.037236
#> 
#> $Medium
#>      q  observed      mean     lower    upper
#> 1  0.0 1.3862944 1.2781259 1.0986123 1.386294
#> 2  0.1 1.3284446 1.2398862 1.0744540 1.353412
#> 3  0.2 1.2771555 1.2046894 1.0501362 1.322055
#> 4  0.3 1.2319160 1.1723878 1.0257822 1.292512
#> 5  0.4 1.1920742 1.1427638 1.0014999 1.265418
#> 6  0.5 1.1569284 1.1155657 0.9773893 1.238818
#> 7  0.6 1.1257925 1.0905352 0.9564127 1.215004
#> 8  0.7 1.0980367 1.0674257 0.9331855 1.194989
#> 9  0.8 1.0731077 1.0460123 0.9070404 1.176575
#> 10 0.9 1.0505342 1.0260962 0.8826597 1.160348
#> 11 1.0 1.0299241 1.0075059 0.8521366 1.146228
#> 12 1.1 1.0109570 0.9900950 0.8278343 1.132964
#> 13 1.2 0.9933740 0.9737398 0.8048512 1.121603
#> 14 1.3 0.9769680 0.9583359 0.7806750 1.110516
#> 15 1.4 0.9615743 0.9437954 0.7597311 1.100779
#> 16 1.5 0.9470625 0.9300440 0.7368298 1.091446
#> 17 1.6 0.9333293 0.9170182 0.7176593 1.082706
#> 18 1.7 0.9202928 0.9046635 0.6999353 1.075507
#> 19 1.8 0.9078876 0.8929326 0.6835520 1.068292
#> 20 1.9 0.8960613 0.8817841 0.6669937 1.063285
#> 21 2.0 0.8847711 0.8711810 0.6502165 1.057679
#> 22 2.1 0.8739819 0.8610904 0.6381780 1.051989
#> 23 2.2 0.8636641 0.8514823 0.6269048 1.046633
#> 24 2.3 0.8537922 0.8423293 0.6163470 1.041014
#> 25 2.4 0.8443440 0.8336062 0.6064569 1.035889
#> 26 2.5 0.8352998 0.8252896 0.5971891 1.032109
#> 27 2.6 0.8266413 0.8173575 0.5885003 1.028398
#> 28 2.7 0.8183519 0.8097897 0.5803502 1.024878
#> 29 2.8 0.8104158 0.8025668 0.5727006 1.021446
#> 30 2.9 0.8028180 0.7956708 0.5655160 1.018088
#> 31 3.0 0.7955444 0.7890845 0.5587634 1.013208
#> 
#> $Short
#>      q observed     mean     lower    upper
#> 1  0.0 1.386294 1.346882 1.0986123 1.386294
#> 2  0.1 1.369609 1.326686 1.0802640 1.382655
#> 3  0.2 1.353305 1.307105 1.0622339 1.379034
#> 4  0.3 1.337402 1.288178 1.0445664 1.375435
#> 5  0.4 1.321914 1.269936 1.0273014 1.371860
#> 6  0.5 1.306851 1.252399 1.0079721 1.368309
#> 7  0.6 1.292219 1.235575 0.9898612 1.364787
#> 8  0.7 1.278021 1.219466 0.9637953 1.361293
#> 9  0.8 1.264256 1.204064 0.9364895 1.357829
#> 10 0.9 1.250923 1.189359 0.9181029 1.354398
#> 11 1.0 1.238017 1.175332 0.9002561 1.351001
#> 12 1.1 1.225530 1.161964 0.8790134 1.347639
#> 13 1.2 1.213454 1.149231 0.8425911 1.344313
#> 14 1.3 1.201780 1.137108 0.8124411 1.341026
#> 15 1.4 1.190496 1.125569 0.7979626 1.337777
#> 16 1.5 1.179593 1.114588 0.7843453 1.334568
#> 17 1.6 1.169058 1.104136 0.7715719 1.331401
#> 18 1.7 1.158879 1.094188 0.7524150 1.328275
#> 19 1.8 1.149044 1.084718 0.7335592 1.325191
#> 20 1.9 1.139542 1.075700 0.7161671 1.322151
#> 21 2.0 1.130361 1.067110 0.7001158 1.319155
#> 22 2.1 1.121489 1.058925 0.6852904 1.316203
#> 23 2.2 1.112914 1.051122 0.6715842 1.313296
#> 24 2.3 1.104627 1.043680 0.6588993 1.310434
#> 25 2.4 1.096616 1.036579 0.6471460 1.307617
#> 26 2.5 1.088871 1.029800 0.6362426 1.304846
#> 27 2.6 1.081382 1.023324 0.6261147 1.302121
#> 28 2.7 1.074140 1.017135 0.6167513 1.299441
#> 29 2.8 1.067136 1.011217 0.6082751 1.296806
#> 30 2.9 1.060361 1.005555 0.6003059 1.294217
#> 31 3.0 1.053806 1.000135 0.5928118 1.291673
#> 
#> attr(,"R")
#> [1] 1000
#> attr(,"conf")
#> [1] 0.95
#> attr(,"parameter")
#> [1] "renyi"
#> attr(,"ci.type")
#> [1] "perc"

renyi_profile1_df <- dplyr::bind_rows(renyi_profile1, .id = "group")

renyi_points1_df <- renyi_profile1_df %>%
  filter(q %in% important_q) %>%
  mutate(order_label = factor(q, levels = important_q,
                              labels = important_labels))

ggplot(renyi_profile1_df, aes(x = q, y = mean,
                              color = group, fill = group)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), alpha = 0.2, color = NA) +
  geom_line(linewidth = 1) +
  geom_vline(xintercept = c(0, 1, 2), linetype = "dashed",
             color = "grey60") +
  geom_point(data = renyi_points1_df, aes(shape = order_label),
             size = 3, stroke = 1, inherit.aes = TRUE) +
  scale_shape_manual(values = c(17, 18, 15), name = "Important q")  +
  labs(x = "Order (q)", y = "Hill number",
       color = "Group", fill = "Group") +
  theme_bw()


ggplot(renyi_profile1_df, aes(x = q, y = mean)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), fill = "grey80") +
  geom_line(color = "black", linewidth = 1) +
  facet_wrap(~ group, scales = "free_y") +
  labs(x = "Order (q)", y = "Hill number") +
  theme_bw()


# Tsallis profile - Percentile CIs ----

tsallis_profile1 <-
  diversity.profile(pdata$CUAL, group = pdata$LNGS,
                    parameter = "tsallis", ci.type = "perc")
tsallis_profile1 <-
  diversity.profile(x = pdata$CUAL, group = pdata$LNGS,
                    parameter = "hill", ci.type = "perc")
tsallis_profile1
#> $Long
#>      q observed     mean    lower    upper
#> 1  0.0 3.000000 3.000000 3.000000 3.000000
#> 2  0.1 2.970041 2.964005 2.918281 2.990243
#> 3  0.2 2.940750 2.929227 2.842205 2.980660
#> 4  0.3 2.912153 2.895680 2.766603 2.971255
#> 5  0.4 2.884272 2.863370 2.697276 2.962029
#> 6  0.5 2.857124 2.832294 2.634839 2.952984
#> 7  0.6 2.830721 2.802439 2.577006 2.944120
#> 8  0.7 2.805073 2.773787 2.523649 2.935440
#> 9  0.8 2.780186 2.746314 2.472455 2.926943
#> 10 0.9 2.756060 2.719991 2.420273 2.918630
#> 11 1.0 2.732695 2.694785 2.379587 2.910499
#> 12 1.1 2.710085 2.670662 2.345574 2.902551
#> 13 1.2 2.688224 2.647585 2.313866 2.894784
#> 14 1.3 2.667101 2.625515 2.276373 2.887198
#> 15 1.4 2.646704 2.604415 2.237303 2.879200
#> 16 1.5 2.627019 2.584245 2.209862 2.870806
#> 17 1.6 2.608031 2.564967 2.178353 2.862464
#> 18 1.7 2.589722 2.546540 2.148805 2.854179
#> 19 1.8 2.572075 2.528928 2.121010 2.845953
#> 20 1.9 2.555070 2.512094 2.094998 2.837791
#> 21 2.0 2.538688 2.496001 2.072276 2.829694
#> 22 2.1 2.522908 2.480614 2.053096 2.821668
#> 23 2.2 2.507711 2.465899 2.035159 2.813713
#> 24 2.3 2.493075 2.451825 2.018361 2.805834
#> 25 2.4 2.478981 2.438359 2.002699 2.798033
#> 26 2.5 2.465409 2.425471 1.987984 2.790312
#> 27 2.6 2.452337 2.413133 1.970305 2.782674
#> 28 2.7 2.439748 2.401317 1.953520 2.775120
#> 29 2.8 2.427621 2.389998 1.937734 2.767654
#> 30 2.9 2.415938 2.379150 1.923949 2.760276
#> 31 3.0 2.404680 2.368750 1.912568 2.752989
#> 
#> $Medium
#>      q observed     mean    lower    upper
#> 1  0.0 4.000000 3.635000 3.000000 4.000000
#> 2  0.1 3.775167 3.490832 2.917189 3.870241
#> 3  0.2 3.586424 3.364547 2.836007 3.751049
#> 4  0.3 3.427791 3.253707 2.757403 3.641924
#> 5  0.4 3.293906 3.156065 2.687251 3.544876
#> 6  0.5 3.180150 3.069623 2.622189 3.453736
#> 7  0.6 3.082659 2.992660 2.560105 3.376683
#> 8  0.7 2.998274 2.923718 2.481607 3.306601
#> 9  0.8 2.924454 2.861581 2.427891 3.243245
#> 10 0.9 2.859178 2.805243 2.362856 3.182589
#> 11 1.0 2.800853 2.753879 2.311537 3.126803
#> 12 1.1 2.748230 2.706807 2.263423 3.086563
#> 13 1.2 2.700330 2.663470 2.196568 3.050088
#> 14 1.3 2.656390 2.623407 2.150506 3.014391
#> 15 1.4 2.615811 2.586237 2.108882 2.995325
#> 16 1.5 2.578125 2.551643 2.062331 2.973004
#> 17 1.6 2.542961 2.519357 2.027604 2.951542
#> 18 1.7 2.510025 2.489153 1.996164 2.928358
#> 19 1.8 2.479080 2.460840 1.968008 2.905641
#> 20 1.9 2.449934 2.434250 1.934899 2.884357
#> 21 2.0 2.422430 2.409239 1.904764 2.864088
#> 22 2.1 2.396434 2.385681 1.880430 2.845464
#> 23 2.2 2.371835 2.363464 1.860426 2.826717
#> 24 2.3 2.348536 2.342488 1.841885 2.815594
#> 25 2.4 2.326451 2.322663 1.824678 2.807810
#> 26 2.5 2.305505 2.303910 1.808691 2.795340
#> 27 2.6 2.285629 2.286154 1.793818 2.783102
#> 28 2.7 2.266761 2.269330 1.779963 2.769766
#> 29 2.8 2.248843 2.253376 1.767041 2.757046
#> 30 2.9 2.231821 2.238235 1.754973 2.744797
#> 31 3.0 2.215647 2.223857 1.743689 2.732984
#> 
#> $Short
#>      q observed     mean    lower    upper
#> 1  0.0 4.000000 3.865000 3.000000 4.000000
#> 2  0.1 3.933810 3.784529 2.945457 3.981757
#> 3  0.2 3.870196 3.708572 2.892826 3.963499
#> 4  0.3 3.809136 3.637027 2.841679 3.945237
#> 5  0.4 3.750595 3.569751 2.790285 3.926984
#> 6  0.5 3.694521 3.506571 2.727950 3.908751
#> 7  0.6 3.640856 3.447297 2.651020 3.890550
#> 8  0.7 3.589527 3.391723 2.607068 3.872393
#> 9  0.8 3.540459 3.339638 2.550539 3.854291
#> 10 0.9 3.493567 3.290829 2.504391 3.836258
#> 11 1.0 3.448767 3.245087 2.460233 3.818303
#> 12 1.1 3.405970 3.202209 2.418476 3.800440
#> 13 1.2 3.365087 3.161999 2.376675 3.783047
#> 14 1.3 3.326031 3.124274 2.324285 3.769731
#> 15 1.4 3.288713 3.088857 2.268437 3.757029
#> 16 1.5 3.253050 3.055584 2.214538 3.744916
#> 17 1.6 3.218958 3.024304 2.165962 3.733366
#> 18 1.7 3.186359 2.994872 2.137778 3.722354
#> 19 1.8 3.155176 2.967156 2.114253 3.711856
#> 20 1.9 3.125338 2.941034 2.078278 3.701848
#> 21 2.0 3.096774 2.916393 2.042553 3.692308
#> 22 2.1 3.069420 2.893127 2.010015 3.683045
#> 23 2.2 3.043214 2.871140 1.980341 3.674198
#> 24 2.3 3.018098 2.850343 1.953239 3.665745
#> 25 2.4 2.994016 2.830652 1.928449 3.657669
#> 26 2.5 2.970917 2.811993 1.905739 3.649951
#> 27 2.6 2.948751 2.794295 1.884899 3.642573
#> 28 2.7 2.927474 2.777494 1.865745 3.635520
#> 29 2.8 2.907041 2.761530 1.848111 3.628774
#> 30 2.9 2.887412 2.746349 1.831849 3.622398
#> 31 3.0 2.868549 2.731898 1.816827 3.616389
#> 
#> attr(,"R")
#> [1] 1000
#> attr(,"conf")
#> [1] 0.95
#> attr(,"parameter")
#> [1] "hill"
#> attr(,"ci.type")
#> [1] "perc"

tsallis_profile1_df <- dplyr::bind_rows(tsallis_profile1, .id = "group")

tsallis_points1_df <- tsallis_profile1_df %>%
  filter(q %in% important_q) %>%
  mutate(order_label = factor(q, levels = important_q,
                              labels = important_labels))

ggplot(tsallis_profile1_df, aes(x = q, y = mean,
                                color = group, fill = group)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), alpha = 0.2, color = NA) +
  geom_line(linewidth = 1) +
  geom_vline(xintercept = c(0, 1, 2), linetype = "dashed",
             color = "grey60") +
  geom_point(data = tsallis_points1_df, aes(shape = order_label),
             size = 3, stroke = 1, inherit.aes = TRUE) +
  scale_shape_manual(values = c(17, 18, 15), name = "Important q")  +
  labs(x = "Order (q)", y = "Hill number",
       color = "Group", fill = "Group") +
  theme_bw()


ggplot(tsallis_profile1_df, aes(x = q, y = mean)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), fill = "grey80") +
  geom_line(color = "black", linewidth = 1) +
  facet_wrap(~ group, scales = "free_y") +
  labs(x = "Order (q)", y = "Hill number") +
  theme_bw()


# Hill profile - BCa CIs ----

hill_profile2 <-
  diversity.profile(pdata$CUAL, group = pdata$LNGS,
                    parameter = "hill", ci.type = "bca")
#> [1] "All values of t are equal to  3 \n Cannot calculate confidence intervals"
#> Warning: bca CI failed for component 1; using percentile CI.
hill_profile2
#> $Long
#>      q observed     mean    lower    upper
#> 1  0.0 3.000000 3.000000 3.000000 3.000000
#> 2  0.1 2.970041 2.964834 2.933296 2.994320
#> 3  0.2 2.940750 2.930808 2.868332 2.987978
#> 4  0.3 2.912153 2.897938 2.805287 2.981887
#> 5  0.4 2.884272 2.866232 2.747428 2.975794
#> 6  0.5 2.857124 2.835688 2.685560 2.968217
#> 7  0.6 2.830721 2.806297 2.632074 2.963540
#> 8  0.7 2.805073 2.778044 2.580153 2.957384
#> 9  0.8 2.780186 2.750909 2.535030 2.951211
#> 10 0.9 2.756060 2.724868 2.491869 2.944861
#> 11 1.0 2.732695 2.699894 2.429521 2.937493
#> 12 1.1 2.710085 2.675956 2.414275 2.931765
#> 13 1.2 2.688224 2.653022 2.385625 2.934833
#> 14 1.3 2.667101 2.631059 2.354913 2.928462
#> 15 1.4 2.646704 2.610031 2.321977 2.921962
#> 16 1.5 2.627019 2.589904 2.287783 2.912226
#> 17 1.6 2.608031 2.570642 2.259315 2.902321
#> 18 1.7 2.589722 2.552210 2.229107 2.896654
#> 19 1.8 2.572075 2.534573 2.205325 2.891044
#> 20 1.9 2.555070 2.517696 2.180283 2.885492
#> 21 2.0 2.538688 2.501546 2.136851 2.876804
#> 22 2.1 2.522908 2.486091 2.117131 2.870655
#> 23 2.2 2.507711 2.471297 2.100753 2.866828
#> 24 2.3 2.493075 2.457134 2.081227 2.861725
#> 25 2.4 2.478981 2.443572 2.064863 2.856540
#> 26 2.5 2.465409 2.430583 2.037716 2.844937
#> 27 2.6 2.452337 2.418139 2.022650 2.840106
#> 28 2.7 2.439748 2.406213 2.005416 2.833891
#> 29 2.8 2.427621 2.394780 1.990114 2.827488
#> 30 2.9 2.415938 2.383817 1.980617 2.822934
#> 31 3.0 2.404680 2.373300 1.961227 2.816313
#> 
#> $Medium
#>      q observed     mean    lower    upper
#> 1  0.0 4.000000 3.631000 3.000000 4.000000
#> 2  0.1 3.775167 3.485098 2.948328 3.916877
#> 3  0.2 3.586424 3.357390 2.897483 3.837768
#> 4  0.3 3.427791 3.245375 2.847616 3.762582
#> 5  0.4 3.293906 3.146746 2.806758 3.691204
#> 6  0.5 3.180150 3.059460 2.759059 3.623498
#> 7  0.6 3.082659 2.981757 2.707785 3.559316
#> 8  0.7 2.998274 2.912152 2.658697 3.495770
#> 9  0.8 2.924454 2.849409 2.597714 3.402135
#> 10 0.9 2.859178 2.792509 2.540062 3.332326
#> 11 1.0 2.800853 2.740616 2.467705 3.289954
#> 12 1.1 2.748230 2.693046 2.415144 3.250581
#> 13 1.2 2.700330 2.649238 2.333804 3.178921
#> 14 1.3 2.656390 2.608729 2.271972 3.133945
#> 15 1.4 2.615811 2.571138 2.203678 3.091903
#> 16 1.5 2.578125 2.536147 2.167528 3.071784
#> 17 1.6 2.542961 2.503490 2.115054 3.013638
#> 18 1.7 2.510025 2.472941 2.077652 2.985985
#> 19 1.8 2.479080 2.444307 2.044131 2.967850
#> 20 1.9 2.449934 2.417423 2.001137 2.948926
#> 21 2.0 2.422430 2.392142 1.975610 2.932127
#> 22 2.1 2.396434 2.368339 1.943755 2.914580
#> 23 2.2 2.371835 2.345900 1.914662 2.894450
#> 24 2.3 2.348536 2.324724 1.890825 2.886035
#> 25 2.4 2.326451 2.304722 1.867933 2.867149
#> 26 2.5 2.305505 2.285810 1.846558 2.846392
#> 27 2.6 2.285629 2.267916 1.827140 2.831564
#> 28 2.7 2.266761 2.250971 1.809294 2.821134
#> 29 2.8 2.248843 2.234912 1.792569 2.807983
#> 30 2.9 2.231821 2.219683 1.777714 2.800794
#> 31 3.0 2.215647 2.205230 1.763721 2.786982
#> 
#> $Short
#>      q observed     mean    lower    upper
#> 1  0.0 4.000000 3.878000 3.000000 4.000000
#> 2  0.1 3.933810 3.796697 3.818059 3.997186
#> 3  0.2 3.870196 3.720115 3.638656 3.994379
#> 4  0.3 3.809136 3.648126 3.468122 3.991579
#> 5  0.4 3.750595 3.580561 3.317762 3.988787
#> 6  0.5 3.694521 3.517224 3.117807 3.986001
#> 7  0.6 3.640856 3.457901 2.990589 3.983223
#> 8  0.7 3.589527 3.402365 2.927570 3.980453
#> 9  0.8 3.540459 3.350385 2.926056 3.977690
#> 10 0.9 3.493567 3.301734 2.906269 3.974936
#> 11 1.0 3.448767 3.256189 2.867204 3.972189
#> 12 1.1 3.405970 3.213534 2.800024 3.969451
#> 13 1.2 3.365087 3.173566 2.721055 3.966722
#> 14 1.3 3.326031 3.136091 2.677041 3.964001
#> 15 1.4 3.288713 3.100928 2.623686 3.961288
#> 16 1.5 3.253050 3.067908 2.571539 3.958585
#> 17 1.6 3.218958 3.036875 2.458114 3.927512
#> 18 1.7 3.186359 3.007683 2.404432 3.918594
#> 19 1.8 3.155176 2.980196 2.371133 3.909777
#> 20 1.9 3.125338 2.954292 2.346311 3.903948
#> 21 2.0 3.096774 2.929854 2.317359 3.892499
#> 22 2.1 3.069420 2.906778 2.229272 3.883764
#> 23 2.2 3.043214 2.884966 2.193922 3.873837
#> 24 2.3 3.018098 2.864329 2.161406 3.837899
#> 25 2.4 2.994016 2.844785 2.131480 3.822987
#> 26 2.5 2.970917 2.826259 2.103917 3.813759
#> 27 2.6 2.948751 2.808679 2.078508 3.804187
#> 28 2.7 2.927474 2.791984 2.041816 3.798686
#> 29 2.8 2.907041 2.776112 2.021941 3.793312
#> 30 2.9 2.887412 2.761011 2.003460 3.788060
#> 31 3.0 2.868549 2.746630 1.986254 3.782930
#> 
#> attr(,"R")
#> [1] 1000
#> attr(,"conf")
#> [1] 0.95
#> attr(,"parameter")
#> [1] "hill"
#> attr(,"ci.type")
#> [1] "bca"

hill_profile2_df <- dplyr::bind_rows(hill_profile2, .id = "group")

hill_points2_df <- hill_profile2_df %>%
  filter(q %in% important_q) %>%
  mutate(order_label = factor(q, levels = important_q,
                              labels = important_labels))

ggplot(hill_profile2_df, aes(x = q, y = mean,
                             color = group, fill = group)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), alpha = 0.2, color = NA) +
  geom_line(linewidth = 1) +
  geom_vline(xintercept = c(0, 1, 2), linetype = "dashed",
             color = "grey60") +
  geom_point(data = hill_points2_df, aes(shape = order_label),
             size = 3, stroke = 1, inherit.aes = TRUE) +
  scale_shape_manual(values = c(17, 18, 15), name = "Important q")  +
  labs(x = "Order (q)", y = "Hill number",
       color = "Group", fill = "Group") +
  theme_bw()


ggplot(hill_profile2_df, aes(x = q, y = mean)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), fill = "grey80") +
  geom_line(color = "black", linewidth = 1) +
  facet_wrap(~ group, scales = "free_y") +
  labs(x = "Order (q)", y = "Hill number") +
  theme_bw()


# Rényi profile - BCa CIs ----

renyi_profile2 <-
  diversity.profile(pdata$CUAL, group = pdata$LNGS,
                    parameter = "renyi", ci.type = "bca")
#> [1] "All values of t are equal to  1.09861228866811 \n Cannot calculate confidence intervals"
#> Warning: bca CI failed for component 1; using percentile CI.
renyi_profile2
#> $Long
#>      q  observed      mean     lower    upper
#> 1  0.0 1.0986123 1.0986123 1.0986123 1.098612
#> 2  0.1 1.0885756 1.0865304 1.0752250 1.097043
#> 3  0.2 1.0786646 1.0746953 1.0510655 1.095080
#> 4  0.3 1.0688928 1.0631283 1.0287592 1.093340
#> 5  0.4 1.0592726 1.0518467 1.0078880 1.091618
#> 6  0.5 1.0498155 1.0408641 0.9856860 1.088453
#> 7  0.6 1.0405315 1.0301906 0.9656715 1.087894
#> 8  0.7 1.0314297 1.0198332 0.9457501 1.085845
#> 9  0.8 1.0225177 1.0097963 0.9258047 1.083714
#> 10 0.9 1.0138021 1.0000816 0.9074091 1.081498
#> 11 1.0 1.0052882 0.9906889 0.8876943 1.078010
#> 12 1.1 0.9969801 0.9816160 0.8722954 1.076279
#> 13 1.2 0.9888807 0.9728592 0.8666497 1.078464
#> 14 1.3 0.9809920 0.9644136 0.8503679 1.076748
#> 15 1.4 0.9733151 0.9562731 0.8356063 1.075006
#> 16 1.5 0.9658499 0.9484308 0.8210556 1.073238
#> 17 1.6 0.9585956 0.9408788 0.8028462 1.069005
#> 18 1.7 0.9515507 0.9336092 0.7904254 1.063537
#> 19 1.8 0.9447130 0.9266131 0.7794792 1.061525
#> 20 1.9 0.9380796 0.9198818 0.7691472 1.059491
#> 21 2.0 0.9316472 0.9134060 0.7494889 1.056680
#> 22 2.1 0.9254122 0.9071768 0.7390188 1.054949
#> 23 2.2 0.9193702 0.9011848 0.7302797 1.053253
#> 24 2.3 0.9135169 0.8954210 0.7225839 1.051591
#> 25 2.4 0.9078477 0.8898764 0.7152995 1.049962
#> 26 2.5 0.9023576 0.8845421 0.7023542 1.046995
#> 27 2.6 0.8970416 0.8794094 0.6943327 1.046179
#> 28 2.7 0.8918947 0.8744700 0.6863623 1.042145
#> 29 2.8 0.8869118 0.8697157 0.6794947 1.040515
#> 30 2.9 0.8820876 0.8651384 0.6748348 1.041701
#> 31 3.0 0.8774170 0.8607307 0.6661136 1.037347
#> 
#> $Medium
#>      q  observed      mean     lower    upper
#> 1  0.0 1.3862944 1.2827288 1.0986123 1.386294
#> 2  0.1 1.3284446 1.2444696 1.0800194 1.364798
#> 3  0.2 1.2771555 1.2092115 1.0612282 1.344696
#> 4  0.3 1.2319160 1.1768129 1.0443952 1.325958
#> 5  0.4 1.1920742 1.1470642 1.0273632 1.308536
#> 6  0.5 1.1569284 1.1197218 1.0093490 1.291480
#> 7  0.6 1.1257925 1.0945353 0.9897522 1.257202
#> 8  0.7 1.0980367 1.0712645 0.9717405 1.228088
#> 9  0.8 1.0731077 1.0496894 0.9524782 1.208655
#> 10 0.9 1.0505342 1.0296153 0.9262639 1.190482
#> 11 1.0 1.0299241 1.0108731 0.9032885 1.175827
#> 12 1.1 1.0109570 0.9933180 0.8737111 1.159092
#> 13 1.2 0.9933740 0.9768271 0.8407928 1.142953
#> 14 1.3 0.9769680 0.9612964 0.8107183 1.130458
#> 15 1.4 0.9615743 0.9466378 0.7869190 1.118255
#> 16 1.5 0.9470625 0.9327766 0.7690664 1.108506
#> 17 1.6 0.9333293 0.9196489 0.7487027 1.093759
#> 18 1.7 0.9202928 0.9071997 0.7252592 1.086582
#> 19 1.8 0.9078876 0.8953810 0.7075616 1.079943
#> 20 1.9 0.8960613 0.8841509 0.6890120 1.068189
#> 21 2.0 0.8847711 0.8734720 0.6732840 1.063361
#> 22 2.1 0.8739819 0.8633108 0.6581026 1.053590
#> 23 2.2 0.8636641 0.8536368 0.6447409 1.048170
#> 24 2.3 0.8537922 0.8444225 0.6326191 1.041049
#> 25 2.4 0.8443440 0.8356421 0.6209520 1.034659
#> 26 2.5 0.8352998 0.8272719 0.6098012 1.029324
#> 27 2.6 0.8266413 0.8192899 0.5997354 1.023595
#> 28 2.7 0.8183519 0.8116754 0.5903534 1.019182
#> 29 2.8 0.8104158 0.8044089 0.5815813 1.015052
#> 30 2.9 0.8028180 0.7974722 0.5734025 1.011028
#> 31 3.0 0.7955444 0.7908480 0.5657655 1.006877
#> 
#> $Short
#>      q observed      mean     lower    upper
#> 1  0.0 1.386294 1.3486080 1.0986123 1.386294
#> 2  0.1 1.369609 1.3276122 1.3459642 1.385591
#> 3  0.2 1.353305 1.3072802 1.3037263 1.384888
#> 4  0.3 1.337402 1.2876537 1.2694452 1.384187
#> 5  0.4 1.321914 1.2687615 1.2237626 1.383487
#> 6  0.5 1.306851 1.2506204 1.1823724 1.382788
#> 7  0.6 1.292219 1.2332370 1.1438281 1.382091
#> 8  0.7 1.278021 1.2166090 1.0949501 1.381396
#> 9  0.8 1.264256 1.2007268 1.0944294 1.380701
#> 10 0.9 1.250923 1.1855749 1.0850720 1.380009
#> 11 1.0 1.238017 1.1711333 1.0722551 1.379317
#> 12 1.1 1.225530 1.1573790 1.0484805 1.378628
#> 13 1.2 1.213454 1.1442861 1.0259463 1.377940
#> 14 1.3 1.201780 1.1318277 1.0045976 1.377254
#> 15 1.4 1.190496 1.1199758 0.9843791 1.376569
#> 16 1.5 1.179593 1.1087021 0.9601189 1.375887
#> 17 1.6 1.169058 1.0979784 0.9300702 1.375206
#> 18 1.7 1.158879 1.0877769 0.9184933 1.374527
#> 19 1.8 1.149044 1.0780706 0.9052338 1.373850
#> 20 1.9 1.139542 1.0688333 0.8940243 1.373174
#> 21 2.0 1.130361 1.0600396 0.8828692 1.372501
#> 22 2.1 1.121489 1.0516652 0.8406928 1.369159
#> 23 2.2 1.112914 1.0436871 0.8309463 1.367159
#> 24 2.3 1.104627 1.0360831 0.8143203 1.354959
#> 25 2.4 1.096616 1.0288325 0.8038681 1.348414
#> 26 2.5 1.088871 1.0219153 0.7967118 1.346087
#> 27 2.6 1.081382 1.0153129 0.7707513 1.336102
#> 28 2.7 1.074140 1.0090076 0.7138397 1.334655
#> 29 2.8 1.067136 1.0029828 0.7038394 1.333239
#> 30 2.9 1.060361 0.9972229 0.6940480 1.331854
#> 31 3.0 1.053806 0.9917130 0.6830015 1.330499
#> 
#> attr(,"R")
#> [1] 1000
#> attr(,"conf")
#> [1] 0.95
#> attr(,"parameter")
#> [1] "renyi"
#> attr(,"ci.type")
#> [1] "bca"

renyi_profile2_df <- dplyr::bind_rows(renyi_profile2, .id = "group")

renyi_points2_df <- renyi_profile2_df %>%
  filter(q %in% important_q) %>%
  mutate(order_label = factor(q, levels = important_q,
                              labels = important_labels))

ggplot(renyi_profile2_df, aes(x = q, y = mean,
                              color = group, fill = group)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), alpha = 0.2, color = NA) +
  geom_line(linewidth = 1) +
  geom_vline(xintercept = c(0, 1, 2), linetype = "dashed",
             color = "grey60") +
  geom_point(data = renyi_points2_df, aes(shape = order_label),
             size = 3, stroke = 1, inherit.aes = TRUE) +
  scale_shape_manual(values = c(17, 18, 15), name = "Important q")  +
  labs(x = "Order (q)", y = "Hill number",
       color = "Group", fill = "Group") +
  theme_bw()


ggplot(renyi_profile2_df, aes(x = q, y = mean)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), fill = "grey80") +
  geom_line(color = "black", linewidth = 1) +
  facet_wrap(~ group, scales = "free_y") +
  labs(x = "Order (q)", y = "Hill number") +
  theme_bw()


# Tsallis profile - BCa CIs ----

tsallis_profile2 <-
  diversity.profile(pdata$CUAL, group = pdata$LNGS,
                    parameter = "tsallis", ci.type = "bca")
#> [1] "All values of t are equal to  2 \n Cannot calculate confidence intervals"
#> Warning: bca CI failed for component 1; using percentile CI.
tsallis_profile2
#> $Long
#>      q  observed      mean     lower     upper
#> 1  0.0 2.0000000 2.0000000 2.0000000 2.0000000
#> 2  0.1 1.8485612 1.8434254 1.8134431 1.8714487
#> 3  0.2 1.7126236 1.7037822 1.6491094 1.7531821
#> 4  0.3 1.5903508 1.5789099 1.5090182 1.6442597
#> 5  0.4 1.4801432 1.4669538 1.3853712 1.5438392
#> 6  0.5 1.3806058 1.3663186 1.2747804 1.4506286
#> 7  0.6 1.2905205 1.2756289 1.1813325 1.3657528
#> 8  0.7 1.2088223 1.1936970 1.0963829 1.2867016
#> 9  0.8 1.1345790 1.1194948 1.0227075 1.2135858
#> 10 0.9 1.0669734 1.0521307 0.9565425 1.1459205
#> 11 1.0 1.0052882 0.9908297 0.8946554 1.0826482
#> 12 1.1 0.9488928 0.9349171 0.8424190 1.0248579
#> 13 1.2 0.8972324 0.8838039 0.7960409 0.9715417
#> 14 1.3 0.8498176 0.8369752 0.7519667 0.9214979
#> 15 1.4 0.8062167 0.7939798 0.7140237 0.8749950
#> 16 1.5 0.7660477 0.7544214 0.6767222 0.8316687
#> 17 1.6 0.7289728 0.7179513 0.6397739 0.7912826
#> 18 1.7 0.6946920 0.6842623 0.6070710 0.7532778
#> 19 1.8 0.6629392 0.6530828 0.5799747 0.7182651
#> 20 1.9 0.6334774 0.6241724 0.5550372 0.6856021
#> 21 2.0 0.6060957 0.5973179 0.5273920 0.6523920
#> 22 2.1 0.5806057 0.5723298 0.5058617 0.6241018
#> 23 2.2 0.5568392 0.5490393 0.4886703 0.5981396
#> 24 2.3 0.5346455 0.5272959 0.4710372 0.5733029
#> 25 2.4 0.5138895 0.5069650 0.4544783 0.5500446
#> 26 2.5 0.4944499 0.4879260 0.4362730 0.5282226
#> 27 2.6 0.4762176 0.4700707 0.4213441 0.5079194
#> 28 2.7 0.4590941 0.4533019 0.4068014 0.4885586
#> 29 2.8 0.4429909 0.4375320 0.3934399 0.4704869
#> 30 2.9 0.4278278 0.4226819 0.3810957 0.4536765
#> 31 3.0 0.4135320 0.4086802 0.3691134 0.4372532
#> 
#> $Medium
#>      q  observed      mean     lower     upper
#> 1  0.0 3.0000000 2.6130000 2.0000000 3.0000000
#> 2  0.1 2.5617123 2.2914682 1.8276314 2.6742133
#> 3  0.2 2.2224763 2.0313921 1.6739360 2.3980650
#> 4  0.3 1.9552854 1.8180407 1.5390228 2.1625512
#> 5  0.4 1.7411443 1.6406757 1.4203540 1.9604716
#> 6  0.5 1.5665950 1.4913940 1.3128925 1.7860463
#> 7  0.6 1.4220235 1.3643189 1.2143051 1.6346177
#> 8  0.7 1.3004971 1.2550327 1.1274974 1.5024165
#> 9  0.8 1.1969637 1.1601760 1.0414490 1.3863793
#> 10 0.9 1.1076994 1.0771641 0.9657790 1.2762923
#> 11 1.0 1.0299241 1.0039842 0.8944185 1.1776443
#> 12 1.1 0.9615347 0.9390501 0.8279688 1.0942356
#> 13 1.2 0.9009177 0.8810970 0.7693307 1.0190388
#> 14 1.3 0.8468176 0.8291050 0.7130013 0.9521384
#> 15 1.4 0.7982434 0.7822425 0.6689238 0.8971591
#> 16 1.5 0.7544018 0.7398247 0.6342625 0.8480954
#> 17 1.6 0.7146493 0.7012822 0.6001929 0.8027499
#> 18 1.7 0.6784574 0.6661377 0.5689278 0.7623093
#> 19 1.8 0.6453869 0.6339875 0.5436654 0.7238789
#> 20 1.9 0.6150691 0.6044879 0.5159858 0.6885478
#> 21 2.0 0.5871914 0.5773445 0.4965278 0.6568768
#> 22 2.1 0.5614865 0.5523034 0.4733250 0.6271340
#> 23 2.2 0.5377246 0.5291446 0.4540934 0.5998475
#> 24 2.3 0.5157061 0.5076764 0.4374026 0.5744997
#> 25 2.4 0.4952573 0.4877314 0.4213660 0.5499692
#> 26 2.5 0.4762260 0.4691625 0.4037321 0.5270252
#> 27 2.6 0.4584783 0.4518399 0.3898226 0.5059171
#> 28 2.7 0.4418959 0.4356492 0.3768546 0.4863506
#> 29 2.8 0.4263738 0.4204885 0.3606399 0.4678838
#> 30 2.9 0.4118190 0.4062677 0.3492756 0.4506401
#> 31 3.0 0.3981481 0.3929060 0.3387426 0.4346065
#> 
#> $Short
#>      q  observed      mean     lower     upper
#> 1  0.0 3.0000000 2.8600000 2.0000000 3.0000000
#> 2  0.1 2.7003331 2.5649175 2.5915102 2.7512819
#> 3  0.2 2.4405950 2.3117701 2.2576458 2.5275530
#> 4  0.3 2.2146076 2.0934730 1.9571954 2.3260726
#> 5  0.4 2.0172417 1.9042809 1.7171423 2.1444173
#> 6  0.5 1.8442276 1.7395142 1.5055455 1.9804424
#> 7  0.6 1.6920012 1.5953446 1.3657455 1.8322491
#> 8  0.7 1.5575795 1.4686256 1.2674411 1.6981547
#> 9  0.8 1.4384586 1.3567600 1.1966883 1.5766674
#> 10 0.9 1.3325309 1.2575943 1.1214962 1.4664635
#> 11 1.0 1.2380168 1.1693350 1.0505718 1.3663677
#> 12 1.1 1.1534096 1.0904820 0.9778393 1.2753355
#> 13 1.2 1.0774297 1.0197750 0.9071811 1.1924386
#> 14 1.3 1.0089869 0.9561510 0.8467203 1.1168504
#> 15 1.4 0.9471496 0.8987096 0.7970256 1.0478351
#> 16 1.5 0.8911198 0.8466848 0.7515947 0.9847369
#> 17 1.6 0.8402110 0.7994228 0.6950667 0.9269709
#> 18 1.7 0.7938317 0.7563632 0.6624350 0.8740149
#> 19 1.8 0.7514702 0.7170237 0.6327794 0.8254023
#> 20 1.9 0.7126828 0.6809882 0.6053282 0.7807162
#> 21 2.0 0.6770833 0.6478958 0.5798611 0.7395833
#> 22 2.1 0.6443352 0.6174332 0.5454064 0.7016694
#> 23 2.2 0.6141439 0.5893268 0.5230983 0.6666747
#> 24 2.3 0.5862509 0.5633374 0.5023573 0.6343306
#> 25 2.4 0.5604291 0.5392549 0.4830252 0.6043955
#> 26 2.5 0.5364780 0.5168947 0.4649459 0.5766526
#> 27 2.6 0.5142206 0.4960934 0.4445672 0.5509066
#> 28 2.7 0.4934997 0.4767069 0.4251102 0.5269818
#> 29 2.8 0.4741760 0.4586068 0.4101236 0.5047198
#> 30 2.9 0.4561251 0.4416792 0.3966590 0.4839778
#> 31 3.0 0.4392361 0.4258225 0.3819444 0.4644496
#> 
#> attr(,"R")
#> [1] 1000
#> attr(,"conf")
#> [1] 0.95
#> attr(,"parameter")
#> [1] "tsallis"
#> attr(,"ci.type")
#> [1] "bca"

tsallis_profile2_df <- dplyr::bind_rows(tsallis_profile2, .id = "group")

tsallis_points2_df <- tsallis_profile2_df %>%
  filter(q %in% important_q) %>%
  mutate(order_label = factor(q, levels = important_q,
                              labels = important_labels))

ggplot(tsallis_profile2_df, aes(x = q, y = mean,
                                color = group, fill = group)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), alpha = 0.2, color = NA) +
  geom_line(linewidth = 1) +
  geom_vline(xintercept = c(0, 1, 2), linetype = "dashed",
             color = "grey60") +
  geom_point(data = tsallis_points2_df, aes(shape = order_label),
             size = 3, stroke = 1, inherit.aes = TRUE) +
  scale_shape_manual(values = c(17, 18, 15), name = "Important q")  +
  labs(x = "Order (q)", y = "Hill number",
       color = "Group", fill = "Group") +
  theme_bw()


ggplot(tsallis_profile2_df, aes(x = q, y = mean)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), fill = "grey80") +
  geom_line(color = "black", linewidth = 1) +
  facet_wrap(~ group, scales = "free_y") +
  labs(x = "Order (q)", y = "Hill number") +
  theme_bw()