business = c(83, 24245, 49935, (100000000 - 83 - 24245 - 49935))
action = c(114, 24214, 20143, (100000000 - 114 - 24214 - 20143))
business_action = as.data.frame(rbind(business, action))
colnames(business_action) = c("a", "b", "c", "d")
business_action
## a b c d
## business 83 24245 49935 99925737
## action 114 24214 20143 99955529
Load all the libraries or functions that you will use to for the rest of the assignment. It is helpful to define your libraries and functions at the top of a report, so that others can know what they need for the report to compile correctly.
library(Rling)
Calculate the attraction for your bigrams.
attraction = business_action$a / (business_action$a + business_action$c) * 100
attraction
## [1] 0.1659403 0.5627684
Calculate the reliance for your bigrams.
reliance = business_action$a / (business_action$a + business_action$b) * 100
reliance
## [1] 0.3411707 0.4685959
Calculate the LL values for your bigrams.
Exp = (business_action$a + business_action$b) * (business_action$a + business_action$c) /
(business_action$a + business_action$b + business_action$c + business_action$d)
LL = LL.collostr(business_action$a, business_action$b, business_action$c, business_action$d)
LL1 = ifelse(business_action$a < Exp, -LL, LL)
LL1
## [1] 177.3637 499.1375
Calculate the PMI for your bigrams.
PMI = log(business_action$a / Exp)^2
PMI
## [1] 3.68640 9.86739
Calculate the OR for your bigrams.
OR = log(business_action$a * business_action$d / (business_action$b * business_action$c))
OR
## [1] 1.924335 3.151136
Given the statistics you have calculated above, what is the relation of your bigrams? Write a short summary of the results, making sure to answer the following: