Create the Data

business = c(83, 24245, 49935, (100000000 - 83 - 24245 - 49935))
company = c(96, 25668, 24309, (100000000 -96  - 25668 -24309 ))
business_company = as.data.frame(rbind(business, company))
colnames(business_company) = c("a", "b", "c", "d")
business_company
##           a     b     c        d
## business 83 24245 49935 99925737
## company  96 25668 24309 99949927

Load the Libraries + Functions

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.

#install.packages("/Users/juliaye/Downloads/Rling_1.0 (1).tar.gz", repos = NULL, type = "source")
library(Rling)

Attraction and Reliance

Calculate the attraction for your bigrams.

attraction= business_company$a/(business_company$a+business_company$c)*100
attraction
## [1] 0.1659403 0.3933620

Calculate the reliance for your bigrams.

reliance=business_company$a/(business_company$a+business_company$b)*100
reliance
## [1] 0.3411707 0.3726129

Log Likelihood

Calculate the LL values for your bigrams.

aExp=(business_company$a+business_company$b)*(business_company$a+business_company$c)/(business_company$a+business_company$b+business_company$c+business_company$d)

LL= LL.collostr(business_company$a,business_company$b,business_company$c,business_company$d)
LL1=ifelse(business_company$a <aExp, -LL,LL)
LL1
## [1] 177.3637 344.5630

Pointwise Mutual Information

Calculate the PMI for your bigrams.

PMI=log(business_company$a/aExp)^2
PMI
## [1] 3.686400 7.429725

Odds Ratio

Calculate the OR for your bigrams.

logOR=log(business_company$a*business_company$d/(business_company$b*business_company$c))
logOR
## [1] 1.924335 2.732926

Interpret your results

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: