Package 'itssl'

Title: Functions For An Internal TSL Statistics Workshop
Description: A set of helpful functions to assist with live coding the presentation of a statistics primer. Also includes some functions and data used in tasks and also provides interactive examples.
Authors: Dan MacLean [cre, aut]
Maintainer: Dan MacLean <[email protected]>
License: file LICENSE
Version: 0.2.0
Built: 2026-06-29 12:23:08 UTC
Source: https://github.com/danmaclean/itssl

Help Index


Hello, World!

Description

Prints 'Hello, world!'.

Usage

hello()

Examples

hello()

Add another line to an existing plot

Description

Add another line to an existing plot

Usage

its_add_line_time(a = 1, b = 0, colour = "dodgerblue")

Arguments

a

the slope of the new line

b

the intercept of the new line

colour

colour of the new line

Value

a ggplot2 geom

Examples

its_axplusb_time() + its_add_line_time(a=4, colour="orange")

Draw a straight line graph

Description

Draw a straight line graph

Usage

its_axplusb_time(xrange = c(-4, 4), yrange = NULL, a = 1, b = 0)

Arguments

xrange

the extent of the x-axis

yrange

the (optional) extent of the y-axis

a

the slope of the line

b

the intercept of the line

Value

a ggplot2 plot

Examples

its_axplusb_time()
its_axplusb_time(xrange = c(-10, 10), a = 4, b = 3)

generate a barplot

Description

generate a barplot

Usage

its_barplot_time(
  df,
  names_to = "group",
  values_to = "value",
  colour = "dodgerblue",
  join_tops = FALSE,
  points = FALSE
)

Arguments

names_to

what to call the variable containing the variable names

values_to

what to call the variable containing the values

colour

colour of the bars

join_tops

add a line joining the tops of bars

points

show individual points (geom_jitter)

Value

ggplot


returns a straight line plot with a bend in it

Description

returns a straight line plot with a bend in it

Usage

its_bendy_line_time()

returns a categoric scatter plot

Description

returns a categoric scatter plot

Usage

its_categoric_scatter_time(
  df,
  names_to = "group",
  values_to = "value",
  colour = "dodgerblue",
  join_tops = FALSE
)

compost data

Description

compost data

Usage

its_compost_time()

food data

Description

food data

Usage

its_food_data_time(n = 20)

hot dog and ice cream box plots

Description

hot dog and ice cream box plots

Usage

its_food_plot_time()

plot interaction in food and condiment

Description

plot interaction in food and condiment

Usage

its_food_two_ways_time()

hr scores table

Description

hr scores table

Usage

its_hr_score_scheme_time()

hr score data

Description

hr score data

Usage

its_hr_scores_time()

example interactions

Description

example interactions

Usage

its_interaction_example_time()

plots of goodness of the mean

Description

plots of goodness of the mean

Usage

its_is_the_mean_a_good_summary_time(n, type = "hist")

Arguments

n

number of points to generate

type

hist or jitter type of plot to return


job data

Description

job data

Usage

its_job_mood_time()

mendel count data

Description

mendel count data

Usage

its_mendel_count_data_time()

mendel data

Description

mendel data

Usage

its_mendel_data_time()

mendel frequency data

Description

mendel frequency data

Usage

its_mendel_frequency_time()

returns a multi categry line plot

Description

returns a multi categry line plot

Usage

its_multi_category_with_lines_time()

plot of the chickwts data

Description

plot of the chickwts data

Usage

its_plot_chickwts_time()

plot xy data

Description

plot xy data

Usage

its_plot_xy_time(df, line = FALSE, residuals = FALSE)

Arguments

df

dataframe with columns x and y

line

draw the computed line

residuals

draw the residuals

Value

ggplot


Generate some x and y data in a dataframe

Description

Generate some x and y data in a dataframe

Usage

its_random_xy_time(n, min = 5, max = 15, mult = 2, seed = "456")

Arguments

n

number of points

min

minimum random value

max

maximum random value

mult

how much bigger on average y is than x

seed

random seed


removes a group from a dataframe

Description

removes a group from a dataframe

Usage

its_remove_a_group_time(df, col = "group", level = "trt2")

tutorial data

Description

tutorial data

Usage

its_small_data_frame_time()

returns a plot summarising hypothesis tests as a figure

Description

returns a plot summarising hypothesis tests as a figure

Usage

its_summary_plot_time()

returns a multidimensional plot

Description

returns a multidimensional plot

Usage

its_three_variable_plot_time()

voter data

Description

voter data

Usage

its_voting_data_time()

returns a long version of a table

Description

returns a long version of a table

Usage

its_wide_to_long_time(df, names_to = "group", values_to = "value")

Potato late blight outbreaks and the weather

Description

For 25 years at Prosser, Washington, whether a potato late blight outbreak occurred, recorded alongside the spring and summer rainfall for that year. The outcome is yes/no (1/0), which makes this a natural example for logistic regression: can we predict an outbreak from the weather?

Usage

potato_blight

Format

A data frame with 25 rows and 6 variables:

year

calendar year

blight

whether a blight outbreak was detected (1 = yes, 0 = no)

rain_spring

number of rainy days in April and May

rain_summer

number of rainy days in July and August

precip_may

precipitation in May on days warmer than 5C (mm)

area

area affected by blight (hectares)

Source

Johnson, D. A., Alldredge, J. R. and Vakoch, D. L. (1996). Potato late blight forecasting models for the semiarid environment of south-central Washington. Phytopathology, 86, 480-484. Obtained via the agridat package (dataset johnson.blight).

Examples

glm(blight ~ rain_spring, data = potato_blight, family = binomial)

Potato cyst-nematode resistance across genotypes and populations

Description

Real data on the number of potato cyst nematode cysts that formed on each of 11 potato genotypes when challenged with each of 5 different nematode populations. Because every genotype meets every population, the data form a genotype-by-population grid – ideal for asking whether resistance depends on which nematode population is doing the attacking (a statistical interaction).

Usage

potato_nematode

Format

A data frame with 55 rows and 3 variables:

genotype

potato genotype (11 levels)

population

potato cyst nematode population (5 levels)

cysts

number of cysts that formed

Source

F. A. van Eeuwijk (1995). Multiplicative Interaction in Generalized Linear Models. Biometrics, 51, 1017-1032. Obtained via the agridat package (dataset vaneeuwijk.nematodes).

References

Arntzen, F. K. and van Eeuwijk, F. A. (1992). Variation in resistance level of potato genotypes and virulence level of potato cyst nematode populations. Euphytica, 62, 135-143.

Examples

lm(cysts ~ genotype + population + genotype:population, data = potato_nematode)

Potato scab infection under sulfur treatments

Description

A small, real field experiment in which sulfur was applied to potato plots, either in autumn ("fall") or spring and at three different rates, alongside an untreated control. Each plot was scored for the percentage of the tuber surface affected by scab. Because the treatment is both a dose (how much sulfur) and a category (when it was applied), this one little dataset can illustrate a straight-line relationship, a two-group comparison and a several-group comparison.

Usage

potato_scab

Format

A data frame with 32 rows and 6 variables:

infection

percentage of the tuber surface affected by scab

sulfur

sulfur dose applied (0 = none, then 3, 6, 12 in the original coded units)

season

when the sulfur was applied: none, fall or spring

treatment

the original treatment code (e.g. F3 = fall, dose 3; O = untreated control)

row

plot row position in the field

col

plot column position in the field

Source

W. G. Cochran and G. M. Cox (1957) Experimental Designs, 2nd ed. John Wiley, New York. Obtained via the agridat package (dataset cochran.crd).

References

Tamura, R. N., Nelson, L. A. and Naderman, G. C. (1988). An investigation of the validity and usefulness of trend analysis for field plot data. Agronomy Journal, 80, 712-718.

Examples

lm(infection ~ sulfur, data = potato_scab)