Lab 3 Probability R Afara Emmanuel
docx
keyboard_arrow_up
School
Harrisburg University of Science and Technology *
*We aren’t endorsed by this school
Course
502
Subject
Statistics
Date
Feb 20, 2024
Type
docx
Pages
7
Uploaded by ConstableCrown17410
> download.file("http://www.openintro.org/stat/data/kobe.RData", destfile = "kobe.RData")
trying URL 'http://www.openintro.org/stat/data/kobe.RData'
Content type 'unknown' length 2280 bytes
downloaded 2280 bytes
> load("kobe.RData") # Kobe's shooting stats in few games
> head(kobe)
vs game quarter time description basket
1 ORL 1 1 9:47 Kobe Bryant makes 4-foot two point shot H
2 ORL 1 1 9:07 Kobe Bryant misses jumper M
3 ORL 1 1 8:11 Kobe Bryant misses 7-foot jumper M
4 ORL 1 1 7:41 Kobe Bryant makes 16-foot jumper (Derek Fisher assists) H
5 ORL 1 1 7:03 Kobe Bryant makes driving layup H
6 ORL 1 1 6:01 Kobe Bryant misses jumper M
> tail(kobe)
vs game quarter time description basket
128 ORL 3 4 3:57 Bryant Jump Shot: Made (28 PTS) H
129 ORL 3 4 3:33 Bryant Layup Shot: Missed M
130 ORL 3 4 2:02 Bryant 3pt Shot: Missed M
131 ORL 3 4 00:23.9 Bryant 3pt Shot: Missed M
132 ORL 3 4 00:06.9 Bryant 3pt Shot: Missed M
133 ORL 3 4 00:00.5 Bryant Layup Shot: Made (31 PTS) H
> dim(kobe)
[1] 133 6
> kobe$basket[1:9]
[1] "H" "M" "M" "H" "H" "M" "M" "M" "M"
> kobe[1:9,6]
[1] "H" "M" "M" "H" "H" "M" "M" "M" "M"
> kobe_streak <- calc_streak(kobe$basket)
> streak_length_of_1 <-calc_streak(1)
> print(streak_length_of_1)
Q1:
What does a streak length of 1 mean, i.e. how many hits and misses are in a streak of 1? W
1? What about a streak length of 0?
The code defines a streak length of one which is a shot and a miss. There are 0 hits and 1 misses in a streak length of 0.
[1] 0 0
> streak_length_of_0 <-calc_streak(0)
> print(streak_length_of_0)
[1] 0 0
Q2: To describe the distribution of kobe’s streak lengths from the 2009 NBA finals.
A barplot instead of a histogram is preferable for our data counts.The plot defines Kobe’s typic
Typical streak length and the length of his longest streak of baskets.
> kobe_streak <- calc_streak(kobe$basket)
> kobe_streak [1] 1 0 2 0 0 0 3 2 0 3 0 1 3 0 0 0 0 0 1 1 0 4 1 0 1 0 1 0 1 2 0 1 2 1 0 0 1 0 0 0 1 1 0 1 0 2 0 0 0 3 0 1 0 1 2
[70] 0 1 1 0 0 0 1
>
> barplot(table(kobe_streak))
> > table(kobe$basket)/133
H M 0.4360902 0.5639098 > kobe_streak <- calc_streak(kobe$basket)
> barplot(table(kobe_streak))
> table(kobe$basket)/133
H M 0.4360902 0.5639098 > title("streak lengths from 2009 NBA finals")
> barplot(table(kobe_streak))
> > table(kobe$basket)/133
H M 0.4360902 0.5639098 > kobe_streak <- calc_streak(kobe$basket)
> barplot(table(kobe_streak))
> table(kobe$basket)/133
H M 0.4360902 0.5639098 > title("streak lengths from 2009 NBA finals")
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
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
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "heads"
> outcomes <- c("heads", "tails")
> sample(outcomes, size = 1, replace = TRUE)
[1] "tails"
> set.seed(5)
Q3.In the simulation of flipping the unfair coin 100 times, how many flips came up heads?
> outcomes <- c("heads", "tails")
> sim_unfair_coin <- sample(outcomes, size = 100, replace = TRUE, prob = c(0.2, 0.8))
> table(sim_unfair_coin)
sim_unfair_coin
heads tails 28 72 Q4.What change needs to be made to the sample function so that it reflects a shooting percentage of 45%? Make this adjustment, then run a simulation to sample 133 shots.
Assign the output of this simulation to a new object called sim_basket .
> outcomes <- c("H", "M")
> sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = c(.45, 0.55))
> sim_basket
[1] "H" "H" "H" "H" "H" "M" "M" "M" "M" "M" "M" "M" "H" "M" "M" "M" "M" "M" "H" "M" "M" "H" "H" "H" "M" [35] "M" "M" "M" "M" "M" "H" "M" "M" "M" "H" "H" "H" "M" "H" "H" "H" "M" "H" "H" "M" "M" "H" "H" "M" "M"
[69] "H" "H" "M" "H" "H" "M" "M" "H" "M" "H" "M" "M" "H" "H" "M" "M" "H" "M" "H" "M" "H" "M" "H" "H" "M" [103] "H" "H" "H" "M" "H" "M" "M" "M" "H" "H" "M" "M" "M" "M" "M" "M" "H" "M" "M" "M" "H" "M" "H" "H" "H"
Describe the distribution of streak lengths. What is the typical streak length for this simulated independent shooter with a 45% shooting percentage? How long is the player's longest streak of baskets in 133 shots?
> outcomes <- c("H", "M")
> sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = c(.45, 0.55))
> sim_basket
[1] "H" "H" "M" "M" "M" "M" "H" "H" "M" "H" "H" "M" "M" "M" "M" "H" "M" "H" "M" "M" "M" "H" "M" "M" "H" [35] "M" "H" "H" "H" "M" "H" "M" "M" "M" "H" "M" "H" "H" "M" "M" "M" "M" "H" "M" "H" "H" "M" "H" "M" "H" [69] "M" "H" "M" "M" "H" "H" "M" "M" "H" "H" "M" "M" "H" "H" "M" "M" "M" "H" "M" "M" "H" "H" "M" "M" "M"
[103] "M" "M" "M" "M" "M" "M" "M" "H" "M" "M" "M" "M" "M" "M" "H" "H" "M" "H" "M" "M" "M" "H" "M" "M" "M
> calc_streak(sim_basket)
[1] 2 0 0 0 2 2 0 0 0 1 1 0 0 1 0 1 2 0 0 0 0 0 0 3 1 0 0 1 2 0 0 0 1 2 1 1 1 0 0 0 0 2 1 0 2 0 2 0 2 0 0 1 0 2 0
[70] 1 0 0 0 0 0 2 1 0 0 1 0 0 2 0 2
> sim_streak <- calc_streak(sim_basket)
> barplot(table(calc_streak(sim_basket)))
>
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 Documents
Related Questions
Please share an excel screen on how to input the data for #2 only.
Thank you
arrow_forward
You've heard of "Florida Man;" now meet "Florida Bear." This problem involves data from a
subspecies of black bear found in Florida, Ursus americanus floridanus. The data were collected by T. D.
Bartareau as part of a study published in the Journal of Fish and Wildlife Management (2017, vol 8, pp 234-
239). Before you begin consult the info sheet included at the end
(a) Do you predict an allometric or isometric scaling relationship between body weight and body length?
Explain.
(b) Based on your answer to part a, what would a plot of log body weight (vertical axis) versus log body length
(horizontal axis) look like?
(c) Using the data provided, create a plot of log body weight versus log body length. Make sure to label the
axes. Why might someone think your plot fails to provide clear support for your claim in part b?
(d) Using the tools described on the info sheet to isolate portions of the dataset, refine your use of data in part
c to strengthen support for your claim in b. Why does…
arrow_forward
The table below displays the adult literacy rate in Bolivia for several different years. The adult literacy rate is the percentage of people ages 15 and above who can both read and write with understanding a short simple statement about their everyday life.
Data downloaded on 2/19/2020 from https://ourworldindata.org/grapher/literacy-rate-adults?tab=chart&time=1973..2016.
Year 1976 2001 2012
Literacy Rate 63.2% 86.7% 94.5%
When answering the questions below, round to four decimal places in your intermediate computations.
Use interpolation or extrapolation (whichever is appropriate) to predict the literacy rate in Bolivia in 1992. Round your answer to one decimal place. You only get one submission for the unit.
---Select---
Use interpolation or extrapolation (whichever is appropriate) to predict the literacy rate in Bolivia in 2050. Round your answer to one decimal place. You only get one submission for the unit.
---Select---
Is your 2050 prediction realistic? You must…
arrow_forward
REDIT - MAth Assessinne X
Cs google.com/forms/d/e/1FAlp0LSck09 bkclJ_DwCawx1 Two8YLuatZKvCSPsvU92zUZycG7KRg/formResponse
Disc
Spotify -Web Playe..
v KayiFamilyTV
Top Movies - Upco..
**» MovieBoxPro
Watch Anime Onlin...
https://www.roblox. film links
9x
4x
x2-5x+ 6
x² + x - 12
13x +38x
x -3 x 2 x*-4
5x
x -3 x 2 x*-4
(x + 4) (x-3)
(x -2) (x + 4) (x-3)
O Option 1
O Option 2
5x +44 x
(x 3) (x-2) (x +4)
X*3 x 2 x -4
5x +28x
x 2 x*-4
(x-2) (x + 4)
arrow_forward
The following place value chart is partially labeled and represents numbers greater than or equal to 1. Refer to resource place value and large and small number if you need help
arrow_forward
comp:
/-
arrow_forward
please provide in good format
arrow_forward
Please produce descriptive statistics for this data set
arrow_forward
Please help lol
arrow_forward
help please
arrow_forward
Please follow this link and make histogram of the given data.
If there is any problem with link please tell me in the comments,
do not waste my question.
다
b
https://docs.google.com/document/d/1e6ZZ-7Gq4hOnoTQ
vyd-AFHCS2AJNbN27V7eFh83xuqU/edit?tab=t.0
arrow_forward
tps://caiu.g
acourses edis lear
Student Portal / St...
https://caiu.g X
on 7 8
с
Inbox (3,139)- 23d.. G social organization...
Geometry Part 1 [CR] - Unit 1 Quiz 2 - EDSS.MA104.A
*Student can enter max 3000 characters
$
4
index.html?sitelD=16278&userID=167063&viewMode
X DG B I U
Home | Lesso
H
9 10 11 12 13 14 15 16 17 18 19
%
5
2m
me Lesso x
Given the midpoint B (-41, 23), create 2 different set of end points that don't have the same x or y value of
the midpoint. Verify your points by solving for the midpoint and identify them as points G and H. Show
your work to prove your answer.
Geometry Part 1 [Credit Recovery]
Ω
Preformance task -... G Becoming A Welder...
A
6
eHome | HTML X
Use the paperclip button below to attach files.
Home | Lesso X
false&schoolyear_id=3060#/cp/lesson/lessons....
DELL
27
&
O
8
O
(
Solution 1
Copy of Ocean Del...
7 of 19
9
✓
-O
X
Chapte
Save
G
Text-
D
arrow_forward
A pediatrician records the age x (in yr) and average height y (in inches) for girls between the ages of 2 and 10.
Height of Girls vs. Age
50-
40-
(4,38)
30-
10-
0
Age(yr)
Part: 0 / 4
Part 1 of 4
(a) Use the points (4, 38) and (8, 50) to write a linear model for these data.
X
y =
Skip Part
Check
Height (in.)
(8,50)
Ⓒ2022 McGraw Hill LLC. All Rights Reserve
A
arrow_forward
Describe enlargement on map grid
arrow_forward
A random sample of 30 colleges from Kiplinger's list of the best values in private college provided the data shown in the file BestPrivateColleges (Kiplinger website). The variable Admit Rate () shows the percentage of students that applied to the college and were admitted, and the variable -yr Grad. Rate () shows the percentage of students that were admitted and graduated in four years.
Click on the datafile logo to reference the data.
b. Compute the sample correlation coefficient. Round your answer to two decimal places and enter negative value as negative number, if necessary.
answer b please
arrow_forward
please attach file sir
arrow_forward
how does the number of attributes of a variable impact the number of cells in the cross-tabulation table and describe what each cell represents?
arrow_forward
Please Help
arrow_forward
If you have 80 meters of fencing and want to enclose a rectangular area up against a long, straight wall, what is the largest area you can enclose?
Area =?
arrow_forward
Please help with both the questions
arrow_forward
Please complete parts (d) and (e)
arrow_forward
KINDLY PLEASE ANSWER THIS IN PRECISE AND ACCURATE MANNER AND PLEASE WRITE OR TYPE LEGIBLY THANK YOU SO MUCH FOR FOLLOWING THE INSTRUCTIONS.
Write a paragraph or two that interprets and analyzes each data set represented in tabular/graphical forms. Aside from data interpretation, explain whether the data presentation effectively communicates the information.
arrow_forward
* C0
Statistics Viewer
Insert Format
Analyze Graphs
Utilities
Extensions Window
Help
sform
GET
FILE='C:\Users\NATALIE.ROODMAN77\Downloads\Quiz 8.sav'.
DATASET NAME DataSetl WINDOW=FRONT.
T-TEST PAIRS=Attitude2 WITH Attitudel (PAIRED)
/CRITERIA=CI (.9500)
/MISSING-ANALYSIS.
T-Test
[DataSetl] C:\Users\NATALIE.ROODMAN77\Downloads\Quiz 8.sav
Paired Samples Statistics
Std. Error
Mean
Std. Deviation
Mean
Pair 1
Attitude2
13.25
28
336
Attitude1
11.61
1.524
.288
Paired Samples Correlations
Correlation
Sig.
Pair 1
Attitude2 & Attitude1
694
000
Paired Samples Test
Paired Differences
95% Confidence Interval of the
Difference
Std. Error
Lower
Jaddn
2.151
Mean
Std. Deviation
Mean
df
Sig. (2-tailed)
Pair 1
Attitude2- Attitude1
1.643
1.311
248
1.134
6.629
27
000
IBM SPSS Statistics Processo
here to search
Quiz- Spring 2022 ..
*Output1 [Docume.
LE Quiz 8.sav [DataSet...
08
F3
DD
F7
F1
F2
F4
F5
F8
2$
)
2
4.
arrow_forward
2 x2 = 44
3 x 8 = 2411
2 x 5 = 107
5 x 5 = 2510
7 x7 = ??
Assamir.com
%3D
arrow_forward
A rectangle is 4 yards longer than it is wide. Find the dimensions of the rectangle if its area is 163 sq-
yards. Enter in exact values (without decimals).
Length =
yards
Width =
yards
Submit Question
MacBook Pro
GSearch or type URL
arrow_forward
Explain how and why secondary sources should be referenced in research papers and reports
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
- Please share an excel screen on how to input the data for #2 only. Thank youarrow_forwardYou've heard of "Florida Man;" now meet "Florida Bear." This problem involves data from a subspecies of black bear found in Florida, Ursus americanus floridanus. The data were collected by T. D. Bartareau as part of a study published in the Journal of Fish and Wildlife Management (2017, vol 8, pp 234- 239). Before you begin consult the info sheet included at the end (a) Do you predict an allometric or isometric scaling relationship between body weight and body length? Explain. (b) Based on your answer to part a, what would a plot of log body weight (vertical axis) versus log body length (horizontal axis) look like? (c) Using the data provided, create a plot of log body weight versus log body length. Make sure to label the axes. Why might someone think your plot fails to provide clear support for your claim in part b? (d) Using the tools described on the info sheet to isolate portions of the dataset, refine your use of data in part c to strengthen support for your claim in b. Why does…arrow_forwardThe table below displays the adult literacy rate in Bolivia for several different years. The adult literacy rate is the percentage of people ages 15 and above who can both read and write with understanding a short simple statement about their everyday life. Data downloaded on 2/19/2020 from https://ourworldindata.org/grapher/literacy-rate-adults?tab=chart&time=1973..2016. Year 1976 2001 2012 Literacy Rate 63.2% 86.7% 94.5% When answering the questions below, round to four decimal places in your intermediate computations. Use interpolation or extrapolation (whichever is appropriate) to predict the literacy rate in Bolivia in 1992. Round your answer to one decimal place. You only get one submission for the unit. ---Select--- Use interpolation or extrapolation (whichever is appropriate) to predict the literacy rate in Bolivia in 2050. Round your answer to one decimal place. You only get one submission for the unit. ---Select--- Is your 2050 prediction realistic? You must…arrow_forward
- REDIT - MAth Assessinne X Cs google.com/forms/d/e/1FAlp0LSck09 bkclJ_DwCawx1 Two8YLuatZKvCSPsvU92zUZycG7KRg/formResponse Disc Spotify -Web Playe.. v KayiFamilyTV Top Movies - Upco.. **» MovieBoxPro Watch Anime Onlin... https://www.roblox. film links 9x 4x x2-5x+ 6 x² + x - 12 13x +38x x -3 x 2 x*-4 5x x -3 x 2 x*-4 (x + 4) (x-3) (x -2) (x + 4) (x-3) O Option 1 O Option 2 5x +44 x (x 3) (x-2) (x +4) X*3 x 2 x -4 5x +28x x 2 x*-4 (x-2) (x + 4)arrow_forwardThe following place value chart is partially labeled and represents numbers greater than or equal to 1. Refer to resource place value and large and small number if you need helparrow_forwardcomp: /-arrow_forward
- help pleasearrow_forwardPlease follow this link and make histogram of the given data. If there is any problem with link please tell me in the comments, do not waste my question. 다 b https://docs.google.com/document/d/1e6ZZ-7Gq4hOnoTQ vyd-AFHCS2AJNbN27V7eFh83xuqU/edit?tab=t.0arrow_forwardtps://caiu.g acourses edis lear Student Portal / St... https://caiu.g X on 7 8 с Inbox (3,139)- 23d.. G social organization... Geometry Part 1 [CR] - Unit 1 Quiz 2 - EDSS.MA104.A *Student can enter max 3000 characters $ 4 index.html?sitelD=16278&userID=167063&viewMode X DG B I U Home | Lesso H 9 10 11 12 13 14 15 16 17 18 19 % 5 2m me Lesso x Given the midpoint B (-41, 23), create 2 different set of end points that don't have the same x or y value of the midpoint. Verify your points by solving for the midpoint and identify them as points G and H. Show your work to prove your answer. Geometry Part 1 [Credit Recovery] Ω Preformance task -... G Becoming A Welder... A 6 eHome | HTML X Use the paperclip button below to attach files. Home | Lesso X false&schoolyear_id=3060#/cp/lesson/lessons.... DELL 27 & O 8 O ( Solution 1 Copy of Ocean Del... 7 of 19 9 ✓ -O X Chapte Save G Text- Darrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_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