{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw3 - > data=scan"C/Documents and...

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

View Full Document Right Arrow Icon
> data=scan("C:/Documents and Settings/Jaime/Desktop/FALL07/STA5166/BHH2- Data/datahw3.dat") Read 112 items > data [1] 9 10 8 9 8 8 8 7 6 9 10 11 9 10 11 11 11 11 10 11 12 13 12 13 12 [26] 14 15 14 12 13 13 12 13 13 13 13 13 10 8 9 8 6 7 7 6 5 6 5 6 4 [51] 5 4 4 2 4 5 4 5 6 5 5 6 5 6 7 8 8 8 7 9 10 9 10 9 8 [76] 9 8 7 7 8 7 7 7 8 8 8 8 7 6 5 6 5 6 7 6 6 5 6 6 5 [101] 4 3 4 4 5 5 6 5 6 7 6 5 > Mean1wout = mean(c(8,6)) > Mean2with = mean(c(3,4)) > diff_means = Mean2with-Mean1wout > y = c(rep(NA, (109))) > x = c(rep(NA, (109))) > for(i in 1:109){ y[i] = mean(data[i:i+1])} > y [1] 10 8 9 8 8 8 7 6 9 10 11 9 10 11 11 11 11 10 11 12 13 12 13 12 14 [26] 15 14 12 13 13 12 13 13 13 13 13 10 8 9 8 6 7 7 6 5 6 5 6 4 5 [51] 4 4 2 4 5 4 5 6 5 5 6 5 6 7 8 8 8 7 9 10 9 10 9 8 9 [76] 8 7 7 8 7 7 7 8 8 8 8 7 6 5 6 5 6 7 6 6 5 6 6 5 4 [101] 3 4 4 5 5 6 5 6 7 > sort(y) [1] 2 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [26] 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 [51] 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 [76] 9 9 9 9 10 10 10 10 10 10 10 11 11 11 11 11 11 12 12 12 12 12 13 13 13 [101] 13 13 13 13 13 13 14 14 15 > for(j in 1:109){ x[j] = y[j+2] - y[j]} > x [1] -1 0 -1 0 -1 -2 2 4 2 -1 -1 2 1 0 0 -1 0 2 2 0
Background image of page 1

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

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

{[ snackBarMessage ]}