Learn R Programming

stoRy (version 0.1.1)

TEA: Theme enrichment analysis (TEA).

Description

TEA calculates enrichment scores for themes in a storset relative to a background set of stories according to the hypergeometric test.

Usage

TEA(mystorysets, test_storysets = mystorysets$names,
  background_storyset = c("tos", "tas", "tng"), theme_levels = c("central",
  "peripheral"), min_storyset_size = 5, min_theme_occurrence = 1)

Arguments

mystorysets

A storysets class object that contains one or many individual storysets.

test_storysets

The storyset names to be analysed. The default mystorysets$names is to analyse all storysets.

background_storyset

default c("tos", "tas", "tng"). A string indicating the storyset to use as background. Possible values are tos, tas, tng and their combinations.

theme_levels

c("central", "peripheral"). A string indicating the theme levels to use in the analysis. Possible values are central and/or peripheral.

min_storyset_size

default 5. The minimum allowable size for a storyset. For small samples the hypergeometric test may be unreliable.

min_theme_occurrence

default 1. The minimum number of times a theme must occur in a storyset. For small samples the hypergeometric test may be unreliable.

Value

Returns a data frame where each row corresponds to a theme. The column Pvalue contains raw enrichment scores, i.e., hypergeometric test P-values.

Examples

Run this code
# NOT RUN {
#######################################################################
# Load the Star Trek series storysets smt file and storysets object   #
#######################################################################
file <- system.file("storysets", "series.smt", package = "stoRy")
mystorysets <- storysets$new(file)
print(mystorysets)

#######################################################################
# Perform the theme enrichment analysis for each of TOS, TAS, and TNG #
# relative to default TOS/TAS/TNG background                          #
#######################################################################
results <- TEA(mystorysets)

#######################################################################
# Output top twenty enriched TOS themes                               #
#######################################################################
results$TOS[1:20,]

#######################################################################
# Output top ten enriched TAS themes                                  #
#######################################################################
results$TAS[1:10,]

#######################################################################
# Output top twenty enriched TNG themes                               #
#######################################################################
results$TNG[1:20,]
# }

Run the code above in your browser using DataLab