Você está na página 1de 9

Sumbu tegak apada histogram menytakan peluang (proporsi ) = frekuensi

[Previously saved workspace restored]

> data()

> data=attach(faithful)

> X=faithful

> head(X)
eruptions waiting

1 3.600 79

2 1.800 54

3 3.333 74

4 2.283 62

5 4.533 85

6 2.883 55

> dim(X)

[1] 272 2

> Summary(X[1])

Error in (function (classes, fdef, mtable) :

unable to find an inherited method for function ‘Summary’ for signature ‘"data.frame"’

> summary(X[,1])

Min. 1st Qu. Median Mean 3rd Qu. Max.

1.600 2.163 4.000 3.488 4.454 5.100

> summary(eruption)

Error in summary(eruption) : object 'eruption' not found

> summary(eruptions)

Min. 1st Qu. Median Mean 3rd Qu. Max.

1.600 2.163 4.000 3.488 4.454 5.100

> summary(X)

eruptions waiting

Min. :1.600 Min. :43.0

1st Qu.:2.163 1st Qu.:58.0

Median :4.000 Median :76.0

Mean :3.488 Mean :70.9

3rd Qu.:4.454 3rd Qu.:82.0


Max. :5.100 Max. :96.0

> fivenum(eruptions)

[1] 1.6000 2.1585 4.0000 4.4585 5.1000

> rag=var(X[,1])

> s=sd(X[,1])

> s2=s*s

> s2

[1] 1.302728

> rag

[1] 1.302728

> mn=min(X[,1])

> mx=max(X[,1])

> xb=mean(X[,1])

> md=median(X[,1])

> k1=1st Qu.(X[,1])

Error: unexpected symbol in "k1=1st"

> fivenum(eruptions)

[1] 1.6000 2.1585 4.0000 4.4585 5.1000

> qu=fivenum(eruptions)

> q1=qu[2]

> q3=qu[4]

> Rinkasanku=c(mn,mx,q1,md,xb,q3,s,rag)

> Rinkasanku

[1] 1.600000 5.100000 2.158500 4.000000 3.487783 4.458500 1.141371 1.302728

> summary(X[,1])

Min. 1st Qu. Median Mean 3rd Qu. Max.

1.600 2.163 4.000 3.488 4.454 5.100


> stem(eruption)

Error in stem(eruption) : object 'eruption' not found

> stem(eruptions)

The decimal point is 1 digit(s) to the left of the |

16 | 070355555588

18 | 000022233333335577777777888822335777888

20 | 00002223378800035778

22 | 0002335578023578

24 | 00228

26 | 23

28 | 080

30 | 7

32 | 2337

34 | 250077

36 | 0000823577

38 | 2333335582225577

40 | 0000003357788888002233555577778

42 | 03335555778800233333555577778

44 | 02222335557780000000023333357778888

46 | 0000233357700000023578

48 | 00000022335800333

50 | 0370

> hist(eruptions)

> hist(eruptions, seq(1.6, 5.2, 0.2), prob=TRUE)


> sq=seq(1.6,5.2,0.2)

> sq

[1] 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 5.2

> sq=seq(1.6,5.2,0.02)

> sq

[1] 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88

[16] 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18

[31] 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48

[46] 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78

[61] 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00 3.02 3.04 3.06 3.08

[76] 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38

[91] 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68

[106] 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98

[121] 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28

[136] 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58

[151] 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88

[166] 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18

[181] 5.20

> hist(eruptions, seq(1.6, 5.2, 0.2), prob=TRUE

+ hduhuha

Error: unexpected symbol in:

"

hduhuha"

> hist(eruptions, seq(1.6, 5.2, 0.2), prob=TRUE)

> lines(density(eruptions, bw=0.1))

> rug(eruptions) #show the actual data points


> long <- eruptions[eruptions >3]

> plot(ecdf(long), do.points=FALSE, vertical=TRUE)

Warning messages:

1: In plot.window(...) : "vertical" is not a graphical parameter

2: In plot.xy(xy, type, ...) : "vertical" is not a graphical parameter

3: In axis(side = side, at = at, labels = labels, ...) :

"vertical" is not a graphical parameter

4: In axis(side = side, at = at, labels = labels, ...) :

"vertical" is not a graphical parameter

5: In box(...) : "vertical" is not a graphical parameter

6: In title(...) : "vertical" is not a graphical parameter

> plot(ecdf(long), do.points=FALSE, verticals=TRUE)

> hist(long, seq(3.0, 5.2, 0.2), prob=TRUE)

> lines(density(long,bw=0.2)

+ lines

Error: unexpected symbol in:

"lines(density(long,bw=0.2)

lines"

> lines(density(long, bw=0.2)

+ lines

Error: unexpected symbol in:

"lines(density(long, bw=0.2)

lines"

> lines(density(long, bw=0.2))

> rug(long) #show the actual data points

> short=eruptions < 3]

Error: unexpected ']' in "short=eruptions < 3]"


> short=eruptions[eruptions < 3]

> hist(short, seq(1.6, 3.0, 0.15), prob=TRUE

+ hist

Error: unexpected symbol in:

"hist(short, seq(1.6, 3.0, 0.15), prob=TRUE

hist"

> hist(short, seq(1.6, 3.0, 0.15), prob=TRUE)

> lines(density(short, bw=0.3))

> rug(short) #show the actual data point

> n=lenght(X[,1])

Error in lenght(X[, 1]) : could not find function "lenght"

> n=length(X[,1])

>n

[1] 272

> X1=X[,1]

> X100=X1[1:100]

> length(X100)

[1] 100

> hist(X100, seq(1.6, 5.2, 0.15), prob=TRUE)

> XL100=X1[173:n]

> length(XL100)

[1] 100

> hist(XL100, seq(1.6, 5.2, 0.15), prob=TRUE)

> par(pty="s") #arrange for a squre figure region

> qqnorm(long); qqline(long)

> A=scan()

1:
Read 0 items

> A=scan()

1:

Read 0 items

> B=scan()

1:

Read 0 items

> A=scan()

1: 79.98 80.04 80.02 80.04 80.03 80.03 80.04 79.97

9: 80.05 80.03 80.02

12: 80.00 80.02

14:

Read 13 items

> B=scan()

1: 80.02 79.94 79.98 79.97 80.03 79.95 79.97

8:

Read 7 items

> t.test(A, B)

Welch Two Sample t-test

data: A and B

t = 2.8399, df = 9.3725, p-value = 0.01866

alternative hypothesis: true difference in means is not equal to 0

95 percent confidence interval:

0.008490037 0.073048425

sample estimates:
mean of x mean of y

80.02077 79.98000

Você também pode gostar