-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsurveyresults.rmd
67 lines (54 loc) · 2.57 KB
/
surveyresults.rmd
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
---
title: "Best Design and Results from Joel's Class"
output:
pdf_document:
fig_height: 8
fig_width: 12
html_document: default
date: April 14, 2014
---
```{r echo=FALSE,warning=FALSE, message=FALSE}
sd<-read.csv("bakerclass_pilot.csv")
```
**Best Design Correlations**
Each row represents a correlation matrix for a block
```{r, echo=FALSE, warning=FALSE, message=FALSE}
new<-sd[,3:18]
for(i in 1:ncol(new)){
new[,i]<-as.numeric(new[,i])
}
colnames(new)<-c("Q1","Q2","Q3","Q4","Q5","Q6","Q7","Q8","Q9","Q10","Q11","Q12","Q13","Q14","Q15")
best<-c(4,1,7,10,8,12,4,1,7,11,9,10,4,1,11,15,12,10,4,1,14,6,2,5,4,1,7,10,2,13,4,1,5,2,9,6,4,1,13,11,15,7,4,1,2,5,13,11,4,1,9,8,15,6,4,1,13,11,9,6,4,1,15,6,7,13,4,1,3,8,14,15,4,1,15,14,7,10,4,1,6,7,11,2,4,1,12,2,3,14,4,1,5,3,9,2,4,1,15,5,8,14,4,1,9,8,15,10,4,1,14,8,13,10,4,1,3,12,6,11,4,1,5,8,10,12,4,1,3,14,12,13,4,1,14,3,2,13,4,1,3,5,12,9)
bm<-matrix(best,ncol=24,nrow=6)
new<-na.omit(new)
```
```{r}
for(i in 1:ncol(bm)){
temp<-new[,c(bm[,i])]
print(cor(temp, use="everything", method="spearman"))
}
```
**Results from Joel's Class**
```{r echo=FALSE}
levels(sd[,2])<-c("16-21","22-29","30-39","40-49","50-59")
levels(sd[,3])<-c("tac","pierce","balance","far")
sd<-sd[,c(4:18)]
for(i in 1:ncol(sd)){
sd[,i]<-as.character(sd[,i])
}
colnames(sd)<-c("Q3:How long have you lived in PS", "Q4:I am attached to Puget Sound region","Q5:I identify with Puget Sound region","Q6:How satisfied with life as whole","Q7:How frequently feel inspired in nature","Q8:How frequently nature reduces stress","Q9:How often outdoor in Winter","Q10:How often outdoor in summer","Q11:How often gather resources","Q12:able to harvest enough resources","Q13:participate in cultural activties","Q14:participate in environmental stewardship","Q15:work with others in community","Q16:trust local policy makers","17:trust experts")
out<-sd
out$id<-1:nrow(out)
require(reshape2)
mout<-melt(out, id="id")
require(ggplot2)
```
```{r Response Histograms, echo=FALSE}
ggplot(mout)+geom_histogram(aes(x=value))+facet_wrap(~variable)+ggtitle("Responses to Individual Questions, Joel's Class")+theme(strip.text.x=element_text(size = 5))
```
```{r Responses Stacked, echo=FALSE}
ggplot(mout)+geom_bar(aes(x=variable,fill=value), position="stack",stat="bin")+theme_bw()+ggtitle("Question Responses Binned, Joel's Class")+xlab("Question")+ylab("Response")+theme(axis.text.x=element_text(angle=70, hjust=1))
```
```{r Response Patterns, echo=FALSE}
ggplot(mout)+geom_line(aes(x=variable, y=value, group=id))+facet_wrap(~id)+ggtitle("Individual Response Patterns")+ylab("Question")+xlab("value")
```