Assignment 3
5.4
Made a scatterplot use the function libaray(DataComputing) and
scatterGraphHelper(CPS85).
exper is mapped to xaxis.
wage is mapped to yaxis.
married sets color(shown as grayscale in the printed version).
facet is based on sector.
Set x
STAT 135, Concepts of Statistics
Helmut Pitters
Linear regression
Department of Statistics
University of California, Berkeley
April 20, 2017
Linear regression.
Example (Growth of Kalama children)
How (fast) do children grow?
In context of nutritional stud
STAT 135, Concepts of Statistics
Helmut Pitters
Comparing two populations  matched samples
Department of Statistics
University of California, Berkeley
April 17, 2017
Review: Covariance and correlation.
Example: comparing production methods
Often in stati
Problem 27
To show that the procedure will generate a simple random sample of size n, we need to show every possible
1
. i.e. if N = n + 1, we need show that this procedure can generate a
(Nn )
1
sample of size n with probability n+1 .
sample occurs with
Solutions
HWT
32
.
:
Ho
(A)
X
:
Hi
X
:
'
because
Xi=
is
only
we
120
so
,
plltoj
Zf
(b)
pttilx
)
PIHOIX)
we
type B
,
.
likelihood
the
data
PHIHD
=L
(HD
=p
observed
one
are
,
is
the single
NOT
measurement
.at#ii*KitwIf*
the
prior pnbehtiy
a
PHDPCXIHD
PHDPHH
Plot for Experiment 1: Toss thumbtack 20 times and plot loglikelihood.
PI < seq(from = 0, to = 1, by = 0.001)
log_likelihood < 12*log(PI) + 8*log(1PI)
plot(PI, log_likelihood, type = "l",
main = expression(paste("Experiment 1: loglik(",pi, ")"),
xlab
STAT 135, 2. Midterm exam, Spring 2017, H. Pitters
NAME (IN CAPS):
SID number and SECTION:
Please write your answers on the exam sheets. Show
your work or provide a brief explanation for all answers. This quiz is closed books. You are allowed
to use a cal
Solutions
HW
2
( a)
True
11
If
.
is
defined
as
likelihood
sup
likelihood
numeritm
the
parameter
(b)
False
p
.
0.02
0.03
P
=
statistic
.
value
P (
=
or
data
observed
of
of
TH
p
.
then
,
003
value
would
Ho
,
Xo
=
ZTHD
true
is
*
Xo
not
,
be
,/Ho )
(
(
error
18
Solutions
10
HW
IT
(a)
.

SPENT
toilmy
where
length
the
where
level
)%
lwltd
* 'T )
the
2
)
('D
for
is
,
the
upper
of
quartile
Zsp Ftxttny
is
CI
.
.
tH2)
t(m
.
I*i ' Itch
'
sp=
shortest
Cl
2
+
2
to
corresponds
length
nittntyt
smallest
Nxtnyam
If
th
hw
2
11
.
SEE
5*5414=0.904
las
.
=
I
1
K=Id
pi=A=
E=oi=
E=b=
XMIP
'
I
y=
is
we
ctdy
X=
solve
can
=
two
letting
by
J
=
D=
D
9=i=
( Xi
let
D=
,
5

dyij
,
2
cfw_ zeta
xTHi
Ilxi
'
air
delo
indeed
,
y
least
use
dj
sign
033
here
cheek
a
=
o
a%4

0.03

=
c=
HW
2
Solutions
I
.
be
to
I
3
p(Y=n )
number
the
of
etx
"
the
of
should
N
0
( Kn )
'
=
observed
number
300
.
P(Y=n)
=
expected
8
13=48
23
.
36
46.33
3
68
60.13
4
43
58.5
5
43
45.6
6
30
29.6
7
14
16.45
8
10
10
12
IH
of
right
3.46
4
1
0
earns
.
in
the
.
3
Ch 9 Problem 39 continued
thereisstrongevidenceagainstthenullhypothesis.Datasuggeststhatthereisatemporal
trendintheincidenceofbites.
Note:Youcanalsolookatthepvaluetodeterminewhetherornotyourejectthenull
hypothesis.Sincepvalue=1.31*1014 <0.05=,werejectthen
STAT 135, Midterm exam, Spring 2016, H. Pitters
NAME (IN CAPS):
SID number and SECTION:
Show your work or provide a brief explanation for
all answers. This quiz is closed books. You are
allowed to use the notes you took during class, a
calculator and extr
MENU
HOME
TEXT TABLE OF CONTENTS
ONLINE LECTURES
ASSIGNMENTS
CALCULATOR
TOOLS & DEMOS
BINOMIAL HISTOGRAM
CALCULATOR
CHISQUARE DISTRIBUTION
CONTROLLING FOR VARIABLES
CONFIDENCE INTERVALS
CORRELATION AND REGRESSION
HISTOGRAM
LAW OF LARGE NUMBERS
NORMAL AP
MENU
HOME
TEXT TABLE OF CONTENTS
ONLINE LECTURES
ASSIGNMENTS
CALCULATOR
TOOLS & DEMOS
BINOMIAL HISTOGRAM
CALCULATOR
CHISQUARE DISTRIBUTION
CONTROLLING FOR VARIABLES
CONFIDENCE INTERVALS
CORRELATION AND REGRESSION
HISTOGRAM
LAW OF LARGE NUMBERS
NORMAL AP
MENU
HOME
TEXT TABLE OF CONTENTS
ONLINE LECTURES
ASSIGNMENTS
CALCULATOR
TOOLS & DEMOS
BINOMIAL HISTOGRAM
CALCULATOR
CHISQUARE DISTRIBUTION
CONTROLLING FOR VARIABLES
CONFIDENCE INTERVALS
CORRELATION AND REGRESSION
HISTOGRAM
LAW OF LARGE NUMBERS
NORMAL AP
HW07  More Probability
Stat 20 & 131A, Spring 2017, Prof. Sanchez
Due Mar9
1) True or false, and explain:
0.4pts
Give 0.2 pts for each part. Total 0.4 pts.
a. If a die is rolled three times, the chance of getting at least one ace is 1/6 + 1/6 + 1/6 = 1/
HW09  Probability Histograms and Sampling
Stat 20 & 131A, Spring 2017, Prof. Sanchez
Due Mar23
1) A coin is tossed 100 times. Use normal approximation (with continuity correction) to estimate
the chance of getting 60 heads. Please show your work (no wor
Practice Problems (for midterm 2)
Spring 2017
1) In Lotto 653, there is a box with 53 balls, numbered from 1 to 53. Six balls are drawn at random
without replacement from the box. You win the grand prize if the numbers on your lottery ticket
are the same
HW08  Chance Variability
Stat 20 & 131A, Spring 2017, Prof. Sanchez
Due Mar16
1) One hundred draws are made at random with replacement from the box [1, 2].
0.5pts
Give 0.1 pt for each part. Total 0.5 pts.
a. How small can the sum be?
The smallest sum is
Practice Problems (for midterm 2)
Spring 2017
1) In Lotto 653, there is a box with 53 balls, numbered from 1 to 53. Six balls are drawn at random
without replacement from the box. You win the grand prize if the numbers on your lottery ticket
are the same
STAT 20
Worksheet 10 Solution
Feb 2123, 2017
Chapter 12
Problem 1. The International Rice Research Institute in the Philippines developed the hybrid rice IR 8, setting off the green revolution in tropical agriculture. Among other things,
they made a thor
HW06  Probability
Stat 20 & 131A, Spring 2017, Prof. Sanchez
Due Mar2
1) Two cards will be dealt off the top of a wellshuffled deck. You have a choice:
0.5pts
Give 0.5 pts for option i).
i. To win $1 if the first is a king.
ii. To win $1 if the first i
Cheat Sheet
Probability
P rob(event) =
Rule
complement
multiplication
addition
independence
# of ways event can happen
total # of possible outcomes
Expression
P (Ac ) = 1 P (A)
P (A and B) = P (BA)P (A)
P (A or B) = P (A) + P (B) P (A and B)
P(BA) = P(B
Simulation
Before we consider the role that simulation can
play in helping us understand statistics, lets take
a step back and think about the big picture.
We can think of probability theory as
complementary to statistical inference.
Probability
Distribut
Case: East Bay Housing Market
load(url("http:/www.stat.berkeley.edu/users
/nolan/data/Projects/SFHousing.rda")
San Francisco Chronicle listings
Data
Record: house sold in a
particular time period
Over 200,000 houses
Subset to a dozen cities
in the East
Data Structures
Data Frames, Lists, Matrices
Review: Vector
Ordered container of literals
Elements must be same type
Data Frame
Ordered container of vectors
Vectors must all be the same length
Vectors can be different types
Wireless Data
There are 5
Environments and
Scope
Environments and variable scope
R has a special mechanism for allowing you to
use the same name in different places in your
code and have it refer to different objects.
For example, you want to be able to create
new variables in you
Apply Functions
Sometimes we want an operation to be applied
to each element of a list, to each vector in a data
frame, or to individual dimensions of a matrix
R provides the apply mechanism to do this.
There are several apply functions:
sapply() and