2nd-hw
docx
keyboard_arrow_up
School
The City College of New York, CUNY *
*We aren’t endorsed by this school
Course
215
Subject
Statistics
Date
Feb 20, 2024
Type
docx
Pages
9
Uploaded by AgentRainWombat19
2nd hw
2024-01-10
R Markdown
1.
load your library/liobraries
library
(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2 ## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## Use the conflicted package (<http://conflicted.r-lib.org/>) to ℹ
force all conflicts to become errors
2.load our data
penguins
<- read.csv
(
"https://raw.githubusercontent.com/zeigna/AppliedStatsAnalysi
s/master/penguins.csv"
)
3.
Verify the dataset loaded correctly by displaying the first 8 lines of code
head
(penguins, n =
8
)
## X species island bill_length_mm bill_depth_mm flipper_length_mm
## 1 1 Adelie Torgersen 39.1 18.7 181
## 2 2 Adelie Torgersen 39.5 17.4 186
## 3 3 Adelie Torgersen 40.3 18.0 195
## 4 4 Adelie Torgersen 36.7 19.3 193
## 5 5 Adelie Torgersen 39.3 20.6 190
## 6 6 Adelie Torgersen 38.9 17.8 181
## 7 7 Adelie Torgersen 39.2 19.6 195
## 8 8 Adelie Torgersen 41.1 17.6
182
## body_mass_g sex year
## 1 3750 male 2007
## 2 3800 female 2007
## 3 3250 female 2007
## 4 3450 female 2007
## 5 3650 male 2007
## 6 3625 female 2007
## 7 4675 male 2007
## 8 3200 female 2007
4.
Display the last 5 lines of penguins
tail
(penguins, n =
5
)
## X species island bill_length_mm bill_depth_mm flipper_length_mm
## 329 329 Chinstrap Dream 55.8 19.8 207
## 330 330 Chinstrap Dream 43.5 18.1 202
## 331 331 Chinstrap Dream 49.6 18.2 193
## 332 332 Chinstrap Dream 50.8 19.0 210
## 333 333 Chinstrap Dream 50.2 18.7 198
## body_mass_g sex year
## 329 4000 male 2009
## 330 3400 female 2009
## 331 3775 male 2009
## 332 4100 male 2009
## 333 3775 female 2009
5.
Examine the “structure” of the penguins dataset
str
(penguins)
## 'data.frame': 333 obs. of 9 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ species : chr "Adelie" "Adelie" "Adelie" "Adelie" ...
## $ island : chr "Torgersen" "Torgersen" "Torgersen" "Torgersen" ...
## $ bill_length_mm : num 39.1 39.5 40.3 36.7 39.3 38.9 39.2 41.1 38.6 34.6 ...
## $ bill_depth_mm : num 18.7 17.4 18 19.3 20.6 17.8 19.6 17.6 21.2 21.1 ...
## $ flipper_length_mm: int 181 186 195 193 190 181 195 182 191 198 ...
## $ body_mass_g : int 3750 3800 3250 3450 3650 3625 4675 3200 3800 4400 ...
## $ sex : chr "male" "female" "female" "female" ...
## $ year : int 2007 2007 2007 2007 2007 2007 2007 2007 2007 2007 ...
glimpse
(penguins)
## Rows: 333
## Columns: 9
## $ X <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1…
## $ species <chr> "Adelie", "Adelie", "Adelie", "Adelie", "Adelie", "A…
## $ island <chr> "Torgersen", "Torgersen", "Torgersen", "Torgersen", …
## $ bill_length_mm <dbl> 39.1, 39.5, 40.3, 36.7, 39.3, 38.9, 39.2,
41.1, 38.6…
## $ bill_depth_mm <dbl> 18.7, 17.4, 18.0, 19.3, 20.6, 17.8, 19.6,
17.6, 21.2…
## $ flipper_length_mm <int> 181, 186, 195, 193, 190, 181, 195, 182, 191, 198, 18…
## $ body_mass_g <int> 3750, 3800, 3250, 3450, 3650, 3625, 4675,
3200, 3800…
## $ sex <chr> "male", "female", "female", "female", "male", "femal…
## $ year <int> 2007, 2007, 2007, 2007, 2007, 2007, 2007,
2007, 2007…
6.
Are there any extra columns? If so, remove it/them
penguins <-
subset
(penguins, select =
-
c
(
1
))
head
(penguins)
## species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
## 1 Adelie Torgersen 39.1 18.7 181 3750
## 2 Adelie Torgersen 39.5 17.4 186 3800
## 3 Adelie Torgersen 40.3 18.0 195 3250
## 4 Adelie Torgersen 36.7 19.3 193 3450
## 5 Adelie Torgersen 39.3 20.6 190 3650
## 6 Adelie Torgersen 38.9 17.8 181 3625
## sex year
## 1 male 2007
## 2 female 2007
## 3 female 2007
## 4 female 2007
## 5 male 2007
## 6 female 2007
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
7.
What is the size of this dataframe
nrow
(penguins)
## [1] 333
ncol
(penguins)
## [1] 8
The penguins dataset has 333 rows by 9 columns
8.
What this the datatype of each variable in the penguins dataset
9.
How many unique values do we have in the variable year? Based on this, do you think year is quant or qual? Can year be a factor? ``
unique
(penguins
$
year)
## [1] 2007 2008 2009
Year has no mathematic qualities in this dataset, so recode year as a factor
10.
Based on your results for 7 and 8, recode the appropriate variables.
penguins
$
species
<-
as.factor
(penguins
$
species)
11.
Verify your recoding with str() or glimpse()
str
(penguins)
## 'data.frame': 333 obs. of 8 variables:
## $ species : Factor w/ 3 levels "Adelie","Chinstrap",..: 1
1 1 1 1 1 1 1 1 1 ...
## $ island : chr "Torgersen" "Torgersen" "Torgersen" "Torgersen" ...
## $ bill_length_mm : num 39.1 39.5 40.3 36.7 39.3 38.9 39.2 41.1 38.6 34.6 ...
## $ bill_depth_mm : num 18.7 17.4 18 19.3 20.6 17.8 19.6 17.6 21.2 21.1 ...
## $ flipper_length_mm: int 181 186 195 193 190 181 195 182 191 198 ...
## $ body_mass_g : int 3750 3800 3250 3450 3650 3625 4675 3200 3800 4400 ...
## $ sex : chr "male" "female" "female" "female" ...
## $ year : int 2007 2007 2007 2007 2007 2007 2007 2007 2007 2007 ...
12.
Run summary() on your dataset. Do any of the variables have missing values? If so, which variables?
summary
(penguins)
## species island bill_length_mm bill_depth_mm ## Adelie :146 Length:333 Min. :32.10 Min. :13.10 ## Chinstrap: 68 Class :character 1st Qu.:39.50 1st Qu.:15.60
## Gentoo :119 Mode :character Median :44.50 Median :17.30 ## Mean :43.99 Mean :17.16 ## 3rd Qu.:48.60 3rd Qu.:18.70 ## Max. :59.60 Max. :21.50 ## flipper_length_mm body_mass_g sex year ## Min. :172 Min. :2700 Length:333 Min. :2007 ## 1st Qu.:190 1st Qu.:3550 Class :character 1st Qu.:2007 ## Median :197 Median :4050 Mode :character Median :2008 ## Mean :201 Mean :4207 Mean :2008 ## 3rd Qu.:213 3rd Qu.:4775 3rd Qu.:2009 ## Max. :231 Max. :6300 Max. :2009
13.
Create a histograme for bill_length_mm using the ggplot() function
ggplot
(
data =
penguins, aes
(
x =
bill_length_mm))
+
geom_histogram
(
binwidth =
2
, fill =
"blue"
, color =
"black"
)
14.
Modify your code in #12 to add a title, x axis label, y-axis label
ggplot
(
data =
penguins, aes
(
x =
bill_length_mm)) +
geom_histogram
(
binwidth =
2
, fill =
"blue"
, color =
"black"
) +
labs
(
title =
"Histogram of Bill Length (mm)"
, x =
"Bill Length (mm)"
, y =
"Frequency"
)
15. Use facet_wrap() to break the graph into subplots based on the variable species
ggplot
(
data =
penguins, aes
(
x =
bill_length_mm)) +
geom_histogram
(
binwidth =
2
, fill =
"blue"
, color =
"black"
) +
labs
(
title =
"Histogram of Bill Length (mm)"
, x =
"Bill Length (mm)"
, y =
"Frequency"
) +
facet_wrap
(
~
species)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
16. Make a scatterplot of bill length and bill depth
ggplot
(
data =
penguins, mapping =
aes
(
x =
bill_length_mm, y =
bill_depth_mm, color = species)) +
geom_point
()
17.
Make a scatterplot of bill length and body mass
#Enter code here
ggplot
(
data =
penguins,
mapping =
aes
(
x =
bill_length_mm, y =
body_mass_g)) +
geom_point
()
18.
Color the data points to indicate species
ggplot
(
data =
penguins, aes
(
x =
bill_length_mm, y =
body_mass_g, color
=
species)) +
geom_point
()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Chapter 2 project
arrow_forward
tab
(2.1-2.6) Target *
← → C
caps lock
YouTube
→1
esc
Home
Maps Kindle
Winter 2023
canvas.seattlecolleges.edu/courses/10176/assignments/81095
Syllabus
Announcements
Modules
Assignments
People
Office 365
Central Learning
Support
Central eTutoring
Zoom 1.3
!
1
X
Q
A
N
Course Hero
2
= Psychology 2e - O... StatCrunch (1.4-1.7) Writing...
W
S
X
Match each scatterplot shown below with one of the four specified correlations.
#
3
C
E
D
O
0 0
xb Answered: You randomly surve X
CO
4
C
R
8
LL
%
5
Search or type URL
V
T
a. -0.45
b. -0.91
c. 0.86
d. 0.35
G
6
MacBook Pro
OF
Y
H
New Tab
&
7
U
00 *
8
J
1
(
9
x +
K
0
0
L
P
arrow_forward
NVCC Fall 2021
1-
-2
-1
-1
Home
2.
4
-2
Announcements
-3.
4-
Syllabus
Modules
Discussions
Zoom
3-
2-
Grades
1-
-2
2 3
NOVA Policies
-1-
-2
Tutor.com: 24/7
Online Tutoring
-3
Library Resources
1+
a
P Type here to search
arrow_forward
Problem 4-09
Epsilon Airlines services predominately the eastern and southeastern United States. The vast majority of Epsilon's customers make reservations through Epsilon's website, but a small percentage
of customers make reservations via phone. Epsilon employs call-center personnel to handle these reservations along with any problems with the website reservation system and for the
rebooking of flights for customers if their plans change or their travel is disrupted. Staffing the call center appropriately is a challenge for Epsilon's management team. Having too many
employees on hand is a waste of money, but having too few results in very poor customer service and the potential loss of customers.
Epsilon analysts have estimated the minimum number of call-center employees needed by day of week for the upcoming vacation season (June, July, and the first two weeks of August). These
estimates are as follows:
Minimum Number of
Employees Needed
Day
Monday
75
Tuesday
50
Wednesday
45…
arrow_forward
Can you please help with parts v & vi, thank you
arrow_forward
Evaluate the function for the given values of x.
-4x+6
for x<-1
h(x) =
2
x*+3
for -1
arrow_forward
It has been suggested that daily production of a subassembly would be increased if better lighting were installed and background music and free coffee and doughnuts were provided during the day. Management agreed to try the scheme for a limited time. A listing of the number of subassemblies produced per week before and after the new work environment for each employee follows.
Employee
Past Production Record
Production after Installing, Lighting, Music, etc.
JD
23
33
SB
26
26
MD
24
30
RCF
17
25
MF
20
19
UHH
24
22
IB
30
29
WWJ
21
25
OP
25
22
CD
21
23
PA
16
17
RRT
20
15
AT
17
9
QQ
23
30
FIND:
State the decision rule and show your work:
Reject H0 if T ≤ :
Compute T and arrive at a decision (Show your work).
T =
____________
,
do not reject
H0.
arrow_forward
It has been suggested that daily production of a subassembly would be increased if better lighting were installed and background music and free coffee and doughnuts were provided during the day. Management agreed to try the scheme for a limited time. A listing of the number of subassemblies produced per week before and after the new work environment for each employee follows.
Employee
Past Production Record
Production after Installing, Lighting, Music, etc.
JD
23
33
SB
26
26
MD
24
30
RCF
17
25
MF
20
19
UHH
24
22
IB
30
29
WWJ
21
25
OP
25
22
CD
21
23
PA
16
17
RRT
20
15
AT
17
9
QQ
23
Show your work, please. Thanks!
arrow_forward
Part 4 of this queston
arrow_forward
SOLVE STEP BY STEP IN DIGITAL FORMAT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9. A laboratory is processing a vaccine, five methods are being tested to determine which is least likely to contaminate the vaccine. If contamination rates were uniform, 20 contaminated vaccines per day would be expected for each method. However, the contaminated vaccines by method are 34, 17, 14, 12, and 23, respectively. Is there evidence to affirm that the rates are uniform?
arrow_forward
O 20970175
Bb Homework - 202010.119-
O Microsoft Word S20 HVM
O Microsoft Word - S20 HV
G authentication probabilit X +
File | C:/Users/ykt27/OneDrive/Desktop/IT102Chapter12Homework.pdf
E Apps
M Gmail
YouTube
Maps
( Select Term or Dat...
3 SQL Tutorial
Financial Aid
Scholarship Finder...
Bb Welcome, Yared -..
M Office 365 ProPlus...
work.
Given the following right triangle with x = 3,and y = 4, calculate r and then calculate each
of the six trig functions for 0. Show your work to get any credit at all for this problem.
Round answers to 2 decimal places.
1.
a. r=
b. sin (0) =
cos (0)=
d. tan (0) =
%3D
C.
е. CSc (Ө) -
f. sec (Ө)
g. cot (0) =
%3D
1:56 PM
3/2/2020
arrow_forward
le Edit View History
ome - myRCC
X
Bookmarks Profiles Tab Window Help
mylearning.suny.edu/d21/le/content/920969/viewContent/25846458/View
$
A.1 HW-23FA STATISTICS (81 X b Enter your payment details | ba x +
Stem (hundred thousands) Leaf (ten thousands)
0
667778999
1
2
3
Submit Question
02447778889999
0011234445667889
The stem-and-leaf plot above shows house sale prices over the last week in Tacoma. What was the
most expensive house sold? Give your answer in dollars
00011224
4
www
BUB
ww
O
SEP
15
MacBook Air
43
arrow_forward
Exercise 35
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

MATLAB: An Introduction with Applications
Statistics
ISBN:9781119256830
Author:Amos Gilat
Publisher:John Wiley & Sons Inc

Probability and Statistics for Engineering and th...
Statistics
ISBN:9781305251809
Author:Jay L. Devore
Publisher:Cengage Learning

Statistics for The Behavioral Sciences (MindTap C...
Statistics
ISBN:9781305504912
Author:Frederick J Gravetter, Larry B. Wallnau
Publisher:Cengage Learning

Elementary Statistics: Picturing the World (7th E...
Statistics
ISBN:9780134683416
Author:Ron Larson, Betsy Farber
Publisher:PEARSON

The Basic Practice of Statistics
Statistics
ISBN:9781319042578
Author:David S. Moore, William I. Notz, Michael A. Fligner
Publisher:W. H. Freeman

Introduction to the Practice of Statistics
Statistics
ISBN:9781319013387
Author:David S. Moore, George P. McCabe, Bruce A. Craig
Publisher:W. H. Freeman
Related Questions
- Chapter 2 projectarrow_forwardtab (2.1-2.6) Target * ← → C caps lock YouTube →1 esc Home Maps Kindle Winter 2023 canvas.seattlecolleges.edu/courses/10176/assignments/81095 Syllabus Announcements Modules Assignments People Office 365 Central Learning Support Central eTutoring Zoom 1.3 ! 1 X Q A N Course Hero 2 = Psychology 2e - O... StatCrunch (1.4-1.7) Writing... W S X Match each scatterplot shown below with one of the four specified correlations. # 3 C E D O 0 0 xb Answered: You randomly surve X CO 4 C R 8 LL % 5 Search or type URL V T a. -0.45 b. -0.91 c. 0.86 d. 0.35 G 6 MacBook Pro OF Y H New Tab & 7 U 00 * 8 J 1 ( 9 x + K 0 0 L Parrow_forwardNVCC Fall 2021 1- -2 -1 -1 Home 2. 4 -2 Announcements -3. 4- Syllabus Modules Discussions Zoom 3- 2- Grades 1- -2 2 3 NOVA Policies -1- -2 Tutor.com: 24/7 Online Tutoring -3 Library Resources 1+ a P Type here to searcharrow_forward
- Problem 4-09 Epsilon Airlines services predominately the eastern and southeastern United States. The vast majority of Epsilon's customers make reservations through Epsilon's website, but a small percentage of customers make reservations via phone. Epsilon employs call-center personnel to handle these reservations along with any problems with the website reservation system and for the rebooking of flights for customers if their plans change or their travel is disrupted. Staffing the call center appropriately is a challenge for Epsilon's management team. Having too many employees on hand is a waste of money, but having too few results in very poor customer service and the potential loss of customers. Epsilon analysts have estimated the minimum number of call-center employees needed by day of week for the upcoming vacation season (June, July, and the first two weeks of August). These estimates are as follows: Minimum Number of Employees Needed Day Monday 75 Tuesday 50 Wednesday 45…arrow_forwardCan you please help with parts v & vi, thank youarrow_forwardEvaluate the function for the given values of x. -4x+6 for x<-1 h(x) = 2 x*+3 for -1arrow_forwardIt has been suggested that daily production of a subassembly would be increased if better lighting were installed and background music and free coffee and doughnuts were provided during the day. Management agreed to try the scheme for a limited time. A listing of the number of subassemblies produced per week before and after the new work environment for each employee follows. Employee Past Production Record Production after Installing, Lighting, Music, etc. JD 23 33 SB 26 26 MD 24 30 RCF 17 25 MF 20 19 UHH 24 22 IB 30 29 WWJ 21 25 OP 25 22 CD 21 23 PA 16 17 RRT 20 15 AT 17 9 QQ 23 30 FIND: State the decision rule and show your work: Reject H0 if T ≤ : Compute T and arrive at a decision (Show your work). T = ____________ , do not reject H0.arrow_forwardIt has been suggested that daily production of a subassembly would be increased if better lighting were installed and background music and free coffee and doughnuts were provided during the day. Management agreed to try the scheme for a limited time. A listing of the number of subassemblies produced per week before and after the new work environment for each employee follows. Employee Past Production Record Production after Installing, Lighting, Music, etc. JD 23 33 SB 26 26 MD 24 30 RCF 17 25 MF 20 19 UHH 24 22 IB 30 29 WWJ 21 25 OP 25 22 CD 21 23 PA 16 17 RRT 20 15 AT 17 9 QQ 23 Show your work, please. Thanks!arrow_forwardPart 4 of this questonarrow_forwardSOLVE STEP BY STEP IN DIGITAL FORMAT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 9. A laboratory is processing a vaccine, five methods are being tested to determine which is least likely to contaminate the vaccine. If contamination rates were uniform, 20 contaminated vaccines per day would be expected for each method. However, the contaminated vaccines by method are 34, 17, 14, 12, and 23, respectively. Is there evidence to affirm that the rates are uniform?arrow_forwardO 20970175 Bb Homework - 202010.119- O Microsoft Word S20 HVM O Microsoft Word - S20 HV G authentication probabilit X + File | C:/Users/ykt27/OneDrive/Desktop/IT102Chapter12Homework.pdf E Apps M Gmail YouTube Maps ( Select Term or Dat... 3 SQL Tutorial Financial Aid Scholarship Finder... Bb Welcome, Yared -.. M Office 365 ProPlus... work. Given the following right triangle with x = 3,and y = 4, calculate r and then calculate each of the six trig functions for 0. Show your work to get any credit at all for this problem. Round answers to 2 decimal places. 1. a. r= b. sin (0) = cos (0)= d. tan (0) = %3D C. е. CSc (Ө) - f. sec (Ө) g. cot (0) = %3D 1:56 PM 3/2/2020arrow_forwardle Edit View History ome - myRCC X Bookmarks Profiles Tab Window Help mylearning.suny.edu/d21/le/content/920969/viewContent/25846458/View $ A.1 HW-23FA STATISTICS (81 X b Enter your payment details | ba x + Stem (hundred thousands) Leaf (ten thousands) 0 667778999 1 2 3 Submit Question 02447778889999 0011234445667889 The stem-and-leaf plot above shows house sale prices over the last week in Tacoma. What was the most expensive house sold? Give your answer in dollars 00011224 4 www BUB ww O SEP 15 MacBook Air 43arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- MATLAB: An Introduction with ApplicationsStatisticsISBN:9781119256830Author:Amos GilatPublisher:John Wiley & Sons IncProbability and Statistics for Engineering and th...StatisticsISBN:9781305251809Author:Jay L. DevorePublisher:Cengage LearningStatistics for The Behavioral Sciences (MindTap C...StatisticsISBN:9781305504912Author:Frederick J Gravetter, Larry B. WallnauPublisher:Cengage Learning
- Elementary Statistics: Picturing the World (7th E...StatisticsISBN:9780134683416Author:Ron Larson, Betsy FarberPublisher:PEARSONThe Basic Practice of StatisticsStatisticsISBN:9781319042578Author:David S. Moore, William I. Notz, Michael A. FlignerPublisher:W. H. FreemanIntroduction to the Practice of StatisticsStatisticsISBN:9781319013387Author:David S. Moore, George P. McCabe, Bruce A. CraigPublisher:W. H. Freeman

MATLAB: An Introduction with Applications
Statistics
ISBN:9781119256830
Author:Amos Gilat
Publisher:John Wiley & Sons Inc

Probability and Statistics for Engineering and th...
Statistics
ISBN:9781305251809
Author:Jay L. Devore
Publisher:Cengage Learning

Statistics for The Behavioral Sciences (MindTap C...
Statistics
ISBN:9781305504912
Author:Frederick J Gravetter, Larry B. Wallnau
Publisher:Cengage Learning

Elementary Statistics: Picturing the World (7th E...
Statistics
ISBN:9780134683416
Author:Ron Larson, Betsy Farber
Publisher:PEARSON

The Basic Practice of Statistics
Statistics
ISBN:9781319042578
Author:David S. Moore, William I. Notz, Michael A. Fligner
Publisher:W. H. Freeman

Introduction to the Practice of Statistics
Statistics
ISBN:9781319013387
Author:David S. Moore, George P. McCabe, Bruce A. Craig
Publisher:W. H. Freeman