Read Data, Plot Missing

minoo=read.csv("C:/Users/lfult/Desktop/Minoo/total.csv")
library(Amelia)
## Warning: package 'Amelia' was built under R version 3.5.3
## Loading required package: Rcpp
## Warning: package 'Rcpp' was built under R version 3.5.3
## ## 
## ## Amelia II: Multiple Imputation
## ## (Version 1.7.6, built: 2019-11-24)
## ## Copyright (C) 2005-2020 James Honaker, Gary King and Matthew Blackwell
## ## Refer to http://gking.harvard.edu/amelia/ for more information
## ##
library(maps)
## Warning: package 'maps' was built under R version 3.5.3
missmap(minoo)

Impute Missing (Simple)

for (i in 8:ncol(minoo)){
minoo[,i][is.na(minoo[,i])] = median(minoo[,i], na.rm=TRUE)
}
missmap(minoo)

Get Descriptives

library(psych)
## Warning: package 'psych' was built under R version 3.5.3
describe(minoo[,8:117])
##                          vars   n mean   sd median trimmed mad min max range
## Green                       1 126 0.75 0.43      1    0.81   0   0   1     1
## Providence                  2 126 0.36 0.48      0    0.32   0   0   1     1
## Springfield                 3 126 0.25 0.43      0    0.19   0   0   1     1
## France                      4 126 0.00 0.00      0    0.00   0   0   0     0
## Table                       5 126 0.87 0.33      1    0.96   0   0   1     1
## Diner                       6 126 0.29 0.46      0    0.25   0   0   1     1
## Fast_Food                   7 126 0.19 0.39      0    0.12   0   0   1     1
## Coffee_Shop                 8 126 0.17 0.38      0    0.10   0   0   1     1
## Fine_Dining                 9 126 0.28 0.45      0    0.23   0   0   1     1
## Deli                       10 126 0.05 0.21      0    0.00   0   0   1     1
## Takeout                    11 126 0.12 0.33      0    0.03   0   0   1     1
## Casual_Dining              12 126 0.49 0.50      0    0.49   0   0   1     1
## Breakfast                  13 126 0.40 0.49      0    0.38   0   0   1     1
## Lunch                      14 126 0.88 0.33      1    0.97   0   0   1     1
## Dinner                     15 126 0.73 0.45      1    0.78   0   0   1     1
## Snacks                     16 126 0.33 0.47      0    0.29   0   0   1     1
## Other                      17 126 0.06 0.23      0    0.00   0   0   1     1
## G100                       18 126 0.36 0.48      0    0.32   0   0   1     1
## GE50                       19 126 0.29 0.45      0    0.24   0   0   1     1
## GE25                       20 126 0.22 0.42      0    0.16   0   0   1     1
## L25                        21 126 0.12 0.33      0    0.03   0   0   1     1
## Plastic_Recycled           22 126 0.40 0.49      0    0.37   0   0   1     1
## Plastic_Resold             23 126 0.01 0.09      0    0.00   0   0   1     1
## Plastic_Reused             24 126 0.02 0.13      0    0.00   0   0   1     1
## Plastic_Thrownout          25 126 0.68 0.47      1    0.73   0   0   1     1
## Metal_Recycled             26 126 0.34 0.48      0    0.30   0   0   1     1
## Metal_Resold               27 126 0.02 0.15      0    0.00   0   0   1     1
## Metal_Reused               28 126 0.02 0.15      0    0.00   0   0   1     1
## Metal_Thrownout            29 126 0.48 0.50      0    0.48   0   0   1     1
## Appliances_Recycled        30 126 0.48 0.50      0    0.48   0   0   1     1
## Appliances_Resold          31 126 0.17 0.38      0    0.10   0   0   1     1
## Appliances_Reused          32 126 0.18 0.39      0    0.11   0   0   1     1
## Appliances_Thrownout       33 126 0.28 0.45      0    0.23   0   0   1     1
## Boxes_Recycled             34 126 0.71 0.46      1    0.75   0   0   1     1
## Boxes_Resold               35 126 0.00 0.00      0    0.00   0   0   0     0
## Boxes_Reused               36 126 0.00 0.00      0    0.00   0   0   0     0
## Boxes_Thrownout            37 126 0.21 0.41      0    0.15   0   0   1     1
## Glass_Recycled             38 126 0.60 0.49      1    0.62   0   0   1     1
## Glass_Resold               39 126 0.01 0.09      0    0.00   0   0   1     1
## Glass_Reused               40 126 0.02 0.15      0    0.00   0   0   1     1
## Glass_Thrownout            41 126 0.37 0.48      0    0.33   0   0   1     1
## Bags_Recycled              42 126 0.11 0.32      0    0.02   0   0   1     1
## Bags_Resold                43 126 0.02 0.13      0    0.00   0   0   1     1
## Bags_Reused                44 126 0.04 0.29      0    0.00   0   0   3     3
## Bags_Thrownout             45 126 0.77 0.42      1    0.83   0   0   1     1
## GreaseOil_Recycled         46 126 0.63 0.49      1    0.66   0   0   1     1
## GreaseOil_Resold           47 126 0.17 0.37      0    0.09   0   0   1     1
## GreaseOil_Reused           48 126 0.06 0.24      0    0.00   0   0   1     1
## GreaseOil_Thrownout        49 126 0.18 0.39      0    0.11   0   0   1     1
## OfficeSupplies_Recycled    50 126 0.26 0.44      0    0.21   0   0   1     1
## OfficeSupplies_Resold      51 126 0.02 0.15      0    0.00   0   0   1     1
## OfficeSupplies_Reused      52 126 0.13 0.34      0    0.05   0   0   1     1
## OfficeSupplies_Thrownout   53 126 0.43 0.50      0    0.41   0   0   1     1
## Meatbyproducts_Recycled    54 126 0.06 0.24      0    0.00   0   0   1     1
## Meatbyproducts_Resold      55 126 0.00 0.00      0    0.00   0   0   0     0
## Meatbyproducts_Reused      56 126 0.03 0.18      0    0.00   0   0   1     1
## Meatbyproducts_Thrownout   57 126 0.71 0.46      1    0.75   0   0   1     1
## Veggies_Recycled           58 126 0.08 0.27      0    0.00   0   0   1     1
## Veggies_Resold             59 126 0.00 0.00      0    0.00   0   0   0     0
## Veggies_Reused             60 126 0.02 0.15      0    0.00   0   0   1     1
## Veggies_Thrownout          61 126 0.71 0.46      1    0.75   0   0   1     1
## Customer_Food_Recy         62 126 0.03 0.18      0    0.00   0   0   1     1
## Customer_Food_Resold       63 126 0.02 0.13      0    0.00   0   0   1     1
## Customer_Food_ThrownOut    64 126 0.98 0.15      1    1.00   0   0   1     1
## Spoiled_Food_Recy          65 126 0.04 0.20      0    0.00   0   0   1     1
## Spoiled_Food_Resold        66 126 0.00 0.00      0    0.00   0   0   0     0
## Spoiled_Food_ThrownOut     67 126 0.90 0.31      1    0.99   0   0   1     1
## Q17                        68 126 2.82 0.81      3    2.94   0   0   5     5
## BoilH20_Food_Recy          69 126 0.10 0.31      0    0.01   0   0   1     1
## BoilH20_Food_Resold        70 126 0.00 0.00      0    0.00   0   0   0     0
## BoilH20_Food_ThrownOut     71 126 0.78 0.42      1    0.84   0   0   1     1
## Bread_Donated              72 126 0.12 0.33      0    0.03   0   0   1     1
## Bread_Recycled             73 126 0.08 0.27      0    0.00   0   0   1     1
## Bread_Resold               74 126 0.02 0.13      0    0.00   0   0   1     1
## Bread_Reused               75 126 0.25 0.44      0    0.20   0   0   1     1
## Bread_Thrown_Out           76 126 0.39 0.49      0    0.36   0   0   1     1
## Unused_Donated             77 126 0.12 0.33      0    0.03   0   0   1     1
## Unused_Recycled            78 126 0.08 0.27      0    0.00   0   0   1     1
## Unused_Resold              79 126 0.06 0.23      0    0.00   0   0   1     1
## Unused_Reused              80 126 0.31 0.46      0    0.26   0   0   1     1
## Unused_Thrown_Out          81 126 0.32 0.47      0    0.27   0   0   1     1
## Heating_Gas                82 126 0.36 0.48      0    0.32   0   0   1     1
## Heating_Electric           83 126 0.48 0.50      0    0.48   0   0   1     1
## Heating_Oil                84 126 0.04 0.20      0    0.00   0   0   1     1
## Heating_Solar              85 126 0.00 0.00      0    0.00   0   0   0     0
## Heating_Other              86 126 0.03 0.18      0    0.00   0   0   1     1
## Cooling_Gas                87 126 0.11 0.32      0    0.02   0   0   1     1
## Cooling_Electric           88 126 0.78 0.42      1    0.84   0   0   1     1
## Cooling_Oil                89 126 0.01 0.09      0    0.00   0   0   1     1
## Cooling_Solar              90 126 0.00 0.00      0    0.00   0   0   0     0
## Cooling_Other              91 126 0.05 0.21      0    0.00   0   0   1     1
## Finance_SA                 92 126 0.37 0.48      0    0.33   0   0   1     1
## Finance_A                  93 126 0.33 0.47      0    0.28   0   0   1     1
## Finance_N                  94 126 0.22 0.42      0    0.16   0   0   1     1
## Finance_D                  95 126 0.04 0.20      0    0.00   0   0   1     1
## Finance_SD                 96 126 0.02 0.15      0    0.00   0   0   1     1
## Rep_SA                     97 126 0.44 0.50      0    0.43   0   0   1     1
## Rep_A                      98 126 0.31 0.46      0    0.26   0   0   1     1
## Rep_N                      99 126 0.19 0.39      0    0.12   0   0   1     1
## Rep_D                     100 126 0.00 0.00      0    0.00   0   0   0     0
## Rep_SD                    101 126 0.02 0.13      0    0.00   0   0   1     1
## Cust_SA                   102 126 0.33 0.47      0    0.28   0   0   1     1
## Cust_A                    103 126 0.29 0.46      0    0.25   0   0   1     1
## Cust_N                    104 126 0.32 0.47      0    0.27   0   0   1     1
## Cust_D                    105 126 0.02 0.15      0    0.00   0   0   1     1
## Cust_SD                   106 126 0.01 0.09      0    0.00   0   0   1     1
## Compost                   107 126 0.04 0.20      0    0.00   0   0   1     1
## Have_Training             108 126 0.33 0.47      0    0.28   0   0   1     1
## Want_Training             109 126 0.44 0.50      0    0.42   0   0   1     1
## Participate_Training      110 126 0.60 0.49      1    0.62   0   0   1     1
##                           skew kurtosis   se
## Green                    -1.17    -0.65 0.04
## Providence                0.59    -1.67 0.04
## Springfield               1.17    -0.65 0.04
## France                     NaN      NaN 0.00
## Table                    -2.21     2.93 0.03
## Diner                     0.90    -1.21 0.04
## Fast_Food                 1.56     0.43 0.04
## Coffee_Shop               1.69     0.88 0.03
## Fine_Dining               0.98    -1.05 0.04
## Deli                      4.20    15.75 0.02
## Takeout                   2.32     3.43 0.03
## Casual_Dining             0.03    -2.01 0.04
## Breakfast                 0.38    -1.87 0.04
## Lunch                    -2.32     3.43 0.03
## Dinner                   -1.02    -0.96 0.04
## Snacks                    0.70    -1.52 0.04
## Other                     3.83    12.80 0.02
## G100                      0.59    -1.67 0.04
## GE50                      0.94    -1.13 0.04
## GE25                      1.32    -0.26 0.04
## L25                       2.32     3.43 0.03
## Plastic_Recycled          0.42    -1.84 0.04
## Plastic_Resold           10.96   119.05 0.01
## Plastic_Reused            7.65    57.05 0.01
## Plastic_Thrownout        -0.77    -1.41 0.04
## Metal_Recycled            0.66    -1.57 0.04
## Metal_Resold              6.17    36.39 0.01
## Metal_Reused              6.17    36.39 0.01
## Metal_Thrownout           0.06    -2.01 0.04
## Appliances_Recycled       0.06    -2.01 0.04
## Appliances_Resold         1.69     0.88 0.03
## Appliances_Reused         1.62     0.64 0.03
## Appliances_Thrownout      0.98    -1.05 0.04
## Boxes_Recycled           -0.90    -1.21 0.04
## Boxes_Resold               NaN      NaN 0.00
## Boxes_Reused               NaN      NaN 0.00
## Boxes_Thrownout           1.38    -0.11 0.04
## Glass_Recycled           -0.38    -1.87 0.04
## Glass_Resold             10.96   119.05 0.01
## Glass_Reused              6.17    36.39 0.01
## Glass_Thrownout           0.55    -1.71 0.04
## Bags_Recycled             2.45     4.01 0.03
## Bags_Resold               7.65    57.05 0.01
## Bags_Reused               8.66    80.43 0.03
## Bags_Thrownout           -1.27    -0.40 0.04
## GreaseOil_Recycled       -0.52    -1.74 0.04
## GreaseOil_Resold          1.77     1.13 0.03
## GreaseOil_Reused          3.54    10.60 0.02
## GreaseOil_Thrownout       1.62     0.64 0.03
## OfficeSupplies_Recycled   1.07    -0.86 0.04
## OfficeSupplies_Resold     6.17    36.39 0.01
## OfficeSupplies_Reused     2.11     2.48 0.03
## OfficeSupplies_Thrownout  0.29    -1.93 0.04
## Meatbyproducts_Recycled   3.54    10.60 0.02
## Meatbyproducts_Resold      NaN      NaN 0.00
## Meatbyproducts_Reused     5.28    26.07 0.02
## Meatbyproducts_Thrownout -0.90    -1.21 0.04
## Veggies_Recycled          3.08     7.52 0.02
## Veggies_Resold             NaN      NaN 0.00
## Veggies_Reused            6.17    36.39 0.01
## Veggies_Thrownout        -0.90    -1.21 0.04
## Customer_Food_Recy        5.28    26.07 0.02
## Customer_Food_Resold      7.65    57.05 0.01
## Customer_Food_ThrownOut  -6.17    36.39 0.01
## Spoiled_Food_Recy         4.66    19.87 0.02
## Spoiled_Food_Resold        NaN      NaN 0.00
## Spoiled_Food_ThrownOut   -2.58     4.68 0.03
## Q17                      -1.16     3.52 0.07
## BoilH20_Food_Recy         2.58     4.68 0.03
## BoilH20_Food_Resold        NaN      NaN 0.00
## BoilH20_Food_ThrownOut   -1.32    -0.26 0.04
## Bread_Donated             2.32     3.43 0.03
## Bread_Recycled            3.08     7.52 0.02
## Bread_Resold              7.65    57.05 0.01
## Bread_Reused              1.12    -0.76 0.04
## Bread_Thrown_Out          0.45    -1.81 0.04
## Unused_Donated            2.32     3.43 0.03
## Unused_Recycled           3.08     7.52 0.02
## Unused_Resold             3.83    12.80 0.02
## Unused_Reused             0.81    -1.35 0.04
## Unused_Thrown_Out         0.77    -1.41 0.04
## Heating_Gas               0.59    -1.67 0.04
## Heating_Electric          0.06    -2.01 0.04
## Heating_Oil               4.66    19.87 0.02
## Heating_Solar              NaN      NaN 0.00
## Heating_Other             5.28    26.07 0.02
## Cooling_Gas               2.45     4.01 0.03
## Cooling_Electric         -1.32    -0.26 0.04
## Cooling_Oil              10.96   119.05 0.01
## Cooling_Solar              NaN      NaN 0.00
## Cooling_Other             4.20    15.75 0.02
## Finance_SA                0.55    -1.71 0.04
## Finance_A                 0.74    -1.47 0.04
## Finance_N                 1.32    -0.26 0.04
## Finance_D                 4.66    19.87 0.02
## Finance_SD                6.17    36.39 0.01
## Rep_SA                    0.22    -1.97 0.04
## Rep_A                     0.81    -1.35 0.04
## Rep_N                     1.56     0.43 0.04
## Rep_D                      NaN      NaN 0.00
## Rep_SD                    7.65    57.05 0.01
## Cust_SA                   0.74    -1.47 0.04
## Cust_A                    0.90    -1.21 0.04
## Cust_N                    0.77    -1.41 0.04
## Cust_D                    6.17    36.39 0.01
## Cust_SD                  10.96   119.05 0.01
## Compost                   4.66    19.87 0.02
## Have_Training             0.74    -1.47 0.04
## Want_Training             0.25    -1.95 0.04
## Participate_Training     -0.38    -1.87 0.04

Graphs by City

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.5.3
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
library(reshape2)
library(reshape)
## Warning: package 'reshape' was built under R version 3.5.2
## 
## Attaching package: 'reshape'
## The following objects are masked from 'package:reshape2':
## 
##     colsplit, melt, recast
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.5.3
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:reshape':
## 
##     rename
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(plyr)
## Warning: package 'plyr' was built under R version 3.5.3
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
## 
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:reshape':
## 
##     rename, round_any
## The following object is masked from 'package:maps':
## 
##     ozone
myplotf=function(x, t){

myt=table(x, minoo$Group)
myt
mysum=apply(myt,2,sum)
for (i in 1:3){myt[1:2,i]=100*myt[,i]/mysum[i]}
myt
mybar=barplot(myt, col=c("dark green", "dark red"),main=t, ylim=c(0,100), ylab="%", cex.lab=1.5,cex.main=1.5)

legend("center", legend=c("Not Thrown Out","Thrown Out"), fill =c("dark green", "dark red"), cex=1)
for (i in 1:3){
text(mybar[i],5, paste0(round(myt[1,i],0), " %") ,cex=1.5, col="white")
text(mybar[i],95, paste0(round(myt[2,i],0), " %") ,cex=1.5, col="white") 

}
lablist<-c("Nancy", "Prov.", "Spring.")
axis(1, at=seq(1, 3, by=1), labels = FALSE)
text(seq(1, 3, by=1), par("usr")[3] -1, labels = lablist, srt = 90, pos = 2, xpd = TRUE, cex=1.5)


}
par(mfrow=c(1,3))
par(xaxt="no")

myplotf(minoo$Plastic_Thrownout, "Plastic")
myplotf(minoo$Metal_Thrownout, "Metal")
myplotf(minoo$Appliances_Thrownout, "Appliances")

myplotf(minoo$Boxes_Thrownout, "Boxes")
myplotf(minoo$Glass_Thrownout, "Glass")
myplotf(minoo$Bags_Thrownout, "Bags")

myplotf(minoo$GreaseOil_Thrownout, "Grease")
myplotf(minoo$OfficeSupplies_Thrownout, "Office Supplies")
myplotf(minoo$Meatbyproducts_Thrownout, "Meat Byproducts")

myplotf(minoo$Veggies_Thrownout, "Vegetables")
myplotf(minoo$Customer_Food_ThrownOut, "Customer Food")
myplotf(minoo$Spoiled_Food_ThrownOut, "Spoiled Food")

myplotf(minoo$BoilH20_Food_ThrownOut, "Boiled Water")
myplotf(minoo$Bread_Thrown_Out, "Bread")
myplotf(minoo$Unused_Thrown_Out, "Unused Food")

Graphs by Green Identification

myplotf2=function(x, t){

myt=table(x, minoo$Green)
myt
mysum=apply(myt,2,sum)
for (i in 1:2){myt[1:2,i]=100*myt[,i]/mysum[i]}
myt
mybar=barplot(myt, col=c("dark green", "dark red"),main=t, ylim=c(0,100), ylab="%", cex.lab=1.5,cex.main=1.5)

legend("center", legend=c("Not Thrown Out","Thrown Out"), fill =c("dark green", "dark red"), cex=1)
for (i in 1:2){
text(mybar[i],5, paste0(round(myt[1,i],0), " %") ,cex=1.5, col="white")
text(mybar[i],95, paste0(round(myt[2,i],0), " %") ,cex=1.5, col="white") 

}
lablist<-c("Green", "Not Green")
axis(1, at=seq(1, 2, by=1), labels = FALSE)
text(seq(1, 2, by=1), par("usr")[3] -1, labels = lablist, srt = 45, pos = 2, xpd = TRUE, cex=1)


}
par(mfrow=c(1,3))
par(xaxt="no")

myplotf2(minoo$Boxes_Thrownout, "Cardboard Boxes")
myplotf2(minoo$Glass_Thrownout, "Glass Bottles")
myplotf2(minoo$Metal_Thrownout, "Metal Containers")

myplotf2(minoo$Plastic_Thrownout, "Plastic Bottles, Straws, etc.")
myplotf2(minoo$Bags_Thrownout, "Plastic Bags")


#myplotf2(minoo$Appliances_Thrownout, "Appliances")



#myplotf2(minoo$GreaseOil_Thrownout, "Grease")
#myplotf2(minoo$OfficeSupplies_Thrownout, "Office Supplies")
#myplotf2(minoo$Meatbyproducts_Thrownout, "Meat Byproducts")
#myplotf2(minoo$Veggies_Thrownout, "Vegetables")
#myplotf2(minoo$Customer_Food_ThrownOut, "Customer Food")
#myplotf2(minoo$Spoiled_Food_ThrownOut, "Spoiled Food")
#myplotf2(minoo$BoilH20_Food_ThrownOut, "Boiled Water")
#myplotf2(minoo$Bread_Thrown_Out, "Bread")
#myplotf2(minoo$Unused_Thrown_Out, "Unused Food")

myt=function(x,y,z){

  a=table(x,y)
  print(z)
  print(a)
  myq=fisher.test(a)
  return(myq)
}

Green vs. Non-Green

myt(minoo$Green, minoo$Metal_Thrownout, "Metal")
## [1] "Metal"
##    y
## x    0  1
##   0 19 12
##   1 46 49
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.2236
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.6856554 4.2514965
## sample estimates:
## odds ratio 
##   1.679598
myt(minoo$Green, minoo$Plastic_Thrownout, "Plastic")
## [1] "Plastic"
##    y
## x    0  1
##   0 12 19
##   1 28 67
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.3776
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.5839896 3.7918712
## sample estimates:
## odds ratio 
##    1.50618
myt(minoo$Green, minoo$Unused_Thrown_Out, "Unused Food")
## [1] "Unused Food"
##    y
## x    0  1
##   0 23  8
##   1 63 32
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.5077
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.5503375 4.2014392
## sample estimates:
## odds ratio 
##   1.456086
#myt(minoo$Green, minoo$BoilH20_Food_Resold, "Boiled Water") constant
myt(minoo$Green, minoo$Bread_Thrown_Out, "Bread")
## [1] "Bread"
##    y
## x    0  1
##   0 16 15
##   1 61 34
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.2887
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.2421494 1.4724039
## sample estimates:
## odds ratio 
##  0.5970536
myt(minoo$Green, minoo$OfficeSupplies_Thrownout, "Office Supplies")
## [1] "Office Supplies"
##    y
## x    0  1
##   0 16 15
##   1 56 39
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.5334
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.3041606 1.8265262
## sample estimates:
## odds ratio 
##  0.7446448
myt(minoo$Green, minoo$Spoiled_Food_ThrownOut, "Spoiled Food")
## [1] "Spoiled Food"
##    y
## x    0  1
##   0  1 30
##   1 12 83
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.1838
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.005226162 1.699429823
## sample estimates:
## odds ratio 
##  0.2324228
myt(minoo$Green, minoo$Glass_Thrownout, "Glass")
## [1] "Glass"
##    y
## x    0  1
##   0 19 12
##   1 61 34
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.8311
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.3561264 2.2531608
## sample estimates:
## odds ratio 
##  0.8834005
myt(minoo$Green, minoo$GreaseOil_Thrownout, "Grease/Oil")
## [1] "Grease/Oil"
##    y
## x    0  1
##   0 24  7
##   1 79 16
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.5924
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.2356884 2.2447007
## sample estimates:
## odds ratio 
##  0.6965265
myt(minoo$Green, minoo$Customer_Food_ThrownOut, "Customer Food")
## [1] "Customer Food"
##    y
## x    0  1
##   0  1 30
##   1  2 93
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.02543396 30.64457484
## sample estimates:
## odds ratio 
##    1.54407
myt(minoo$Green, minoo$Veggies_Thrownout, "Veggies")
## [1] "Veggies"
##    y
## x    0  1
##   0 10 21
##   1 27 68
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.8206
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.4428621 3.0885827
## sample estimates:
## odds ratio 
##   1.197513
myt(minoo$Green, minoo$Boxes_Thrownout, "Boxes")
## [1] "Boxes"
##    y
## x    0  1
##   0 25  6
##   1 74 21
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.4001268 3.9872436
## sample estimates:
## odds ratio 
##   1.180933
myt(minoo$Green, minoo$Meatbyproducts_Thrownout, "Meat Byproducts")
## [1] "Meat Byproducts"
##    y
## x    0  1
##   0 11 20
##   1 26 69
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.4959
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.550382 3.720117
## sample estimates:
## odds ratio 
##   1.455095
myt(minoo$Green, minoo$Appliances_Thrownout, "Appliances")
## [1] "Appliances"
##    y
## x    0  1
##   0 24  7
##   1 67 28
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.4993
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.51883 4.38982
## sample estimates:
## odds ratio 
##   1.428917
myt(minoo$Green, minoo$Bags_Thrownout, "Bags")
## [1] "Bags"
##    y
## x    0  1
##   0  7 24
##   1 22 73
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.3097988 2.7326745
## sample estimates:
## odds ratio 
##  0.9680517

Heating and Cooling Systems

table(minoo$Group, minoo$Heating_Solar)  #no solar
##              
##                0
##   Nancy       50
##   Providence  45
##   Springfield 31
table(minoo$Group, minoo$Cooling_Solar)  #no solar
##              
##                0
##   Nancy       50
##   Providence  45
##   Springfield 31
table(minoo$Group, minoo$Heating_Gas)
##              
##                0  1
##   Nancy       41  9
##   Providence  24 21
##   Springfield 16 15
table(minoo$Group, minoo$Cooling_Gas)
##              
##                0  1
##   Nancy       47  3
##   Providence  39  6
##   Springfield 26  5

City Differences

myt(minoo$Group, minoo$Metal_Thrownout, "Metal")
## [1] "Metal"
##              y
## x              0  1
##   Nancy       17 33
##   Providence  29 16
##   Springfield 19 12
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.005594
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Plastic_Thrownout, "Plastic")
## [1] "Plastic"
##              y
## x              0  1
##   Nancy        9 41
##   Providence  19 26
##   Springfield 12 19
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.02209
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Unused_Thrown_Out, "Unused Food")
## [1] "Unused Food"
##              y
## x              0  1
##   Nancy       28 22
##   Providence  35 10
##   Springfield 23  8
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.05713
## alternative hypothesis: two.sided
#myt(minoo$Group, minoo$BoilH20_Food_Resold, "Boiled Water") constant
myt(minoo$Group, minoo$Bread_Thrown_Out, "Bread")
## [1] "Bread"
##              y
## x              0  1
##   Nancy       36 14
##   Providence  25 20
##   Springfield 16 15
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.1241
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$OfficeSupplies_Thrownout, "Office Supplies")
## [1] "Office Supplies"
##              y
## x              0  1
##   Nancy       34 16
##   Providence  22 23
##   Springfield 16 15
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.1357
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Spoiled_Food_ThrownOut, "Spoiled Food")
## [1] "Spoiled Food"
##              y
## x              0  1
##   Nancy        8 42
##   Providence   4 41
##   Springfield  1 30
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.2039
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Glass_Thrownout, "Glass")
## [1] "Glass"
##              y
## x              0  1
##   Nancy       36 14
##   Providence  25 20
##   Springfield 19 12
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.2431
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$GreaseOil_Thrownout, "Grease/Oil")
## [1] "Grease/Oil"
##              y
## x              0  1
##   Nancy       44  6
##   Providence  35 10
##   Springfield 24  7
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.3272
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Customer_Food_ThrownOut, "Customer Food")
## [1] "Customer Food"
##              y
## x              0  1
##   Nancy        0 50
##   Providence   2 43
##   Springfield  1 30
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.3476
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Veggies_Thrownout, "Veggies")
## [1] "Veggies"
##              y
## x              0  1
##   Nancy       12 38
##   Providence  15 30
##   Springfield 10 21
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.5437
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Boxes_Thrownout, "Boxes")
## [1] "Boxes"
##              y
## x              0  1
##   Nancy       37 13
##   Providence  37  8
##   Springfield 25  6
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.6225
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Meatbyproducts_Thrownout, "Meat Byproducts")
## [1] "Meat Byproducts"
##              y
## x              0  1
##   Nancy       14 36
##   Providence  12 33
##   Springfield 11 20
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.7254
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Appliances_Thrownout, "Appliances")
## [1] "Appliances"
##              y
## x              0  1
##   Nancy       36 14
##   Providence  31 14
##   Springfield 24  7
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.7437
## alternative hypothesis: two.sided
myt(minoo$Group, minoo$Bags_Thrownout, "Bags")
## [1] "Bags"
##              y
## x              0  1
##   Nancy       11 39
##   Providence  11 34
##   Springfield  7 24
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.9635
## alternative hypothesis: two.sided

Belief Structure

minoo$Finance <- minoo$Finance_SD+2*minoo$Finance_D+3*minoo$Finance_N+4*minoo$Finance_A+5*minoo$Finance_SA
myt(minoo$Group, minoo$Finance, "Financial")
## [1] "Financial"
##              y
## x              0  1  2  3  4  5
##   Nancy        1  1  3 11 17 17
##   Providence   1  1  1  9 14 19
##   Springfield  1  1  1  8 10 10
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.9952
## alternative hypothesis: two.sided
minoo$Rep <- minoo$Rep_SD+2*minoo$Rep_D+3*minoo$Rep_N+4*minoo$Rep_A+5*minoo$Rep_SA
myt(minoo$Group, minoo$Rep, "Reputation")
## [1] "Reputation"
##              y
## x              0  1  3  4  5
##   Nancy        1  2 13 15 19
##   Providence   2  0  7 13 23
##   Springfield  2  0  4 11 14
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.5896
## alternative hypothesis: two.sided
minoo$Cust <- minoo$Cust_SD+2*minoo$Cust_D+3*minoo$Cust_N+4*minoo$Cust_A+5*minoo$Cust_SA
myt(minoo$Group, minoo$Cust, "Customers")
## [1] "Customers"
##              y
## x              0  1  2  3  4  5
##   Nancy        2  1  3 21 12 11
##   Providence   1  0  0 10 14 20
##   Springfield  1  0  0  9 11 10
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.1572
## alternative hypothesis: two.sided

Training

myt(minoo$Group,minoo$Have_Training, "Have Training")
## [1] "Have Training"
##              y
## x              0  1
##   Nancy       45  5
##   Providence  24 21
##   Springfield 16 15
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 2.659e-05
## alternative hypothesis: two.sided
myt(minoo$Group,minoo$Want_Training, "Want Training")
## [1] "Want Training"
##              y
## x              0  1
##   Nancy       32 18
##   Providence  24 21
##   Springfield 15 16
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.3574
## alternative hypothesis: two.sided
myt(minoo$Group,minoo$Participate_Training, "Would Participate in Training")
## [1] "Would Participate in Training"
##              y
## x              0  1
##   Nancy       16 34
##   Providence  20 25
##   Springfield 15 16
## 
##  Fisher's Exact Test for Count Data
## 
## data:  a
## p-value = 0.2638
## alternative hypothesis: two.sided

Generalized Linear Model

mylm=glm(minoo$Have_Training~minoo$Group+minoo$Plastic_Thrownout+minoo$Bags_Thrownout, family="binomial")
summary(mylm)
## 
## Call:
## glm(formula = minoo$Have_Training ~ minoo$Group + minoo$Plastic_Thrownout + 
##     minoo$Bags_Thrownout, family = "binomial")
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.6668  -0.8771  -0.3570   1.0505   2.3600  
## 
## Coefficients:
##                         Estimate Std. Error z value Pr(>|z|)    
## (Intercept)              -0.8618     0.6313  -1.365 0.172248    
## minoo$GroupProvidence     1.9641     0.5840   3.363 0.000771 ***
## minoo$GroupSpringfield    2.0897     0.6195   3.373 0.000744 ***
## minoo$Plastic_Thrownout  -0.9375     0.4429  -2.117 0.034294 *  
## minoo$Bags_Thrownout     -0.9218     0.4999  -1.844 0.065205 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 158.98  on 125  degrees of freedom
## Residual deviance: 128.63  on 121  degrees of freedom
## AIC: 138.63
## 
## Number of Fisher Scoring iterations: 5