Statistics%203 - PowerPoint PPT Presentation

About This Presentation
Title:

Statistics%203

Description:

Tuesday, 1.15 - 4.15, Maple Practical, in SR G12/13 ... Friday, 10.15 - 11.15, Lecture in LT1. There are ... Two projects for John Phillips on Data Analysis. ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 52
Provided by: jp266
Category:

less

Transcript and Presenter's Notes

Title: Statistics%203


1
Statistics 3
  • F71SC3

2
Contact Times (Summer Term 2008) Monday, 10.15
-11.15, Lecture in LT1 Tuesday, 1.15 - 4.15,
Maple Practical, in SR G12/13 Thursday, 12.15
1.15 and 2.15- 4.15, Data Analysis Practical, in
SR G12/13 Friday, 10.15 - 11.15, Lecture in
LT1 There are three practical groups. All
students should, therefore, attend 2 lectures and
2 one hour practicals each week. AMS Group 1
1.15 on Tues and 3.15 on Thurs Group 2 3.15
on Tues and 2.15 on Thurs
3
The web pages for this module on statistical
computing and computer algebra are at
http//www.macs.hw.ac.uk/jphillips/stats3
and http//www.ma.hw.ac.uk/anatolyk/f71sc3/

4
Assessment

5
Two projects for John Phillips on Data
Analysis. These will be given out in lectures
and students work at them on their own. Three
class tests, given in Tuesday labs, on Anatoly
Konechnys Maple work. No Exam!
6
Statistical Computing
  • Using R

7
Using a statistical package is essential when you
are faced with analysing a large data set. It
would take a long time to do the calculations and
diagrams by hand. There are many packages that
can be used, such as MINITAB and Microsoft Excel,
but the one covered in this course is called R.
8
Example A survey produced the following 200
results of individuals salaries 23454
20622 19314 19882 22467 16611 17790
17613 19892 17397 22340 17731 20058
22083 18055 18212 24114 20396 20394
20521 17643 19692 24214 16876 22545
17608 24631 21333 21797 20734 17836
20930 16709 18319 19097 20512 17693
23130 20316 19209 21220 17315 22102
21472 19974 22764 18183 20918 19358
20685 21261 21394 22333 21732 19734
19280 18696 21055 25762 18258 20255
19762 17016 20326 19479 18699 18686
17483 20843 20395 19734 19911 18990
19220 17313 21357 17514 17455 21932
21523 21606 23169 21461 19624 18931
18785 20225 25406 21376 20141 18541
23768 19024 21353 19802 19216 19442
19450 19385 20995 21162 21399 18805
18217 17847 19992 17105 14488 20522
21032 19191 20268 19996 17428 21877
19433 20625 19453 19081 21502 21890
21844 20116 17601 22296 21751
. 19513 19300 21031 19784
19767 16619 24021 22686 17818 22233
17774 20918 17180 19279 21029 19983
19703 23421 18140 20845 22054 17858
21523 20041 19968 20537 17755 19872
19005 19835 19717 20134 21757 19093
19692 21445 19219 19669 20769 22049
20561 20810 22525 21458 21618 16973
19093 18551 20841 17032 20549 18219
19224 19999 21367 22332 19235 22697
23620 22420 16811 20250 21124 19267
20400 18743 22448 20443 19634 21185
18448 21236 24047 20621
9
Graphical Representation
  • Histogram
  • Stem-and-Leaf
  • Boxplot
  • Frequency Polygon

10
gthist(salaries)
11
Remember, histograms are formed by taking class
intervals, for example Salary() Frequency 14
000 - under 16 000 4 16 000 - under 18
000 30 18 000 - under 20 000 69 20 000 -
under 22 000 70 22 000 - under 24 000 21 24
000 - under 26 000 6
12
gthist(salaries, nclass5)
13
gt stem(salaries) The decimal point is 3
digit(s) to the right of the 14 5 15
16 66789 17 0001233445556666778888889 18
112222334567777889 19 0001111222222233333444
45555667777777888889999 20 0000000111123333344
4445555566667788888999 21 00001122223344444445
555556678888999 22 01112333344555778 23
124568 24 00126 25 48
14
gtboxplot(salaries)
15
(No Transcript)
16
Summary Statistics

17
gt mean(salaries)
18
gt mean(salaries) 1 20123.01
19
gt mean(salaries) 1 20123.01 gt
median(salaries)
20
gt mean(salaries) 1 20123.01 gt
median(salaries) 1 20020
21
gt mean(salaries) 1 20123.01 gt
median(salaries) 1 20020 gt sd(salaries)
22
gt mean(salaries) 1 20123.01 gt
median(salaries) 1 20020 gt sd(salaries) 1
1878.09
23
Scatter Diagrams
24
x y 5 6.2 7 9.3
3 6.0 4 6.1 11 12.8
7 8.1 6 8.1 15 16.7
20 23.4 3 4.7 8 10.5
7 7.7 12 14.0 15
16.6 22 24.2
25
gtplot(x,y)
26
gtplot(yx,pch4)
27
gt plot(x,y) gt abline(lm(yx))
28
Pie Chart Example
29
gt televisionscan( ) 1 1 1 2 2 1 4 3 3 5 5 1 1 1
2 1 3 3 3 3 3 4 1 2 1 3 4 27 Read 26 items
30
gt televisionscan( ) 1 1 1 2 2 1 4 3 3 5 5 1 1 1
2 1 3 3 3 3 3 4 1 2 1 3 4 27 Read 26 items gt
barplot(table(television))
31
(No Transcript)
32
gt television.countstable(television) gt
names(television.counts)c("BBC1","BBC2", "ITV1","
CH4","Other") gtpie(television.counts,colc("purpl
e","green2", "cyan","yellow","white"))
33
(No Transcript)
34
Installing R
  • PC Caledonia

35
Simply double click on the Installer then
select the R icon. This will produce a
short-cut to R which should be available every
time you log on.
36
Installing R
  • On your own pc

37
Download free from the Comprehensive R Archive
Network
http//cran.r-project.org
38
R screen
39
R screen
Type Command hereappears in red
40
R screen
Arrow keys on keyboard are very useful.
Pressing
repeatedly allows you to
retrieve previous commands entered.
41
Many keys and function names are very much as you
would expect.
gt 64 1 10 gt 183 1 54 gt log(100) 1
4.60517 gt pi 1 3.141593 gt sin(pi) 1
1.224606e-16
42
Many keys and function names are very much as you
would expect.
gt cos(pi) 1 -1 gt x7 gt y10 gt xy 1 17 gt
sqrt(xx7xy-2yy) 1 18.41195 gt
43
Binomial Distribution
It takes ages to calculate a series of
probabilities
44
If n 5, a0.2 and x runs from 0 to 5
5! p(0) 0.20
0.85 0! 5! P(0) 0.32768
45
If n 5, a0.2 and x runs from 0 to 5
5! p(1) 0.21
0.84 1! 4! P(1) 0.4096
46
If n 5, a0.2 and x runs from 0 to 5
5! p(2) 0.22
0.83 2! 3! P(2) 0.2048
47
If n 5, a0.2 and x runs from 0 to 5
5! p(2) 0.22
0.83 2! 3! P(2) 0.2048
and so on
48
Using R
gt dbinom(05,5,0.2) 1 0.32768 0.40960
0.20480 0.05120 0.00640 0.00032
49
Using R
gt dbinom(05,5,0.2) 1 0.32768 0.40960
0.20480 0.05120 0.00640 0.00032 gt
pfdbinom(05,5,0.2) gt pf 1 0.32768 0.40960
0.20480 0.05120 0.00640 0.00032 gt
50
Using R
gt pf 1 0.32768 0.40960 0.20480 0.05120
0.00640 0.00032 gt barplot(pf) gt
51
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com