Introduction

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.

Import the Data

Import the included dataset BNC_wordfreq.csv. This file contains the compiled word frequencies for the British National Corpus.

Dataset:

Continuous Data Analysis

Continuous Basic Statistics

Calculate the following statistics on the word frequencies from the BNC data:

  • Dispersion: min/max, 1st/3rd quantile, standard deviation
  • Location: mean, median, mode

Summary Stats:

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     800    1282    2335   13567    6050 6187267

Mode:

## [1] 822

Standard deviation:

## [1] 123948.4

Interpretation of the Frequency Data

Using your results from above, answer the following:

  • What does the dispersion of the data look like? How much does the data span from minimum to maximum, 1st-3rd quartile, etc. In this question, look at the dispersion statistics and explain what they mean to naive audience.
    • The data seems to be extremely dispersed. The most frequently occuring word, “the” appears more than six million times, while the least frequently occuring words, “wildly”, “reformer”, “quantum”, and “considering” appear just 800 times. The first quartile for frequency is 1,282, which means that 75% of the words in the dataset have a frequency greater than 1,282. The third quartile for frequency is 6,050, which means that 25% of the words in the dataset have a frequency greater than 6,050. The standard deviation of above 120,000 indicates how spread out the frequencies are.
  • What do the mean, median, and mode tell us about the use of words in the English Language? How frequent are words in general (mean/median), and what is the most common frequency in the data?
    • The mean tells us the average of the frequency of all the words in the dataset. The mean or average frequency of this dataset is 13,567, which is much greater than the third quartile, which clearly indicates that the distribution of frequencies is extremely right skewed.
    • If the words are sorted in order of their increasing or decreasing frequencies, the frequency corresponding to the word in the middle is the median. In other words, it is the 2nd quartile, where 50% of the words have lower frequency than this frequency and 50% of the words have higher frequency than this frequency. The median frequency for this dataset is 2,335. This is much lesser than the mean, again indicating that the distribution of frequencies is right skewed.
    • The most common frequency in the dataset, that is the specific frequency corresponding to the most number of words is 822.
    • All this tells us that while an overwhelming majority of the words are used not so freqeuntly, there are a fair number of words that are used extensively.
  • In looking at the pictures of the frequency data, does word frequency appear to be normally distributed (explain, not just yes/no)?
    • Firstly, from the histogram, density plot, and Q-Q plot it is clear that the distribution is extremely right skewed.
    • Secondly, the mean being greater than the 3rd quartile indicates how extremely right skewed and non-normal the distribution is.
  • Does the frequency in the BNC follow Zipf’s Law (explain, not just yes/no)?
    • Zipf’s law states that the word frequency is inversely related to its frequency rank. This implies that the first word is twice as likely as the second word, three times as likely as the third word, and so on.
    • From the plot for Zipf’s law using all the words, the curve seems like a power curve, but it is difficult to decide due to the large number of indices (words).
    • Inspecting just the top 100 most frequenctly used words, we see a clear power curve. Therefore, we can conclude that the distrbution of frequencies in BNC follows Zipf’s law.

Categorical Data Analysis

Categorical Basic Statistics

Included in the BNC frequency data is the part of speech of each word. Create a summary of the types of parts of speech.

A = Adjective, Adv = Adverb, Conj = Conjunction, Det = Determinant, N = Noun, Prep = Preposition, Pron = Pronoun, V = Verb

Word Count for parts of speech:

##                 a               adv              conj               det 
##              1124               427                34                47 
## infinitive-marker      interjection             modal                 n 
##                 1                13                12              3262 
##              prep              pron                 v 
##                71                46              1281

Categorical Dispersion

The nouns shaving and descriptor have very similar frequencies in the Corpus of Contemporary American English (COCA), namely, 513 and 515. Do you think these words are equally spread across writing types? Use the information below (and the function from class) to calculate their deviations.

Overall Proportion table for COCA categories:

##    Spoken   Fiction  Academic     Press 
## 0.2055636 0.1946987 0.1962086 0.4035291

Proportion table for the word, “shaving”:

##     Spoken    Fiction   Academic      Press 
## 0.04873294 0.34113060 0.07797271 0.53216374

Proportion table for the word, “descriptor”:

##     Spoken    Fiction   Academic      Press 
## 0.01165049 0.01359223 0.89708738 0.07766990

Proportion deviation for the word, “shaving”:

## [1] 0.3415698

Proportion deviation for the word, “descriptor”:

## [1] 0.8703311

Inter-proportion deviation between the words, “shaving” and “descriptor”:

## [1] 0.8287702

The inter proportion deviation is close to 1. Hence these words are not equally spread across writing types.

Interpretation of the Categorical Data

Using your results from above, answer the following:

  • What are the most frequent parts of speech by type (i.e., we are only considering each word individually, not the frequency of the words as well)?
    • The most frequent 5 parts of speech along with the number of words that used this part are below:
      • Noun: 3,262
      • Verb: 1,281
      • Adjective: 1,124
      • Adverb: 427
      • Preposition: 71
  • What are the least frequent parts of speech by type?
    • The least frequent 5 parts of speech along with the number of words that used this part are below:
      • Infinitive-marker: 1
      • Modal: 12
      • Interjection: 13
      • Conjunction: 34
      • Pronoun: 46
  • Was shaving or descriptor more “dispersed” throughout the texts? Remember, that values close to zero mean that the concept is represented evenly across corpora, while values closer to one are more likely to appear in one corpus over another.
    • The word, “shaving” with a lower proportion deviation (closer to zero) is more evenly represented across corpora. The word is well represented in fiction and press, albeit being under-represented in spoken and academic texts.
    • The word, “descriptor” has a higher proportion deviation (closer to one). It is extremely likely to appear in academic text, as one would expect, but is under-represented in press, spoken, and academic texts.