-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRhistoryOutput
145 lines (145 loc) · 7.17 KB
/
RhistoryOutput
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
library(readxl)
library("readxl")
data=read_excel(file.choose())
area=read_excel(file.choose(),sheet="area")
library(dplyr)
library(broom)
anova_livingroom=aov(Living_room~Area_of_residence,data=area)
summary(anova_livingroom)
anovatable_livingroom=tidy(anova_livingroom)
anovatable_livingroom
plot(anova_livingroom)
plot(anova_livingroom)
plot(anova_livingroom)
manova_results=manova(cbind(Living_room,Bed_room,Kitchen,Dining_room,Bath_room)~Area_of_residence,data-area))
manova_results=manova(cbind(Living_room,Bed_room,Kitchen,Dining_room,Bath_room)~Area_of_residence,data-area)
anova_livingroom=aov(Living_room~Area_of_residence,data=area,header=TRUE)
furnishing$Area_of_residence=as.factor(furnishing$Area_of_residence)
area$Area_of_residence=as.factor(area$Area_of_residence)
manova_results=manova(cbind(Living_room,Bed_room,Kitchen,Dining_room,Bath_room)~Area_of_residence,data=area)
manova_results
manova_results=manova(cbind(Living_room,Bed_room,Kitchen,Dining_room,Bath_room)~Area_of_residence,data=area)
summary(manova_results)
summary.aov(manova_results)
plot(manova_results)
boxplot(Living_room~Area_of_residence,data=area,main="Living Room")
summary(manova_results,test="Wilks"
)
summary(manova_results,test="Wilks")
c=cancor(area[,c("Living_room","Bed_room","Kitchen","Dining_room","Bath_room")],as.matrix(area$Area_of_residence))
library(agricolae)
install.packages("agricolae")
library(agricolae)
library("agricolae")
posthoctest_area=TurkeyHSD(manova_results,"Area_of_residence")
posthoctest_area=TukeyHSD(manova_results,"Area_of_residence")
anova=summary.aov(manova_results)
posthoctest_area=TukeyHSD(anova,"Area_of_residence")
posthoctest_area=TukeyHSD(anova$"Living_room")
p.t.test=pairwise.t.test(area$Living_room,area$Area_of_residence,p.adjust.method="bonferroni")
p.t.test
data=read_excel(file.choose(),sheet="demo")
data=read_excel(file.choose(),sheet="demo")
manova_results=manova(cbind(livingroom,bedroom,kitchen,diningroom,bathroom)~areaofresidence,data=data)
summary.aov(manova_results)
p.t.test=pairwise.t.test(data&livingroom,data$areaofresience,p.adjust.method="bonferroni")
p.t.test=pairwise.t.test(data$livingroom,data$areaofresience,p.adjust.method="bonferroni")
p.t.test=pairwise.t.test(data$livingroom,data$areaofresidence,p.adjust.method="bonferroni")
p.t.test
p.t.test=pairwise.t.test(data$bedroom,data$areaofresidence,p.adjust.method="bonferroni")
p.t.test
p.t.test=pairwise.t.test(data$kitchen,data$areaofresidence,p.adjust.method="bonferroni")
p.t.test
p.t.test=pairwise.t.test(data$diningroom,data$areaofresidence,p.adjust.method="bonferroni")
p.t.test
p.t.test=pairwise.t.test(data$bathroom,data$areaofresidence,p.adjust.method="bonferroni")
p.t.test
summary(manova_results)
library("car")
data=read_excel(file.choose(),sheet="socioeconomic")
manova=manova(cbind(livingroom,bedroom,kitchen,diningroom,bathroom)~sestatus,data=data)
summary(manova)
summary.aov(manova)
p.t.test=pairwise.t.test(data$bathroom,data$sestatus,p.adjust.method="bonferroni")
p.t.test
kruskaltest=kruskal.test(cbind(livingroom,bedroom,kitchen,diningroom,bathroom)~sestatus,data=data)
kruskaltest=oneway.test(cbind(livingroom,bedroom,kitchen,diningroom,bathroom)~sestatus,data=data)
t=TukeyHSD(manova)
data=read_csv(file.choose(),sheet="washfrequency_livingroom")
data=read_excel(file.choose(),sheet="washfrequency_livingroom")
cont.table.livingroom=with(data,table(Daily,Weekly,Monthly,Yearly,Seasonally))
chisq=chisq.test(table)
chisq=chisq.test(cont.table.livingroom)
chisq=fisher.test(cont.table.livingroom)
conttable=table((data$Daily,data$Weekly,data$Monthly,data$Yearly,data$Seasonally),data$Items)
conttable=xtabs(~Items+.,data=data)
peint(conttable)
print(conttable)
washliving=data.frame(sofaordiwan=c(4,17,18,0,2),sofaordiwancover=c(9,33,29,6,9),flowervaseplacemats=c(1,3,3,1,2),cushion=c(1,17,24,3,7),cushioncases=c(3,12,30,2,2),rugs=c(4,17,5,3,5),curtains=c(0,12,45,9,14),carpets=c(4,21,21,0,4),draperies=c(0,5,5,3,2),frequency=c("daily","weekly","monthly","yearly","seasonally"))
cont.table=xtabs(~frequency+.,data=washlivings[,10])
cont.table=xtabs(~frequency+.,data=washliving[,10])
cont.table=xtabs(~frequency,data=washliving[,10])
cont.table=xtabs(~frequency,data=washliving[,-10])
chisq.test(washliving)
cont.table=xtabs(~frequency+.,data=washliving[,-10])
washliving$freq=as.factor(washliving$frequency)
cont.table=xtabs(~frequency+.,data=washliving)
cont.table
fisher.test(cont.table)
library(vcd)
install.packages("vcd")
library(vcd)
library("vcd")
fisher.test(cont.table)
ct=data.frame(item=c("s","sc","fp","c","cc","r","cu","ca","dr"),daily=c(4,9,1,1,3,4,0,4,0),weekly=c(17,33,3,17,12,17,12,21,5),monthly=c(18,29,3,24,30,5,45,21,5),yearly=c(0,6,1,3,2,3,9,0,3),seasonally=c(2,9,2,7,2,5,14,4,2))
ct
cct=as.table(ct)
cct=xtabs(items+daily)
cct=xtabs(items+daily+weekly+monthly+yearly+seasonally)
cct=xtabs(item+daily+weekly+monthly+yearly+seasonally)
cct=xtabs(item+daily+weekly+monthly+yearly+seasonally,data=ct)
cct=xtabs(-item+daily+weekly+monthly+yearly+seasonally,data=ct)
cct=xtabs(~item+daily+weekly+monthly+yearly+seasonally,data=ct)
cct
ct=data.frame(item=c("s","sc","fp","c","cc","r","cu","ca","dr"),daily=c(4,9,1,1,3,4,0,4,0),weekly=c(17,33,3,17,12,17,12,21,5),monthly=c(18,29,3,24,30,5,45,21,5),yearly=c(0,6,1,3,2,3,9,0,3),seasonally=c(2,9,2,7,2,5,14,4,2))
cct=xtabs(~item+daily+weekly+monthly+yearly+seasonally,data=ct)
ftest=fisher.test(cct)
ftest=chisq.test(cct)
ftest=chisq.test(ct)
ftest=kruskal.test(cct)
g=glm(items~daily+weekly+monthly+yearly+seasonally,data=ct)
g=glm(item~daily+weekly+monthly+yearly+seasonally,data=ct)
cct=xtabs(item~daily+weekly+monthly+yearly+seasonally,data=ct)
washliving=data.frame(sofaordiwan=c(4,17,18,0,2),sofaordiwancover=c(9,33,29,6,9),flowervaseplacemats=c(1,3,3,1,2),cushion=c(1,17,24,3,7),cushioncases=c(3,12,30,2,2),rugs=c(4,17,5,3,5),curtains=c(0,12,45,9,14),carpets=c(4,21,21,0,4),draperies=c(0,5,5,3,2),frequency=c("daily","weekly","monthly","yearly","seasonally"))
wahliving
washliving
as.numeric(washliving$rugs)
r=as.numeric(washliving$rugs)
sd=as.numeric(washliving$sofaordiwan)
sdc=as.numeric(washliving$sofaordiwancover)
fwp=as.numeric(washliving$flowerwaseplacemats)
c=as.numeric(washliving$cushion)
cc=as.numeric(washliving$cushioncases)
cu=as.numeric(washliving$curtains)
ca=as.numeric(washliving$carpets)
dr=as.numeric(washliving$draperies)
result=glm(r+sd+sdc+fwp+c+cc+cu+ca+dr~frequency,data=washliving,family=poisson)
result=glm(frequenct~r+sd+sdc+fwp+c+cc+cu+ca+dr,data=washliving,family=poisson)
result=glm(frequency~r+sd+sdc+fwp+c+cc+cu+ca+dr,data=washliving,family=poisson)
result=fisher.test(frequency~r+sd+sdc+fwp+c+cc+cu+ca+dr,data=washliving)
washliving=data.frame(sofaordiwan=c(4,17,18,0,2),sofaordiwancover=c(9,33,29,6,9),flowervaseplacemats=c(1,3,3,1,2),cushion=c(1,17,24,3,7),cushioncases=c(3,12,30,2,2),rugs=c(4,17,5,3,5),curtains=c(0,12,45,9,14),carpets=c(4,21,21,0,4),draperies=c(0,5,5,3,2),frequency=c("daily","weekly","monthly","yearly","seasonally"))
summary(washliving)
head(washliving)
dm=as.matrix(washliving[,-1])
chisq.test(dm)
any(dm<0)
any(!is.finite(dm))
dm[dm<0]=0
dm[!is.finite(dm)]=NA
chisq.test(dm)
dm
d=read_excel(file.choose(),sheet="washfrequency_livingroom")
cct=xtabs(item~daily+weekly+monthly+yearly+seasonally,data=d)
d=read_excel(file.choose(),sheet="washfrequency_livingroom")
fisher.test(d)
q()