Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

ECON 327 Assignment 1 Winter Term 1, XXXXXXXXXX Instructions This Assignment 1 has two parts. For Part A, write down your answers on answer sheets. Take pictures of your answer sheets and convert them...

1 answer below »
ECON 327 Assignment 1
Winter Term 1, XXXXXXXXXX
Instructions
This Assignment 1 has two parts.
For Part A, write down your answers on answer sheets. Take pictures of your answe
sheets and convert them into a single PDF file (suggest using CamSanner, see the instruction
on Canvas in the Welcome module). You can also write down your answers in a software
like Microsoft Word, Pages, and LATEX, then generate a single PDF file. Upload this PDF
file to Canvas.
For Part B, it should be completed with R. Write down your answers and codes in a R
Markdown file (.rmd) using the RStudio, then generate a PDF file. Upload the R Markdown
file and the PDF file to Canvas.
Please upload all files to Canvas by Sunday, October 10th (11:59 pm Vancouver Time).
1
Part A [20 points]
Question 1 [5 points]
Suppose you were interested in determining the average monthly expenditures of college
students on video games in Canada.
(a) How would you define the population for this problem?
(b) How would you obtain sample data for this study?
(c) Why would you want to ensure that you survey a random sample of college students?
Question 2 [5 points]
In a recent survey, 12 students at the UBCO were asked approximately how many hours pe
week they spend on the Internet. Their responses were: 13, 0, 5, 8, 22, 7, 3, 0, 15, 12, 13,
and 17.
(a) What are the mean and median for this data? Show your calculation steps.
(b) Is the distribution of these numbers skewed to the right, skewed to the left or symmetric?
Why?
(c) What is the standard deviation for this data? Show your calculation steps.
(d) What is the coefficient of variation for this data? Show your calculation steps.
2
Question 3 [5 points]
Consider the following (x, y) sample data:
x XXXXXXXXXX XXXXXXXXXX
y XXXXXXXXXX XXXXXXXXXX
(a) Calculate the variances s2x and s
2
y and the covariance sxy. Show your calculation steps.
(b) Compute and interpret the sample co
elation coefficient. Show your calculation steps.
Question 4 [5 points]
Firms are increasingly asking applicants to submit to drug tests. Suppose that drug tests
can identify a drug user 98% of the time. However, 1% of the time the test indicates a
positive result although the applicant is not a drug user. If 10% of all applicants are drug
users, what is the probability that a person who has tested positive for drug use is not really
a drug user? [Hint: Define event D = Drug User, event P = Test is positive; Apply the
Bayes’ Theorem]
Next Page Continued...
3
Part B [30 points]
Use the file “BC Covid data.csv” in the “Assignment 1” module on Canvas to complete this
part in R. This data set contains the number of daily reported COVID-19 cases in the BC
y region, including Fraser, Interior, Northern, Vancouver Coastal, and Vancouver Island,
from Jan 1, 2021 to Aug 31, 2021.
(a) Read the file and print the first seven and last seven observations.
(b) Create a new variable named “BC” to show the number of daily reported cases in the
whole BC each day. Print first seven and last seven observations.
(c) Calculate the mean and standard deviation for each region and the whole BC.
(d) Create two Pie Chart diagrams to show each regions’ percentages in Jan 1 and Aug 31.
(e) Create a Line Chart diagram to show each region’s number of daily reported cases during
the sample period. [Hint: five lines in one diagram]
(f) Calculate the total number of reported cases for each region and the whole BC during
the sample period.
(g) Create a Bar Chart to show each region’s total number of reported cases during the
sample period.
(h) Create a Scatter Diagram with Fraser on the vertical axis and Vancouver Coastal on the
horizontal axis.
(i) Calculate the coefficient of co
elation between Fraser and Vancouver Coastal.
(j) What can you conclude from the result in (i) and the diagram in (h)?
4

Date,Fraser,Interior,Northern,Vancouver Coastal,Vancouver Island
XXXXXXXXXX,340,60,89,89,19
XXXXXXXXXX,231,46,35,86,13
XXXXXXXXXX,275,84,27,134,16
XXXXXXXXXX,290,50,49,114,13
XXXXXXXXXX,290,72,33,138,32
XXXXXXXXXX,332,93,67,102,12
XXXXXXXXXX,305,61,48,103,29
XXXXXXXXXX,272,93,38,113,10
XXXXXXXXXX,276,46,80,97,30
XXXXXXXXXX,212,79,57,82,18
XXXXXXXXXX,183,67,46,98,13
XXXXXXXXXX,231,81,43,116,32
XXXXXXXXXX,242,118,52,93,17
XXXXXXXXXX,248,88,41,106,13
XXXXXXXXXX,231,125,77,105,34
XXXXXXXXXX,209,70,63,101,17
XXXXXXXXXX,137,58,34,70,16
XXXXXXXXXX,202,58,23,72,24
XXXXXXXXXX,217,94,39,136,25
XXXXXXXXXX,242,92,72,107,45
XXXXXXXXXX,256,73,57,122,13
XXXXXXXXXX,199,103,39,115,28
XXXXXXXXXX,204,87,42,138,23
XXXXXXXXXX,188,52,32,68,19
XXXXXXXXXX,139,51,19,107,18
XXXXXXXXXX,198,104,35,155,45
XXXXXXXXXX,229,55,53,133,30
XXXXXXXXXX,216,66,53,157,30
XXXXXXXXXX,191,59,36,112,20
XXXXXXXXXX,193,96,36,122,31
XXXXXXXXXX,132,43,32,58,30
XXXXXXXXXX,187,48,29,104,29
XXXXXXXXXX,182,61,31,105,23
XXXXXXXXXX,226,60,60,97,29
XXXXXXXXXX,207,59,70,111,28
XXXXXXXXXX,196,85,27,98,38
XXXXXXXXXX,235,51,75,98,23
XXXXXXXXXX,191,23,34,73,25
XXXXXXXXXX,216,46,28,79,24
XXXXXXXXXX,247,47,52,103,25
XXXXXXXXXX,238,52,41,100,16
XXXXXXXXXX,224,40,23,131,15
XXXXXXXXXX,232,42,63,97,17
XXXXXXXXXX,238,35,47,112,15
XXXXXXXXXX,209,12,27,99,13
XXXXXXXXXX,196,15,10,81,20
XXXXXXXXXX,196,39,15,121,20
XXXXXXXXXX,342,18,95,140,21
XXXXXXXXXX,289,61,37,125,19
XXXXXXXXXX,283,21,49,130,46
XXXXXXXXXX,276,19,33,133,30
XXXXXXXXXX,278,28,26,97,25
XXXXXXXXXX,245,40,54,121,38
XXXXXXXXXX,287,33,28,136,35
XXXXXXXXXX,262,24,40,137,43
XXXXXXXXXX,346,50,31,135,31
XXXXXXXXXX,287,30,57,105,37
XXXXXXXXXX,299,25,38,104,27
XXXXXXXXXX,269,23,22,112,24
XXXXXXXXXX,260,15,20,139,23
XXXXXXXXXX,298,47,49,135,28
XXXXXXXXXX,289,28,43,167,36
XXXXXXXXXX,355,37,57,151,26
XXXXXXXXXX,280,34,61,144,28
XXXXXXXXXX,309,31,34,153,29
XXXXXXXXXX,265,18,5,98,13
XXXXXXXXXX,266,30,52,141,8
XXXXXXXXXX,293,39,31,146,19
XXXXXXXXXX,322,24,61,131,42
XXXXXXXXXX,369,45,58,153,34
XXXXXXXXXX,299,28,44,141,38
XXXXXXXXXX,311,28,35,132,19
XXXXXXXXXX,262,22,58,121,20
XXXXXXXXXX,281,15,25,138,23
XXXXXXXXXX,306,30,34,128,13
XXXXXXXXXX,303,30,56,175,33
XXXXXXXXXX,425,33,67,174,36
XXXXXXXXXX,294,23,60,172,28
XXXXXXXXXX,356,29,58,151,19
XXXXXXXXXX,408,36,30,152,33
XXXXXXXXXX,294,34,20,216,19
XXXXXXXXXX,377,35,45,237,26
XXXXXXXXXX,391,48,62,263,40
XXXXXXXXXX,487,48,92,304,57
XXXXXXXXXX,430,67,47,279,62
XXXXXXXXXX,443,43,34,278,28
XXXXXXXXXX,414,52,39,247,50
XXXXXXXXXX,383,58,32,266,45
XXXXXXXXXX,475,64,52,378,53
XXXXXXXXXX,403,60,50,310,57
XXXXXXXXXX,480,86,66,365,76
XXXXXXXXXX,581,80,40,338,66
XXXXXXXXXX,526,71,61,312,57
XXXXXXXXXX,477,63,39,285,48
XXXXXXXXXX,451,91,33,300,53
XXXXXXXXXX,470,100,34,367,65
XXXXXXXXXX,669,101,55,423,66
XXXXXXXXXX,623,109,67,367,52
XXXXXXXXXX,765,99,62,294,80
XXXXXXXXXX,617,125,24,251,46
XXXXXXXXXX,650,93,36,210,51
XXXXXXXXXX,523,86,30,261,40
XXXXXXXXXX,544,89,46,274,51
XXXXXXXXXX,733,91,57,300,43
XXXXXXXXXX,518,93,35,238,45
XXXXXXXXXX,667,102,19,269,29
XXXXXXXXXX,604,63,37,220,42
XXXXXXXXXX,627,68,46,243,35
XXXXXXXXXX,421,40,31,226,28
XXXXXXXXXX,591,90,23,199,26
XXXXXXXXXX,575,74,49,221,41
XXXXXXXXXX,653,71,37,227,24
XXXXXXXXXX,563,81,32,179,36
XXXXXXXXXX,611,80,17,133,31
XXXXXXXXXX,484,59,48,156,17
XXXXXXXXXX,515,68,12,153,27
XXXXXXXXXX,512,69,23,158,35
XXXXXXXXXX,585,51,23,182,30
XXXXXXXXXX,457,73,26,159,31
XXXXXXXXXX,606,63,15,182,26
XXXXXXXXXX,490,33,22,123,21
XXXXXXXXXX,434,35,22,139,15
XXXXXXXXXX,372,36,11,132,17
XXXXXXXXXX,410,61,13,126,20
XXXXXXXXXX,474,45,29,147,16
XXXXXXXXXX,452,41,19,121,17
XXXXXXXXXX,430,48,18,98,23
XXXXXXXXXX,408,58,25,115,17
XXXXXXXXXX,410,39,10,97,13
XXXXXXXXXX,300,60,17,127,12
XXXXXXXXXX,372,42,6,144,10
XXXXXXXXXX,376,61,18,129,19
XXXXXXXXXX,309,32,22,109,8
XXXXXXXXXX,282,41,15,96,18
XXXXXXXXXX,307,52,13,105,8
XXXXXXXXXX,301,40,18,69,13
XXXXXXXXXX,249,55,8,74,11
XXXXXXXXXX,336,67,30,73,17
XXXXXXXXXX,226,35,23,79,11
XXXXXXXXXX,248,59,32,87,7
XXXXXXXXXX,207,43,20,68,16
XXXXXXXXXX,210,37,17,66,4
XXXXXXXXXX,190,37,8,60,7
XXXXXXXXXX,156,30,4,57,5
XXXXXXXXXX,126,41,10,68,9
XXXXXXXXXX,196,71,18,94,13
XXXXXXXXXX,163,62,16,71,3
XXXXXXXXXX,130,38,16,56,11
XXXXXXXXXX,159,37,13,31,5
XXXXXXXXXX,110,38,10,59,1
XXXXXXXXXX,100,11,2,41,0
XXXXXXXXXX,119,34,4,39,2
XXXXXXXXXX,96,33,6,62,2
XXXXXXXXXX,100,29,7,39,3
XXXXXXXXXX,125,59,7,35,1
XXXXXXXXXX,83,30,1,19,5
XXXXXXXXXX,87,17,9,18,3
XXXXXXXXXX,71,36,7,29,11
XXXXXXXXXX,86,32,7,31,13
XXXXXXXXXX,75,41,9,20,11
XXXXXXXXXX,69,31,10,27,8
XXXXXXXXXX,45,29,15,16,4
XXXXXXXXXX,66,25,3,19,5
XXXXXXXXXX,41,16,0,12,2
XXXXXXXXXX,49,23,1,29,4
XXXXXXXXXX,56,32,0,16,5
XXXXXXXXXX,52,38,4,26,4
XXXXXXXXXX,65,24,6,16,4
XXXXXXXXXX,37,20,9,23,1
XXXXXXXXXX,43,29,2,14,2
XXXXXXXXXX,16,14,1,12,2
XXXXXXXXXX,15,23,4,11,4
XXXXXXXXXX,50,16,0,13,4
XXXXXXXXXX,43,11,2,14,4
XXXXXXXXXX,34,10,1,14,4
XXXXXXXXXX,30,13,0,9,2
XXXXXXXXXX,25,14,0,13,0
XXXXXXXXXX,19,12,0,7,1
XXXXXXXXXX,9,13,1,6,3
XXXXXXXXXX,22,12,1,10,1
XXXXXXXXXX,18,24,2,4,0
XXXXXXXXXX,16,6,0,10,0
XXXXXXXXXX,11,14,2,3,1
XXXXXXXXXX,13,21,0,3,0
XXXXXXXXXX,13,9,0,1,1
XXXXXXXXXX,17,13,2,12,0
XXXXXXXXXX,13,15,0,15,2
XXXXXXXXXX,22,22,1,8,7
XXXXXXXXXX,16,16,1,12,6
XXXXXXXXXX,16,14,0,16,5
XXXXXXXXXX,17,15,0,6,0
XXXXXXXXXX,6,10,0,13,0
XXXXXXXXXX,15,13,0,13,1
XXXXXXXXXX,11,13,1,5,1
XXXXXXXXXX,22,18,1,9,6
XXXXXXXXXX,14,22,1,8,2
XXXXXXXXXX,19,21,0,12,2
XXXXXXXXXX,26,27,3,7,1
XXXXXXXXXX,24,12,0,11,1
XXXXXXXXXX,14,33,2,12,4
XXXXXXXXXX,24,32,0,22,1
XXXXXXXXXX,34,39,1,19,4
XXXXXXXXXX,25,69,4,9,6
XXXXXXXXXX,15,46,1,23,5
XXXXXXXXXX,12,57
Answered Same Day Oct 10, 2021

Solution

Suraj answered on Oct 10 2021
143 Votes
getwd()
setwd("C:/Users/Hp/Desktop")
#a
df<-read.csv("data.csv")
head(df,7)
tail(df,7)
#
df["BC"]<-df$Fraser+df$Interior+df$Northern+df$Vancouver.Coastal+df$Vancouver.Island
head(df["BC"],7)
tail(df["BC"],7)
#C
su
-subset(df,select = -c(ï..Date))
avg<-sapply(sub,mean)
avg
sd<-sapply(sub,sd)
sd
#d
li
ary(ggplot2)
df$ï..Date <- as.Date(df$ï..Date)
df_new<-with(df, df[(ï..Date >= "2021-01-01" & ï..Date < "2021-01-02"), ])
df_new<-subset(df_new,select=-c(ï..Date))
x<-df_new[1,]
list(x)
cases<-c(340,60,89,89,19,597)
egion<-c("Fraser","Interior","Northern","Vancouver.Coastal","Vancouver.Island","BC")
df1= data.frame(region,cases)
pie = ggplot(df1, aes(x="", y=cases, fill=region)) + geom_bar(stat="identity", width=1)
pie = pie + coord_polar("y",...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here