Activity For Lab 3 Activity3 Lab3 Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 2

DownloadActivity For Lab 3 Activity3 Lab3 Instructions
Open PDF In BrowserView PDF
Activity for Lab 3
Problem 1
In lecture 3 notes a density plot of a normally distributed random variable with area under the curve was
created using base R graphics:
curve(dnorm, from=-4, to=4, ylab="PDF", main="Pr(X <= -1)")
coord.x = c(-4,seq(-4,-1, by=0.1),-1)
coord.y = c(0,dnorm(seq(-4,-1, by=0.1)), 0)
polygon(coord.x, coord.y, col=2)

0.2
0.0

0.1

PDF

0.3

0.4

Pr(X <= −1)

−4

−2

0

2

x
Write R code using ggplot2 to recreate the density plot with area under the curve.

1

4

Pr(X <= −1)
0.4

Density

0.3

0.2

0.1

0.0
−4

−2

0

2

4

x
Problem 2
• Load gapminder data.
• Create a plot for 2007 year data only: “GDP per capita” Vs “life expectancy”
• Annotate european countries with “GDP per capita”" > 40000

80

Ireland

Norway

life expectancy

70

60

50

40
0

10000

20000

30000

GDP per capita

2

40000

50000



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 2
Page Mode                       : UseOutlines
Author                          : 
Title                           : Activity for Lab 3
Subject                         : 
Creator                         : LaTeX with hyperref package
Producer                        : pdfTeX-1.40.19
Create Date                     : 2018:09:26 12:37:00-04:00
Modify Date                     : 2018:09:26 12:37:00-04:00
Trapped                         : False
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) kpathsea version 6.3.0
EXIF Metadata provided by EXIF.tools

Navigation menu