4
> tabel<-read.csv("con3.csv") > mytabel<-xtabs(~S+B+D, data=tabel) > ftable(mytabel) D N Y S B H N 59 2 Y 196 8 L N 169 42 Y 43 11 M N 132 20 Y 104 14 > summary(mytabel) Call: xtabs(formula = ~S + B + D, data = tabel) Number of cases in table: 800 Number of factors: 3 Test for independence of all factors: Chisq = 214.92, df = 7, p-value = 7.883e-43 > library(MASS) > mutual<-loglm(~S+B+D, data=tabel) Error in loglm1.data.frame(formula, data, ..., .call = .call, .formula = .formula) : formula specifies no response > utils:::menuInstallPkgs() --- Please select a CRAN mirror for use in this session --- Warning: package ‘MASS’ is in use and will not be installed > mutual<-loglm(~S+B+D, mytabel) > mutual

Tabel Kontingensi 3 Arah Pake R

Embed Size (px)

DESCRIPTION

ADK

Citation preview

Page 1: Tabel Kontingensi 3 Arah Pake R

> tabel<-read.csv("con3.csv")

> mytabel<-xtabs(~S+B+D, data=tabel)

> ftable(mytabel)

D N Y

S B

H N 59 2

Y 196 8

L N 169 42

Y 43 11

M N 132 20

Y 104 14

> summary(mytabel)

Call: xtabs(formula = ~S + B + D, data = tabel)

Number of cases in table: 800

Number of factors: 3

Test for independence of all factors:

Chisq = 214.92, df = 7, p-value = 7.883e-43

> library(MASS)

> mutual<-loglm(~S+B+D, data=tabel)

Error in loglm1.data.frame(formula, data, ..., .call = .call, .formula = .formula) :

formula specifies no response

> utils:::menuInstallPkgs()

--- Please select a CRAN mirror for use in this session ---

Warning: package ‘MASS’ is in use and will not be installed

> mutual<-loglm(~S+B+D, mytabel)

> mutual

Call:

loglm(formula = ~S + B + D, data = mytabel)

Page 2: Tabel Kontingensi 3 Arah Pake R

Statistics:

X^2 df P(> X^2)

Likelihood Ratio 218.6622 7 0

Pearson 214.9233 7 0

> partial1<-loglin(~S+B+D+S*D, mytabel)

Error in `[<-`(`*tmp*`, seq_along(tmp), k, value = tmp) :

subscript out of bounds

> partial1<-loglin(~S+B+D+S*B, mytabel)

Error in `[<-`(`*tmp*`, seq_along(tmp), k, value = tmp) :

subscript out of bounds

> partial1<-loglm(~S+B+D+S*B, mytabel)

> partial1

Call:

loglm(formula = ~S + B + D + S * B, data = mytabel)

Statistics:

X^2 df P(> X^2)

Likelihood Ratio 36.41467 5 7.846112e-07

Pearson 32.95755 5 3.837184e-06

> partial2<-loglm(~S+B+D+B*D, mytabel)

> partial2

Call:

loglm(formula = ~S + B + D + B * D, data = mytabel)

Statistics:

X^2 df P(> X^2)

Likelihood Ratio 211.0496 6 0

Pearson 196.3599 6 0

> partial3<-loglm(~S+B+D+S*D, mytabel)

Page 3: Tabel Kontingensi 3 Arah Pake R

> partial3

Call:

loglm(formula = ~S + B + D + S * D, data = mytabel)

Statistics:

X^2 df P(> X^2)

Likelihood Ratio 182.4098 5 0

Pearson 172.3441 5 0

> cond1<-loglm(~S+B+D+S*B+S*D, mytabel)

> cond1

Call:

loglm(formula = ~S + B + D + S * B + S * D, data = mytabel)

Statistics:

X^2 df P(> X^2)

Likelihood Ratio 0.1623331 3 0.9834279

Pearson 0.1602389 3 0.9837374

> cond2<-loglm(~S+B+D+S*B+B*D, mytabel)

> cond2

Call:

loglm(formula = ~S + B + D + S * B + B * D, data = mytabel)

Statistics:

X^2 df P(> X^2)

Likelihood Ratio 28.80210 4 8.575375e-06

Pearson 27.37729 4 1.667546e-05

> cond3<-loglm(~S+B+D+S*D+B*D, mytabel)

> cond3

Call:

Page 4: Tabel Kontingensi 3 Arah Pake R

loglm(formula = ~S + B + D + S * D + B * D, data = mytabel)

Statistics:

X^2 df P(> X^2)

Likelihood Ratio 174.7973 4 0

Pearson 165.8395 4 0

>