-
Notifications
You must be signed in to change notification settings - Fork 1
/
.Rhistory
319 lines (319 loc) · 10.8 KB
/
.Rhistory
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
?kable
??kable
#load the tidyverse and the dataset
library(tidyverse)
data <- read_csv("./data_raw/fricatives.csv")
#get an idea of what the data look like
str(data)
data <- read.csv("./data_raw/fricatives.csv")
#get an idea of what the data look like
str(data)
View(data)
?dplyr
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, obs, -obs)
View(data)
?separate
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, obs, -obs) %>%
separate(., meas, into = c("segment, meas"), remove = T)
data <- read_csv("./data_raw/fricatives.csv")
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, obs, -obs) %>%
separate(., meas, into = c("segment, meas"), remove = T)
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("segment, meas"), remove = T)
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("segment, meas"), sep = "_", remove = T)
data %>%
gather(., meas, val, -obs)
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("segment", "meas"), sep = "_", remove = T)
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T)
data <- read_csv("./data_raw/fricatives.csv")
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T)
?unite
?spread
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
data %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
fric <- read_csv("./data_raw/fricatives.csv")
#get an idea of what the data look like
str(fric)
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
tidy_fric <- fric %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
View(tidy_fric)
View(fric)
?broom
View(tidy_fric)
#table of descriptive statistics
tidy_fric %>%
group_by(., "phoneme") %>%
summarize(., mean = mean, sd = sd)
View(tidy_fric)
#table of descriptive statistics
tidy_fric %>%
group_by(., "phoneme") %>%
summarize(., mean_cog = mean(cog), sd_cog = sd(cog),
mean_skew = mean(skewness), sd_skew = sd(skewness))
View(tidy_fric)
#table of descriptive statistics
tidy_fric %>%
group_by(., phoneme) %>%
summarize(., mean_cog = mean(cog), sd_cog = sd(cog),
mean_skew = mean(skewness), sd_skew = sd(skewness))
#boxplot of center of gravity as function of phoneme
tidy_fric %>%
#boxplot of center of gravity as function of phoneme
tidy_fric %>%
#boxplot of center of gravity as function of phoneme
tidy_fric %>%
#boxplot of center of gravity as function of phoneme
tidy_fric %>%
ggplot(., aes(phoneme, cog))+
geom_boxplot()
#boxplot of center of gravity as function of phoneme
tidy_fric %>%
ggplot(aes(phoneme, cog))+
geom_boxplot()
??statistical transformation
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary()
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.ymin = min, fun.ymax = max, fun.y = median)
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_cl_boot)
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_sdl)
?mean_sdl
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_cl_boot)
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_cl_boot)+
ylim(0,0.7)
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_cl_boot)
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_cl_boot) +
ylim(-1,1)
#plot skewness ~ phoneme using a statistical transformation
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_cl_boot)
#fit a model that examines center of gravity as a function of skewness for [s]
#transform the data
s_fric_log <- tidy_fric %>%
select(., phoneme == "s") %>%
mutate(., log_cog = log(cog), log_skew = log(skewness))
View(tidy_fric)
#fit a model that examines center of gravity as a function of skewness for [s]
#transform the data
s_fric_log <- tidy_fric %>%
filter(., phoneme == "s") %>%
mutate(., log_cog = log(cog), log_skew = log(skewness))
View(s_fric_log)
View(s_fric_log)
tidy_s <- tidy_fric %>%
filter(., phoneme == "s")
ggplot(tidy_s, aes(skewness, cog))+
geom_point()
#fit a model that examines center of gravity as a function of skewness for [s]
#transform the data
s_fric_log <- tidy_fric %>%
filter(., phoneme == "s") %>%
mutate(., log_cog = log(cog))
ggplot(s_fric_log, aes(skewness, log_cog))+
geom_point()
ggplot(tidy_s, aes(skewness, cog))+
geom_point()
scsmod <- lm(cog ~ skewness, data = tidy_s)
summary(scsmod)
?broom
?broom::tidy
broom::tidy(scsmod)
??table
??kable
#load the tidyverse and the dataset
library(tidyverse)
fric <- read_csv("./data_raw/fricatives.csv")
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
tidy_fric <- fric %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
tidy_s <- tidy_fric %>%
filter(., phoneme == "s")
scsmod <- lm(cog ~ skewness, data = tidy_s)
?peak
?glimpse
glimpse(fric)
library(ggfortify)
glimpse(fric)
??glimpse
tibble::glimpse(fric)
fric <- read_csv("./data_raw/fricatives.csv")
#load the tidyverse and the dataset
library(tidyverse)
glimpse(fric)
fric <- read_csv("./data_raw/fricatives.csv")
glimpse(fric)
#load the tidyverse and the dataset
library(tidyverse)
library(ggfortify)
fric <- read_csv("./data_raw/fricatives.csv")
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
tidy_fric <- fric %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
tidy_s <- tidy_fric %>%
filter(., phoneme == "s")
scsmod <- lm(cog ~ skewness, data = tidy_s)
#load the tidyverse and the dataset
library(tidyverse)
library(ggfortify)
fric <- read_csv("./data_raw/fricatives.csv")
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
tidy_fric <- fric %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
tidy_s <- tidy_fric %>%
filter(., phoneme == "s")
scsmod <- lm(cog ~ skewness, data = tidy_s)
#check model diagnostics and have plots
summary(scsmod$residuals)
summary(scsmod)
mod1 <- lm(mpg ~ wt, data = mtcars)
summary(mod1)
#2. homoskedasticity of residuals
autoplot(scsmod, which = (1))
#2. homoskedasticity of residuals
autoplot(scsmod, which = c(1,3))
#3. No autocorrelation of residuals
acf(scsmod$residuals)
#4. Normality of residuals
autoplot(scsmod, which = 4)
#4. Normality of residuals
autoplot(scsmod, which = 2)
#table of descriptive statistics
tidy_fric %>%
group_by(., phoneme) %>%
summarize(., mean_cog = mean(cog), sd_cog = sd(cog),
mean_skew = mean(skewness), sd_skew = sd(skewness))
#load the tidyverse and the dataset
library(tidyverse)
library(ggfortify)
fricdat <- read_csv("./data_raw/fricatives.csv")
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
tidy_fric <- fric %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
tidy_fric <- fricdat %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
#table of descriptive statistics
tidy_fric %>%
group_by(., phoneme) %>%
summarize(., mean_cog = mean(cog), sd_cog = sd(cog),
mean_skew = mean(skewness), sd_skew = sd(skewness))
?labs
?mean_cl_boot
?hmisc
scsmod <- lm(cog ~ skewness, data = tidy_s)
#load the tidyverse and the dataset
library(tidyverse)
library(ggfortify)
fricdat <- read_csv("./data_raw/fricatives.csv")
#tidy the dataset; we want to collapse the _cog and _skewness columns into single columns,
#and create a segment column with [s] and [sh]
tidy_fric <- fricdat %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
tidy_s <- tidy_fric %>%
filter(., phoneme == "s")
scsmod <- lm(cog ~ skewness, data = tidy_s)
summary(scsmod)
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(ggfortify)
fricdat <- read_csv("../data_raw/fricatives.csv")
tidy_fric <- fricdat %>%
gather(., meas, val, -obs) %>%
separate(., meas, into = c("phoneme", "meas"), sep = "_", remove = T) %>%
spread(., meas, val)
tidy_s <- tidy_fric %>%
filter(., phoneme == "s")
head(tidy_fric)
tidy_fric %>%
ggplot(aes(phoneme, cog))+
geom_boxplot() +
labs(title = "Center of Gravity as a Function of Phoneme",
y = "Center of Gravity (Hz)",
x = "Phoneme")
tidy_fric %>%
ggplot(aes(phoneme, skewness))+
stat_summary(fun.data = mean_cl_boot)+
labs(title = "Statistical Summary of Skewness, [s] and [sh]",
y = "Skewness",
x = "Phoneme")