Data
dat <- read.csv("~/Desktop/472final.csv")
dat <- na.omit(dat)
z <- dat[,c(8,9,10,11)]
z <- na.omit(z)
Correlation
round(cor(z), 3)
## value.health value.profit value.cons value.overall
## value.health 1.000 0.768 0.473 0.781
## value.profit 0.768 1.000 0.415 0.710
## value.cons 0.473 0.415 1.000 0.549
## value.overall 0.781 0.710 0.549 1.000
Scatter Plot (here)
Mean and Standard Deviations
results <- data.frame(
mean = c(mean(dat$value.overall),mean(dat$value.health),mean(dat$value.cons),mean(dat$value.profit)),
sd = c(sd(dat$value.overall),sd(dat$value.health), sd(dat$value.cons), sd(dat$value.profit))
)
row.names(results) <- c("Overall", "Health", "Cons","Profit")
results
## mean sd
## Overall 2.518841 1.215366
## Health 2.573913 1.271747
## Cons 3.220290 1.152926
## Profit 2.162319 1.098241
Question 22
n <- length(dat$region)
one <- subset(dat, dat$q22=="1")
oneFreq <- length(one$region)/n
two <- subset(dat, dat$q22=="2")
twoFreq <- length(two$region)/n
three <- subset(dat, dat$q22=="3")
threeFreq <- length(three$region)/n
four <- subset(dat, dat$q22=="4")
fourFreq <- length(four$region)/n
five <- subset(dat, dat$q22=="5")
fiveFreq <- length(five$region)/n
six <- subset(dat, dat$q22=="6")
sixFreq <- length(six$region)/n
seven <- subset(dat, dat$q22=="7")
sevenFreq <- length(seven$region)/n
q22results <- data.frame(
Frequency = c(oneFreq,twoFreq,threeFreq,fourFreq,fiveFreq,sixFreq,sevenFreq)
)
row.names(q22results) <- c("Animal Health and Wellbeing (1)", "Increase Consumer Confidence (2)",
"Increase Farm Profits (3)", "Helps send High Quality Milk (4)",
"Protects Milk Market (5)", "Unifies Dairy Industry on Animal Welfare (6)",
"Program is Not Important (7)")
q22results
## Frequency
## Animal Health and Wellbeing (1) 0.060869565
## Increase Consumer Confidence (2) 0.426086957
## Increase Farm Profits (3) 0.005797101
## Helps send High Quality Milk (4) 0.020289855
## Protects Milk Market (5) 0.127536232
## Unifies Dairy Industry on Animal Welfare (6) 0.023188406
## Program is Not Important (7) 0.336231884