Description Usage Arguments Value Examples
Compute the HC stasitic and the HC threshold given a list of P-values.
Can be used with function two.sample.pvals
to
get a list of p-values discriminating each feature
between the two tables.
stbl
– normalize using expeted p-value
(stbl==True) or observed (stbl==False)
alpha
– lower fraction of p-values to use
1 |
pv |
A list of numbers betwee 0 and 1. |
alpha |
A number between 0 and 1. |
stbl |
A boolean. |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | tb1 = table(c(1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,4,5,6,6,7,7,7))
tb2 = table(c(1,1,1,1,1,1,1,1,1,2,3,3,3,3,3,4,4,4,5,5,5,6))
PV = two.sample.pvals(tb1, tb2) # compute P-values
HC.vals(PV$pv) # combine P-values using the HC statistics
# Can be used to check similarity of word-frequencies in texts:
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.