ThermalSampleR_User_Manual.md

ThermalSampleR User Guide

Last updated 21/11/2020

DOCUMENT CONTENTS

  1. Installation
  2. Uploading Data
  3. Worked Example
  4. Bootstrap one group
  5. Plot results for one group
  6. Bootstrap two groups
  7. Plot results for two groups
  8. Perform a Test of Total Equivalence

Installation and Usage

Install the ThermalSampleR package in R via GitHub using this line of code:

devtools::install_github("CJMvS/ThermalSampleR")

Or access the GUI Shiny App version via either the online platform:

https://clarkevansteenderen.shinyapps.io/ThermalSampleR_Shiny/

Or GitHub through the R console:

library(shiny) shiny::runUrl("https://github.com/CJMvS/ThermalSampleR_Shiny/archive/main.tar.gz")

Uploading Data

Input files must be saved in .csv format, with two columns: one for the sample group, and one for the response (e.g. Critical Thermal Limit temperature data). For example:

| Group | CTL_min | | --------- | :------: | | Species A | 5 | | Species A | 6 | | Species B | 4 | | Species B | 3 | | Species C | 4 | | Species C | 6 |

Worked Example

ThermalSampleR comes with an example data sheet, named “coreid_data”. The following worked example will use this as input.

library(ThermalSampleR)
coreid = ThermalSampleR::coreid_data
# if reading a local Excel .csv file, use read.csv("file_path/file_name.csv")
head(coreid)
##                          col response
## 1 Catorhintha schaffneri_APM        5
## 2 Catorhintha schaffneri_APM        5
## 3 Catorhintha schaffneri_APM        5
## 4 Catorhintha schaffneri_APM        4
## 5 Catorhintha schaffneri_APM        4
## 6 Catorhintha schaffneri_APM        4

Bootstrap one group

Here we use the coreid data to bootstrap for one of the two groups; Catorhintha schaffneri adults (APM). We’ll set it to extrapolate to a maximum sample size of 49, and to run 29 iterations.

bt_one = boot_one(data = coreid_data, groups_col = col, groups_which = "Catorhintha schaffneri_APM", response = response, n_max = 49, iter = 29)

Plot results for one group

plot_one_group(x = bt_one, n_min = 3, n_max = 15, colour_exp = "forestgreen", colour_extrap = "orange", legend.position = "right", alpha_val = 0.25)

:bulb: The alpha value changes the degree of shading on the graph.

Bootstrap two groups

Here we bootstrap for both groups (Catorhintha schaffneri adults (APM) and larvae (NPM)), applying 29 iterations.

bt_two <- boot_two(data = coreid_data, groups_col = col, response = response, group1 = "Catorhintha schaffneri_APM", group2 = "Catorhintha schaffneri_NPM", n_max = 49, iter = 29)

Plot results for two group

plot_two_groups(x = bt_two, n_min = 3, n_max = 30, colour_exp = "blue", colour_extrap = "red", legend.position = "right", alpha_val = 0.25)

Save the bootstrapped data table

Use the write.csv() function to save the results of the bootstrapping analysis to a desired directory. For example: write.csv(bt_one, "C:/file_path/bt_one_results.csv")

Perform a Test of Total Equivalence

This function performs a Test of Total Equivalence using the approach by Duffy et al. (2021).

Using the same coreid dataset, the function can be applied as follows:

tte = equiv_tost(data = coreid_data, groups_col = col, groups_which = "Catorhintha schaffneri_APM", response = response, 
                 skews = c(1,10), equiv_margin = 1, pop_n = 5)

tte



CJMvS/ThermalSampleR documentation built on July 9, 2023, 5:06 a.m.