Type: Package
Title: Generating Bootstrap Estimation Distributions of HR Data
Version: 0.3.2
Description: Creates plots showing scored HR experiments and plots of distribution of means of ranks of HR score from bootstrapping. Authors (2019) <doi:10.5281/zenodo.3374507>.
License: MIT + file LICENSE
Encoding: UTF-8
Imports: dplyr, ggplot2, ggridges, magrittr, patchwork, rlang, stringr, tibble
RoxygenNote: 7.1.2
Suggests: knitr, rmarkdown, readr
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2023-04-14 05:47:55 UTC; taz23vul
Author: Dan MacLean [aut, cre]
Maintainer: Dan MacLean <dan.maclean@tsl.ac.uk>
Repository: CRAN
Date/Publication: 2023-04-14 08:50:08 UTC

Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Value

result of previous expression


calculate ranks of a score column and adds result to a dataframe

Description

add_rank returns a copy of the passed data frame containing a new column called rank which has the ranks of the named score column

Usage

add_rank(df, quo_score_col)

Arguments

df

data frame

quo_score_col

quoted score column name


runs bootstrapping of ranks

Description

boostrap_dist runs multiple bootstrap resamplings using bstrap_sample to generate a data frame of bootstrap rank means of per group scores

Usage

bootstrap_dist(df, quo_score_col, quo_group_col, nits = 10, control = "A")

Arguments

df

input data frame

quo_score_col

quoted column name containing the HR scores

quo_group_col

quoted group name containing the group column

nits

number of bootstrap iterations to do

control

character naming the control group that will be removed prior to bootstrapping


resamples a rank column in a dataframe based on groups

Description

bstrap_sample performs a single iteration of bootstrapping of a rank column in a data frame. The rows matching control in the quoted quo_group_col column are removed. The remaining rows are grouped by quo_group_col and in each group the rank column is resampled with replacement and the mean rank of the resampling for each group is returned

Usage

bstrap_sample(iteration, quo_score_col, quo_group_col, df, control = "A")

Arguments

iteration

integer giving the current bootstrap iteration from the calling function

quo_score_col

quoted column name containing the HR scores

quo_group_col

quoted group name containing the group name of the observation

df

input data frame

control

character naming the control group that will be removed prior to bootstrapping


gets confidence interval limits for means of bootstrapped ranks

Description

conf_intervals calculates a low and a high quantile for the mean column of each group of a dataframe

Usage

conf_intervals(df, quo_group_col, low = 0.05, high = 0.95)

Arguments

df

input data frame

quo_group_col

quoted group name containing the column to group on

low

the low probability value of the quantile

high

the high probability value of the quantile


dot plot of ranked data without technical replicates

Description

dot_plot returns a ggplot object of ranked data with group on the x-axis and rank on the y-axis. Point size indicates the number of observations seen at that point. A per group horizontal line shows the group ranked mean

Usage

dot_plot(hrest, group_col)

Arguments

hrest

the hrest object from estimate

group_col

quoted group column name


Perform bootstrap estimation of confidence intervals of ranked HR scores

Description

estimate carries out estimation of bootstrap confidence intervals on ranked score data. Returns a hrest object of the result Proceeeds by calculating score ranks, then bootstrapping ranks in non-control groups retaining the mean for each bootstrap iteration. Calculates low and high quantiles of bootstrap mean distributions for each group. If technical replicates are provided in a second grouping column these will be averaged before proceeding.

Usage

estimate(df, ..., control = "A", nits = 100, low = 0.025, high = 0.975)

Arguments

df

data frame of score and group data. Contains minimally a score and group column

...

bare names of columns to use, minimally the score column and the group column in that order. Optionally a third technical replicate column can be provided

control

the value of the grouping column taken to be the control group

nits

the number of bootstap iterations to be done

low

the low probability value of the quantile

high

the high probability value of the quantile

Value

a list object of class "hrest"

Examples


 d1 <- make_data()
 estimate(d1, score, group)

 d2 <- make_data2()
 estimate(d2, score_column_name, sample_column_name, rep_column_name )


 d3 <- make_data3()
 estimate(d3, score, sample, rep, nits = 1000)


Convert named columns to factors

Description

factorise_cols returns a copy of the passed data frame in which all explicitly named columns are converted to factors with as.factor All columns with only NA values are ommitted.

Usage

factorise_cols(df, col_list)

Arguments

df

data frame

col_list

vector of quoted column names


Get mean rank of groups in a data frame

Description

group_means groups the provided dataframe by a column and returns a summary dataframe with a mean column containing the mean of the group's rank column

Usage

group_means(df, quo_group_col)

Arguments

df

input data frame

quo_group_col

quoted group name containing the column to group on


Get number of observations in a group in a data frame

Description

group_ns groups the provided dataframe by a column and returns a summary dataframe with an column n containg the number of observations in a group

Usage

group_ns(df, quo_group_col)

Arguments

df

input data frame

quo_group_col

quoted group name containing the column to group on


return a sample data set of random values for two groups

Description

return a sample data set of random values for two groups

Usage

make_data()

Value

tibble of random values for two groups

Examples


 d1 <- make_data()


return a sample data set of random values for two groups with three technical reps per group

Description

return a sample data set of random values for two groups with three technical reps per group

Usage

make_data2()

Value

tibble of random values for two groups with three technical reps per group

Examples


 d2 <- make_data2()


return a sample data set of random values for three groups with three technical reps per group

Description

@examples

Usage

make_data3()

Details

d3 <- make_data3()

Value

tibble of random values for three groups with three technical reps per group


plots the hrest object

Description

returns a ggplot object representing the hrest object from estimate. The content of left panel varies according to the value of the which parameter. If which = "rank_simulation" is used a plot of rank score values will be plotted in the left panel. In this case technical replicates will be averaged if provided. If which = "just_data" a plot of scores only is created and technical replicates are displayed as is. In each case, the right hand panel shows the rank bootstrap distribution and confidence interval boundaries for all non- control groups.

Usage

## S3 method for class 'hrest'
plot(x, ..., which = "rank_simulation")

Arguments

x

the hrest object from estimate

...

Other parameters

which

the type of left hand panel to create. Either "rank_simulation" or "just_data"

Value

ggplot object

Examples


 d1 <- make_data()
 hr_est <- estimate(d1, score, group)
 plot(hr_est)


print a summary of the hrest object

Description

print a summary of the hrest object

Usage

## S3 method for class 'hrest'
print(x, ...)

Arguments

x

hrest object

...

other parameters

Value

null

Examples


 d1 <- make_data()
 hr_est <- estimate(d1, score, group)
 print(hr_est)


dot plot of score data with technical replicates

Description

tech_rep_dot_plot returns a ggplot object of score data with group on technical replicate on the x-axis, score on the y-axis with point size representing the number of observations at that point. Facets represent individual groups

Usage

tech_rep_dot_plot(hrest, score_col, group_col, tech_rep_col)

Arguments

hrest

the hrest object from estimate

score_col

quoted score column name

group_col

quoted group column name

tech_rep_col

quoted tech replicate column name