two.sample.HC: Higher Criticism (HC) Test Between two Tables

Description Usage Arguments Value Examples

View source: R/TableHC.R

Description

Compute HC stasitic directly from two one-way contingency tables. stbl – normalize using expeted p-value (stbl==True) or observed (stbl==False) alpha – lower fraction of p-values to use

Usage

1
two.sample.HC(tb1, tb2, alpha = 0.45, stbl = TRUE)

Arguments

tb1

A one-way table with integer counts.

tb2

A one-way table with integer counts.

alpha

A number between 0 and 1.

stbl

A boolean.

Value

A list containing the following fields: HC – Higher Critcism (HC) score HC.star – HC score corrected to finite sample p – p-value attaining HC p.star – p-value attaining HC.star

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
text1 = "On the day House Democrats opened an impeachment inquiry of 
President Trump last week, Pete Buttigieg was being grilled by Iowa
voters on other subjects: how to loosen the grip of the rich on government, 
how to restore science to policymaking, how to reduce child poverty. At an
event in eastern Iowa, a woman rose to say that her four adult children
were `stuck' in life, unable to afford what she had in the 1980s when a 
$10-an-hour job paid for rent, utilities and an annual vacation."

text2 = "How can the federal government help our young people that want to
do whats right and to get to those things that their parents worked so hard
for? the voter asked. This is the conversation Mr. Buttigieg wants to have. 
Boasting a huge financial war chest but struggling in the polls, Mr.
Buttigieg is now staking his presidential candidacy on Iowa, and particularly
on connecting with rural white voters who want to talk about personal
concerns more than impeachment. In doing so, Mr. Buttigieg is also trying to
show how Democrats can win back counties that flipped from Barack Obama to 
Donald Trump in 2016 — there are more of them in Iowa than any other state — 
by focusing, he said, on “the things that are going to affect folks’ lives in
a concrete way."

tb1 = table(strsplit(tolower(text1),' '))
tb2 = table(strsplit(tolower(text2),' '))
pv = two.sample.pvals(tb1,tb2)
HC.vals(pv$pv)

TableHC documentation built on March 26, 2020, 7:11 p.m.