# SOLHW1 - > mean(FGPct7andAbove) [1] 0.4756364 (f) Enter...

This preview shows pages 1–4. Sign up to view the full content.

Solution for HK1 Yicheng Kang September 16, 2010 Problem 1 Solution. (a) The R code is as following. > MealCosts=c(10.00,2.40,6.50,3.25,6.70,2.00,6.00,3.00,4.00,0.85) > mean(MealCosts) [1] 4.47 (b) This is what you do in R. > jpeg("C:/Users/Yicheng Kang/Desktop/STAT3011/HW1/MealCosts.jpg") > boxplot(MealCosts) > dev.off() windows 2 1

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

View Full Document
Then R displays the graph. It can be seen clearly that the Median is closer to the Minimum. (c) > sqrt(mean(MealCosts)) [1] 2.114237 ± Problem 2 Solution. (a) > X=read.table("http://www.stat.umn.edu/~crolling/data/basketball.txt",header=T) (b) > names(X) [1] "Height" "Weight" "FGPercent" "FTPercent" "PPG" 2
The ﬁve columns are Height , Weight , FGPercent , FTPercent and PPG , as given by R. (c) Enter following code in R > attach(X) > plot(Height,FGPercent) Then you have the plot. It can be seen from the plot that ﬁeld goal percentage tends to go up as height increases. (d) Enter the following code. > attach(X) > FGPct6andUnder=FGPercent[Hight<=6.0] > mean(FGPct6andUnder) [1] 0.3802857 (e) Similarly, > FGPct7andAbove=FGPercent[Height>=7.0]

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: > mean(FGPct7andAbove) [1] 0.4756364 (f) Enter the code: 3 > mean(FGPct7andAbove)-mean(FGPct6andUnder) [1] 0.09535065 It makes sense because taller basketball players usually score more points than shorter ones do. Problem 3 Solution. Enter the code given in the Problem. > set.seed(754) > rnums=runif(50) > rnums [1] 0.05315317 0.20338777 0.65531421 0.62510425 0.09466771 0.33746041 [7] 0.37377878 0.85182960 0.06977486 0.37617724 0.08341690 0.09611848 [13] 0.13462527 0.83699919 0.78882532 0.04231857 0.61950563 0.07229117 [19] 0.90998938 0.40178319 0.65038627 0.38808685 0.75529707 0.09347290 [25] 0.97162504 0.81603169 0.55920849 0.88055183 0.27074479 0.78175317 [31] 0.82543524 0.84739269 0.92560554 0.19651470 0.76181121 0.33995465 [37] 0.73383733 0.22324937 0.64100192 0.46682790 0.02874654 0.62917053 [43] 0.64360407 0.74747444 0.09510252 0.43234253 0.07559509 0.25176367 [49] 0.85490741 0.85999970 > mean(rnums) [1] 0.4874803 ± 4...
View Full Document

## This document was uploaded on 04/28/2011.

### Page1 / 4

SOLHW1 - > mean(FGPct7andAbove) [1] 0.4756364 (f) Enter...

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

View Full Document
Ask a homework question - tutors are online