STATS 191
Assignment 4 Solution
March 16, 2012
1
a)
data=read.table("http:/stats191.stanford.edu/data/asthma.table",header=T)
lm1=lm(Y~T+P,data)
summary(lm1)
Call:
lm(formula = Y ~ T + P, data = data)
Residuals:
Min
1Q
-2.8204 -1.0569
Median
0.2916
3Q
1.1
Statistics 191
Winter 2012
Introduction to Applied Statistics
Assignment #2
Due Monday February 06, 2012
Prof. J. Taylor
You may discuss homework problems with other students, but
you have to prepare the written assignments yourself. Late homework will be
Statistics 191
Winter 2012
Introduction to Applied Statistics
Assignment #2
Due Monday February 06, 2012
Prof. J. Taylor
You may discuss homework problems with other students, but
you have to prepare the written assignments yourself. Late homework will be
Stat 191
Introduction to Applied Statistics
Winter 2016
Instructor: Guenther Walther
Oce: Sequoia 135
Oce Hours: MWF 12.30-1.30, or by appointment. If you have just a question or two,
you can ask me right after the lecture since I will usually stay around
Stat 191
Assignment 1
Winter 2016
The assignment is due on January 15 in class. You need to show your work and answers to each problem
as well as plots and R code and output to substantiate your answers. You dont have to typeset your
solution; handwritten
Simple linear regression
January 20, 2015
1
Simple linear regression
The rst type of model, which we will spend a lot of time on, is the simple linear regresssion model. One
simple way to think of it is via scatter plots. Below are heights of mothers and
Transformations
February 12, 2015
1
Transformations
Transformations to achieve linearity
We have been working with linear regression models so far in the course.
Some models are nonlinear, but can be transformed to a linear model.
We will also see that
Some tips on R
January 8, 2015
0.1
Some help for R
In this short notebook, I will go through a few basic examples in R that you may nd useful for the course.
These are just some of the things I nd useful. Feel free to search around for others.
For those o
Review
January 13, 2015
1
Course Introduction and Review
1.1
Outline
What is a regression model?
Descriptive statistics numerical
Descriptive statistics graphical
Inference about a population mean
Dierence between two population means
2
What is cours
Simple diagnostics
January 27, 2015
0.1
Diagnostics for simple regression
Goodness of t of regression: analysis of variance.
F -statistics.
Residuals.
Diagnostic plots.
0.2
Geometry of least squares
Here are three pictures that help to describe dieren
Selection
February 28, 2015
0.1
Model selection
In a given regression situation, there are often many choices to be made. Recall our usual setup
Yn1 = Xnp p1 +
n1 .
Any subset A cfw_1, . . . , p yields a new regression model
M(A) : Yn1 = X[, A][A] +
n1
by
Penalized regression
February 26, 2015
0.1
Bias-variance tradeo
One goal of a regression analysis is to build a model that predicts well.
This is slightly dierent than the goal of making inferences about that weve focused on so far.
What does predict w
A Hume Ir? menu—Z Word/.3
a. M Wat/(my; to oLCJanY aim.
WM quxc'm w 'go—rd’/Ma( why 27
\N. WM Mk. mm A», HA2. {Mug-CM of q
M ( amua 07 we AM’W mac-pad Amway
13%, \M- 73, ".531 ~ 55%).
Thai/v EM (A 10mm M'a—éwlfﬁ’ 7&th
W WW5 0f (/4de wcmx 0w WpLVa.
‘éku
I
AM wwwiaﬂ , L0,ﬂv‘r",_, akwjfw whit? ,wimx
WM, .6 mm “but.me m4». Lu» m 345%?
( :1. net 5M We! T'grrréi-«iw {c.wlffgdfuﬁvﬂ);._;_iA_
Mpwse ‘1 or {M nggggﬂiw E51490:wa (A .X Spam
A MpmgL“ w this Ami ﬂed
the {M mu- 0.» x-wam a U; m W0? em
0mg mot -{;M M
iﬂﬁgﬁmaﬂim:
A: pow/«127A M NMWMH Maw reg/Mam [So
.0; W517 U;w._fai_a_ “ﬂaw? 1: Mai W are W’F’V‘I‘V‘ﬂ’tﬂey
MM. MM Mme mam.» {malam of) m
preﬁuxicﬁm / {law i4 Marika/r CWW My {a
wtch MNMM ﬂaw-wt: 1 T/rawfcwr? {LY X5 m
‘ffa A WWW ﬂwm'mawax, m twm
mama Io MM
[Livia Wok Laced SjMfejeA_CW’-«S)
imifmqmggﬂwmy it: gave each owwxzm
a. £24m JCHA.MQ WWW :
M
:7 w; “f; r [Bo—Mi — -—pm‘p37‘
W14 , U01” Curt Jay/C/Mt‘g. HAM SW OEWCWJ W
mare 07Mva A {ii/Maﬁa“. WW 5434
who» W31 Co WW HAIL W5 E L‘ M WmswA4ﬁin-.-
Vmwﬂﬁg)?“ 55
Stat 191
Assignment 3
Winter 2016
The assignment is due on February 17 in class. You need to show your work and answers to each
problem as well as plots and R code and output to substantiate your answers. You dont have to
typeset your solution; handwritte
Stat 191
Assignment 2
Winter 2016
The assignment is due on January 29 in class. You need to show your work and answers to each problem
as well as plots and R code and output to substantiate your answers. You dont have to typeset your
solution; handwritten
M5912 him Cm
\< = ,Eptfé,)<,+prlrw+ﬁPXp+a
mick a a: New”) _
3.0 Lac/bx. b: {a
9(me Y. A: WW Edam/5W0? the,)(g-waf
Maw, ,Ju Wmaw 0-9. _ m,qxg, ,i ﬁg (,1 .)<,_=)<:’— f _,j
Mm to A 7mmz wank X,.
Mm wfmwagmwm pmw by HM
MM Eyre/Mina wade/f Wdfmﬂggggg :
0.? HM
LUAL. 924% _3 waMWW W W;
M94 HAL We” HWLW Mada
\fti-F f3, ti; , 5:1,. . M
I. m Maﬁw3Wp WWW UM X5 Md ‘5 Lag/(MM.
LJMA mm 6; PWM {Luz mm d We
5. TIM .a-wm rem MMomdawL-‘c (have We SW
Wat/mu)
Mm “WWW £4 MOLD; Wax-Paww
{9 cures: £0
.H. TM WW @mpwdwi
W2 Maw
Poisson
March 5, 2015
1
Poisson regression
Contingency tables.
Poisson regression.
Generalized linear model.
2
Count data
2.1
Afterlife
Men and women were asked whether they believed in the after life (1991 General Social Survey).
| Y | N or U | Total
Multiple linear regression
February 5, 2015
1
Multiple linear regression
1.1
Outline
Specifying the model.
Fitting the model: least squares.
Interpretation of the coecients.
More on F -statistics.
Matrix approach to linear regression.
T -statistics
Statistics 191
Winter 2012
Introduction to Applied Statistics
Assignment #1
Due Monday January 23, 2012
Prof. J. Taylor
You may discuss homework problems with other students, but
you have to prepare the written assignments yourself. Late homework will be