Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CS544 Module 5 Assignment

Initialize the city of Boston earnings dataset as shown below:

boston <- read.csv(


"https://people.bu.edu/kalathur/datasets/bostonCityEarnings.csv",



colClasses = c("character", "character", "character", "integer", "character"))         The data in the file contains the total earnings of the employees of city of Boston.


a) Show the histogram of the employee earnings.  Use breaks from 40000 to 400000 in


mean and standard deviation of this data.  What do you infer from the shape of the



histogram?



b) Draw 5000 samples of this data of size 10, show the histogram of the sample means.

means. Use sample() function with replace as FALSE for drawing the samples. Set the

c) Draw 5000 samples of this data of size 40, show the histogram of the sample means.

means.  Use sample() function with replace as FALSE for drawing the samples. Set the

d) Compare of means and standard deviations of the above three distributions.



Part2) Central Limit Theorem  Negative Binomial distribution (30 points)

Suppose the input data follows the negative binomial distribution with the parameters

 

 

a) Generate 5000 random values from this distribution. Show the barplot with the

b) With samples sizes of 10, 20, 30, and 40, draw 1000 samples from the data

the densities of the sample means. Use a 2 x 2 layout.

sequences generated in b).


 

 

Part3) Sampling (40 points)

Create a subset of the dataset from Part1 with only the top 5 departments based on the

 

 

Use a sample size of 50 for each of the following.

 

a) Show the sample drawn using simple random sampling without replacement. Show

 

 

b) Show the sample drawn using systematic sampling. Show the frequencies for the

 

c) Calculate the inclusion probabilities using the Earnings variable. Using these values,

 

 

 

 

d) Order the data using the Department variable. Draw a stratified sample using

 

 

e) Compare the means of Earnings variable for these four samples against the mean for

 

Submission:

When the term lastName is referenced, please replace it with your last name.

 

Create a folder, CS544_HW5_LastName and place the following files in this folder.              Provide all R code in a single file, CS544_HW5_LastName.R. Clearly mark each subpart of each question.

Provide the corresponding outputs from the R console in a single Word document, CS544_HW5_LastName.doc.

Archive the folder (CS544_HW5_LastName.zip). Upload the zip file to the Assignments section of Blackboard.