Computes the unpaired tests on difference in weight per catch category
f_test_unpaired(weight_species, sp, cat)data.frame. The summary table of the statistical tests
# Setup OTB input data
OTB_data_folder <-
system.file("script_origin", "Data", "Example_OTB_alternate", package = "inser")
TR <- readr::read_delim(
file = file.path(OTB_data_folder, "TR.csv"),
delim = ";",
escape_double = FALSE,
locale = readr::locale(encoding = "WINDOWS-1252"),
trim_ws = TRUE
)
#> Rows: 2 Columns: 31
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ";"
#> chr (12): sampling_type, landing_country, vessel_flag_country, project, harb...
#> dbl (11): trip_code, year, vessel_length, vessel_power, vessel_size, vessel_...
#> lgl (8): number_of_sets, days_at_sea, departure_date_time, return_date_time...
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
HH <-
read.table(
file.path(OTB_data_folder, "HH.csv"),
sep = ";",
header = TRUE,
encoding = "WINDOWS-1252"
)#,colClasses = colClasses)
SL <-
read.table(
file.path(OTB_data_folder, "SL.csv"),
sep = ";",
header = TRUE,
encoding = "WINDOWS-1252"
)
HL <-
read.table(
file.path(OTB_data_folder, "HL.csv"),
sep = ";",
header = TRUE,
encoding = "WINDOWS-1252"
)
colClasses <- rep(NA, ncol(HH))
colClasses[which(names(HH) == "statistical_rectangle")] <-
"character"
HH <-
read.table(
file.path(OTB_data_folder, "HH.csv"),
sep = ";",
header = TRUE,
colClasses = colClasses,
encoding = "WINDOWS-1252"
)
# create TAB output
data <- prep_sel_data(data = list(TR, HH, SL, HL))
# weight for each species
weight_species <-
data %>% dplyr::group_by(
project,
vessel_identifier,
trip_code,
station_number,
gear_label,
catch_category,
species
) %>%
dplyr::summarize(weight = sum(weight) * 10 ^ (-3)) %>% as.data.frame()
#> `summarise()` has grouped output by 'project', 'vessel_identifier',
#> 'trip_code', 'station_number', 'gear_label', 'catch_category'. You can override
#> using the `.groups` argument.
weight_species <-
as.data.frame(
tidyr::complete(
weight_species,
tidyr::nesting(project, vessel_identifier, trip_code, station_number),
gear_label,
catch_category,
species,
fill = list(weight = 0)
)
)
# run f_test_unpaired
f_test_unpaired(weight_species = weight_species,
sp = "Solea solea",
cat = "LAN")
#> pvalue moyenne mediane test Taux_Var_Tot
#> 1 0.7052 -50.55715 0 Kolmogorov -82.21