Rforch3 - R for Chapter 3 Running List of Functions Applied...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
R for Chapter 3 Running List of Functions Applied to the Data Set, class.data: > attach(class.data) > reg < - lm(wt ~ ht) >summary(reg) > res < - residuals(reg) ## stores the residuals in the variable “res”, ie the e (sub i)'s > fit < - fitted(reg) ## stores the fitted values in the variable “fit”, ie the Y hat (sub i)'s, the results of plugging the ## original data X-values into the fitted line > semi.st.res < - res/19.68662 ## forms semi-studentized residuals - value of residual stand error (19.68662) is from ## summary(reg) > plot(ht,semi.st.res) ## scatter plot of ht (horizontal) by semi-studentized residuals (vertical) for each data point ## What follows is a description of what is needed for the Modified Levene Test ## > median(ht) ## Finds the median of the values stored in ht > iht <- rep("B",20) ## constructs a vector with 20 entries and a “B” in each one (ie it repeats “B” 20 times) > for (i in 1:20 ) {if (ht[i] > 67.5) iht[i] < - "A"}
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Rforch3 - R for Chapter 3 Running List of Functions Applied...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online