Sie sind auf Seite 1von 14

n=40

> alpha=0.05

> sigma=5

> rata=98

> rata0=100

> Z=(rata-rata0)/(sigma/sqrt(n))

>Z

[1] -2.529822

> qnorm(1-alpha/2)

[1] 1.959964

> gnorm

Error: object 'gnorm' not found

> x=c(13,14,12,16,12,11)

> n=length(x)

>n

[1] 6

> mu0=12.3

> sd(x)

[1] 1.788854

> mean(x)

[1] 13

> t=(mean(x)-mu0)/(sd(x)/sqrt(n))

>t

[1] 0.9585145

> alpha=0.05
> qt=(1-alpha/2,n-1)

Error: unexpected ',' in "qt=(1-alpha/2,"

> alpha=0.05

> qt=(1-alpha/2,5)

Error: unexpected ',' in "qt=(1-alpha/2,"

> alpha=0.05

> qt(1-alpha/2,5)

[1] 2.570582

> alpha=0.05

> qt(1-alpha/2,n-1)

[1] 2.570582

> data=read.csv("prauts.csv",header=TRUE, Sep=",")

Error in read.table(file = file, header = header, sep = sep, quote = quote, :

unused argument (Sep = ",")

> data=read.csv("prauts.csv",header=TRUE, Sep=";")

Error in read.table(file = file, header = header, sep = sep, quote = quote, :

unused argument (Sep = ";")

> data=read.csv("prauts.csv",header=TRUE,sep=";")

> data

No.A.B

1 1,80,68

2 2,90,57

3 3,70,46

4 4,86,57

5 5,82,44
6 6,88,51

7 7,91,62

8 8,93,54

9 9,80,49

10 10,79,48

11 11,89,64

12 12,88,48

13 13,85,58

14 14,79,55

15 15,91,52

> t.test(A,B,alternative = ("two.sided",

Error: unexpected ',' in "t.test(A,B,alternative = ("two.sided","

> ,mu = 0, paired = FALSE,

Error: unexpected ',' in ","

> var.equal = FALSE, conf.level = 0.95)

Error: unexpected ',' in "var.equal = FALSE,"

> t.test(A,B,alternative = ("two.sided",mu = 0, paired = FALSE,var.equal = FALSE, conf.level = 0.95)

Error: unexpected ',' in "t.test(A,B,alternative = ("two.sided","

> t.test(A,B,alternative ="two.sided",mu = 0, paired = FALSE,

+ var.equal = FALSE, conf.level = 0.95)

Welch Two Sample t-test

data: A and B

t = 0.5955, df = 7.8063, p-value = 0.5684


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

95 percent confidence interval:

-21.8422 36.9622

sample estimates:

mean of x mean of y

32.74 25.18

> t.test(data$A,data$B,alternative ="two.sided",mu = 0, paired = FALSE,

+ var.equal = FALSE, conf.level = 0.95)

Error in var(x) : 'x' is NULL

In addition: Warning messages:

1: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'

2: In mean.default(x) : argument is not numeric or logical: returning NA

> data=read.csv("soal4.csv",header=TRUE,sep=",")

> data

Sebelum Sesudah

1 76.85 76.22

2 77.95 77.89

3 78.65 79.02

4 79.25 80.21

5 82.65 82.65

6 88.15 82.53

7 92.54 92.56

8 96.25 92.33

9 84.56 85.12
10 88.25 84.56

> t.test(Sebelum,Sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Error in t.test(Sebelum, Sesudah, alternative = "two.sided", mu = 0, paired = TRUE, :

object 'Sebelum' not found

> t.test(sebelum,sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Error in t.test(sebelum, sesudah, alternative = "two.sided", mu = 0, paired = TRUE, :

object 'sebelum' not found

> t.test(data$sebelum,data$sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Error in t.test.default(data$sebelum, data$sesudah, alternative = "two.sided", :

'y' is missing for paired test

> t.test(data$Sebelum,data$Sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Paired t-test

data: data$Sebelum and data$Sesudah

t = 1.646, df = 9, p-value = 0.1342

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

95 percent confidence interval:

-0.4495979 2.8515979

sample estimates:

mean of the differences


1.201

>

> sebelum=c(6,8,7,10,9,7)

> sesudah=c(5,6,7,8,7,5)

> sebelum

[1] 6 8 7 10 9 7

> sesudah

[1] 5 6 7 8 7 5

> t.test(data$sebelum,data$sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Error in t.test.default(data$sebelum, data$sesudah, alternative = "two.sided", :

'y' is missing for paired test

> t.test(data$sebelum,data$sesudah,alternative ="two.sided",mu = 0, paired = FALSE,

+ var.equal = FALSE, conf.level = 0.95)

Error in var(x) : 'x' is NULL

In addition: Warning messages:

1: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'

2: In mean.default(x) : argument is not numeric or logical: returning NA

> t.test(sebelum,sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Paired t-test

data: sebelum and sesudah


t = 4.3916, df = 5, p-value = 0.007078

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

95 percent confidence interval:

0.6219791 2.3780209

sample estimates:

mean of the differences

1.5

> prop.test(165, 250, p = 0.65, alternative ="two.sided",

+ conf.level = 0.95)

1-sample proportions test with continuity correction

data: 165 out of 250, null probability 0.65

X-squared = 0.07033, df = 1, p-value = 0.7909

alternative hypothesis: true p is not equal to 0.65

95 percent confidence interval:

0.5972030 0.7177908

sample estimates:

0.66

> n=40

> alpha=0.05

> sigma=5
> rata=98

> rata0=100

> Z=(rata-rata0)/(sigma/sqrt(n))

>Z

[1] -2.529822

> qnorm(1-alpha/2)

[1] 1.959964

> gnorm

Error: object 'gnorm' not found

> x=c(13,14,12,16,12,11)

> n=length(x)

>n

[1] 6

> mu0=12.3

> sd(x)

[1] 1.788854

> mean(x)

[1] 13

> t=(mean(x)-mu0)/(sd(x)/sqrt(n))

>t

[1] 0.9585145

> alpha=0.05

> qt=(1-alpha/2,n-1)

Error: unexpected ',' in "qt=(1-alpha/2,"

> alpha=0.05
> qt=(1-alpha/2,5)

Error: unexpected ',' in "qt=(1-alpha/2,"

> alpha=0.05

> qt(1-alpha/2,5)

[1] 2.570582

> alpha=0.05

> qt(1-alpha/2,n-1)

[1] 2.570582

> data=read.csv("prauts.csv",header=TRUE, Sep=",")

Error in read.table(file = file, header = header, sep = sep, quote = quote, :

unused argument (Sep = ",")

> data=read.csv("prauts.csv",header=TRUE, Sep=";")

Error in read.table(file = file, header = header, sep = sep, quote = quote, :

unused argument (Sep = ";")

> data=read.csv("prauts.csv",header=TRUE,sep=";")

> data

No.A.B

1 1,80,68

2 2,90,57

3 3,70,46

4 4,86,57

5 5,82,44

6 6,88,51

7 7,91,62

8 8,93,54
9 9,80,49

10 10,79,48

11 11,89,64

12 12,88,48

13 13,85,58

14 14,79,55

15 15,91,52

> t.test(A,B,alternative = ("two.sided",

Error: unexpected ',' in "t.test(A,B,alternative = ("two.sided","

> ,mu = 0, paired = FALSE,

Error: unexpected ',' in ","

> var.equal = FALSE, conf.level = 0.95)

Error: unexpected ',' in "var.equal = FALSE,"

> t.test(A,B,alternative = ("two.sided",mu = 0, paired = FALSE,var.equal = FALSE, conf.level = 0.95)

Error: unexpected ',' in "t.test(A,B,alternative = ("two.sided","

> t.test(A,B,alternative ="two.sided",mu = 0, paired = FALSE,

+ var.equal = FALSE, conf.level = 0.95)

Welch Two Sample t-test

data: A and B

t = 0.5955, df = 7.8063, p-value = 0.5684

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

95 percent confidence interval:

-21.8422 36.9622
sample estimates:

mean of x mean of y

32.74 25.18

> t.test(data$A,data$B,alternative ="two.sided",mu = 0, paired = FALSE,

+ var.equal = FALSE, conf.level = 0.95)

Error in var(x) : 'x' is NULL

In addition: Warning messages:

1: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'

2: In mean.default(x) : argument is not numeric or logical: returning NA

> data=read.csv("soal4.csv",header=TRUE,sep=",")

> data

Sebelum Sesudah

1 76.85 76.22

2 77.95 77.89

3 78.65 79.02

4 79.25 80.21

5 82.65 82.65

6 88.15 82.53

7 92.54 92.56

8 96.25 92.33

9 84.56 85.12

10 88.25 84.56

> t.test(Sebelum,Sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)


Error in t.test(Sebelum, Sesudah, alternative = "two.sided", mu = 0, paired = TRUE, :

object 'Sebelum' not found

> t.test(sebelum,sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Error in t.test(sebelum, sesudah, alternative = "two.sided", mu = 0, paired = TRUE, :

object 'sebelum' not found

> t.test(data$sebelum,data$sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Error in t.test.default(data$sebelum, data$sesudah, alternative = "two.sided", :

'y' is missing for paired test

> t.test(data$Sebelum,data$Sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Paired t-test

data: data$Sebelum and data$Sesudah

t = 1.646, df = 9, p-value = 0.1342

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

95 percent confidence interval:

-0.4495979 2.8515979

sample estimates:

mean of the differences

1.201

>
> sebelum=c(6,8,7,10,9,7)

> sesudah=c(5,6,7,8,7,5)

> sebelum

[1] 6 8 7 10 9 7

> sesudah

[1] 5 6 7 8 7 5

> t.test(data$sebelum,data$sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Error in t.test.default(data$sebelum, data$sesudah, alternative = "two.sided", :

'y' is missing for paired test

> t.test(data$sebelum,data$sesudah,alternative ="two.sided",mu = 0, paired = FALSE,

+ var.equal = FALSE, conf.level = 0.95)

Error in var(x) : 'x' is NULL

In addition: Warning messages:

1: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'

2: In mean.default(x) : argument is not numeric or logical: returning NA

> t.test(sebelum,sesudah,alternative ="two.sided",mu = 0, paired = TRUE,

+ var.equal = FALSE, conf.level = 0.95)

Paired t-test

data: sebelum and sesudah

t = 4.3916, df = 5, p-value = 0.007078

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

95 percent confidence interval:


0.6219791 2.3780209

sample estimates:

mean of the differences

1.5

> prop.test(165, 250, p = 0.65, alternative ="two.sided",

+ conf.level = 0.95)

1-sample proportions test with continuity correction

data: 165 out of 250, null probability 0.65

X-squared = 0.07033, df = 1, p-value = 0.7909

alternative hypothesis: true p is not equal to 0.65

95 percent confidence interval:

0.5972030 0.7177908

sample estimates:

0.66

>