logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Jeremiah BennettComputer science
(5/5)

923 Answers

Hire Me
expert
Gabriel GaboardiLaw
(5/5)

995 Answers

Hire Me
expert
StatAnalytica ExpertData mining
(5/5)

534 Answers

Hire Me
expert
Neha SharmaaStatistics
(5/5)

1156 Answers

Hire Me
R Programming
(5/5)

Draw 100 numbers from a normal distribution with a mean of 7 and standard deviation of 4, and store the output in an object called x1

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

R Problem Set

1. Direction

The problem set is worth 100 points.

Enter your answers in the empty code chunks.

Don’t change anything in the chunk below, and make sure you run it before attempting any of the problems:

library(tidyverse)

library(ggpubr)

set.seed(2018) # Belgium win 3rd place in the World Cup

 

2 Basics

Calculate :

(2+2)*(3(2)+5)/6/4

# your code here______________

Create a vector called “x” with the following values: 10, 15, 18, 20.

# your code here______________

Calculate the mean ( mean() ), median ( median() ) and standard deviation ( sd() ) of x .

# your code here______________

Draw two numbers from a standard normal distribution ( rnorm() ):

# your code here______________

Draw 100 numbers from a normal distribution with a mean of 7 and standard deviation of 4, and store the output in an object called “x1”:

# your code here______________

Draw 100 numbers from a normal distribution with a mean of 5 and standard deviation of 2, and store the output in an object called “x2”:

# your code here______________

Use data.frame() to combine x1 and x2 into a data frame called “df”:

# your code here______________

Use the $ indexing method to calculate: the mean of the first column of df :

# your code here______________

the standard deviation of the second column of df :

# your code here______________

Use head() to print the first 3 rows of df :

# your code here______________

3 dplyr

Let’s work with the data set diamonds :

data(diamonds)

head(diamonds)

Calculate the average price of a diamond:

# your code here______________

Use group_by() to group diamonds by color, then use summarise() to calculate the average price and the standard deviation in price by color:

# your code here______________

Use group_by() to group diamonds by cut, then use summarise() to count the number of observations by cut:

# your code here______________

Use filter() to remove observations with a depth greater than 62, then use group_by() to group diamonds by clarity, then use summarise() to find the maximum price of a diamond by clarity:

# your code here______________

Use mutate() and log() to add a new variable to the data called “log_price”:

# your code here______________

4 ggplot2

Continue using diamonds .

Use geom_histogram() to plot a histogram of prices:

# your code here______________

Use geom_density() to plot the density of log prices (the variable you added to the data frame):

# your code here______________

Use geom_point() to plot carats against log prices (i.e. carats on the x-axis, log prices on the y-axis):

# your code here______________

Use stat_summary() to make a bar plot of average cut: Same as above but change the theme to theme_classic() :

Finally,

create a bar plot for average color and assign it to the object “plot_color”;

create a scatter plot for depth against log pricse (depth on x-axis, log prices on y-axis) and assign it to the object “plot_depth”;

use ggarrange from ggpubr to combine plot_color and plot_depth into a single plot with automatic labels.

5 Inference

Use t.test() to test the following hypothesis on log price:

:=8

:=8

Use lm() to estimate the model

and store the output in an object called “m1”:

# your code here______________

Use summary() to view the output of “m1”:

# your code here______________

Use lm() to estimate the model and store the output in an object called “m2”:

# your code here______________

Use summary() to view the output of “m2”:

# your code here______________

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme