-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
401 lines (401 loc) · 10.4 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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
data("iris")
iris
install.packages("ggplot2")
library(ggplot2)
install.packages("dplyr")
library(dplyr)
iris %>% View
head(iris)
iris %>% ggplot(aes(x = Sepal.Length, y = Sepal.Width)) + geom_point()
table(iris$Species)
iris %>% ggplot(aes(x = Sepal.Length, y = Sepal.Width, colour = Species)) + geom_point()
install.packages("caret")
library(caret)
head(iris)
index <- createDataPartition(y = Speicies, p = 0.8)
index <- createDataPartition(y = iris$Speicies, p = 0.8)
jead)iris
iris
head(iris)
index <- createDataPartition(y = iris$Species, p = 0.8)
index
iris[index, ]
iris[index]
index <- createDataPartition(y = iris$Species, p = 0.8, list = FALSE)
iris[index]
iris[index, ]
iris[index, ] %>% nrow
iris[-index, ] %>% nrow
train <- iris[index, ]
test <- iris[-index, ]
test
test
model.rf <- train(Species ~ ., data= train, method="rf")
install.packages("e1071")
model.rf <- train(Species ~ ., data= train, method="rf")
model.rf
head(test)
test[-1, ]
select(test, -Species)
select(test, -Species) %>% head
predict(model.rf,select(test, -Species))
predict(model.rf,select(test, -Species)) == test$Species
table(predict(model.rf,select(test, -Species)), test$Species)
model.rf
model.rf
1391810 + 1382710 * 3 + 2731080
View(iris)
library(ggplot2)
head(iris)
ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width )) + geom_point()
ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species )) + geom_point()
150000 / 625000
50000 / 625000
37,500 + 247000
37500 + 247000
340,500 + 284500
340500 + 284500
43750 / 62500
43750 / 625000
87500 / 625000
37500 / 625000
125000.625000
125000/625000
43750 / 625000
18750 / 625000
220000/275000
253000 / 340500
34050 * 2
253,000 / 0.8
253000 / 0.8
(316250 - 253000) /2
(316250 - 253000)
247000/ 0.8
253000 / 0.8
247000/ 0.8
316250 + 308750
(308750 - 247000)
61750 / 2
500000 / 0.8
(625000 - 500000)
(625000 - 500000) / 2
125000 + 30875
31625 + 30875
316,250 - 31625
316250 - 31625
308750 - 30875
250 * 120
30000/ 12
31,625 / 12
31625 / 12
36000 * 8
36000 * 8
36000 * 8 + 30000
36000 * 7 + 32000
284000 + 31625
3600 * 0.8
3600 * 6 + 18000 + 15000 + 28800
3600 * 6 + 18000 + 15000 + 28800
(3600 * 6) + 18000 + 15000 + 28800
(36000 * 6) + 18000 + 15000 + 28800
277800 + 31625
salaries <- c(36000, 36000, 36000, 36000, 18000, 15000, 28800, 36000, 24000)
sum(salaries)
265,800 + 31625
265800 + 31625
solaries_new <- c(15000, 28800, 36000, 24000)
sum(salaries_old)
salaries_old <- c(36000, 36000, 36000, 36000, 18000)
solaries_new <- c(15000, 28800, 36000, 24000)
sum(salaries_old)
sum(salaries_old)
salaries_old <- c(36000, 36000, 36000, 36000, 18000)
solaries_new <- c(15000, 28800, 36000, 24000)
sum(salaries_old)
sum(solaries_new)
salaries_old <- c(36000, 36000, 36000, 36000, 18000, 31625)
solaries_new <- c(15000, 28800, 36000, 24000)
sum(salaries_old)
sum(solaries_new)
salaries_old_v <- sum(salaries_old)
salaries_new_v <- sum(solaries_new)
salaries_old_v + salaries_new_v
solaries_new <- c(15000, 28800, 36000, 24000, 31625)
salaries_old_v <- sum(salaries_old)
salaries_new_v <- sum(solaries_new)
salaries_old_v <- sum(salaries_old)
salaries_new_v <- sum(solaries_new)
salaries_old_v
salaries_new_v
salaries_new_v
solaries_new <- c(15000, 28800, 36000, 24000)
salaries_new_v <- sum(solaries_new)
salaries_new_v
316,250 - 297425 +
316250 - 297425 +
316250 - 297425
193625 + 103800 + 10000 + 8825
2500 * 12
163625 + 103800 + 100000 + 8825
163625 + 103800 + 8825
163625 + 103800 + 80000 + 8825
163625 + 103800 + 8000 + 8825
284625- 163625 + 103800 + 10000
284625 - 163625 + 103800 + 10000
284625 - 163625
284625 - 163625 - 103800 - 10000
163625 + 135425 + 10000 + 7200
247000 + 30875
235800 - 18000
217800 + 31625
30000 + 36000 * 3
138000 + 103800 + 10000
30875 + 247000
103800 + 30875
277875 - 138000 - 103800 - 10000
30875 / 12
(30875 / 12) / 2635
30000 + 36000 + 36000 + 15000 + 28800 + 36000 + 24000
30000 + 36000 + 36000 + 36000 + 15000 + 28800 + 36000 + 24000
241800 + 30875
138000 + 134675
277875 - (138000 + 103800 + 10000)
30000 +36000 + 36000 +36000 +18000 +15000 + 28800 + 36000 + 24000
30,000
36,000
36,000
36,000
18,000
31,620
15,000
28,800
36,000
24,000
30000 +
36000 +
36000 +
36000 +
18000 +
31620 +
15000 +
28800 +
36000 +
24000
30000 +
30000 +
36000 +
36000 +
36000 +
36000 +
36000 +
36000 +
18000 +
18000
30000 +
36000 +
36000 +
36000 +
18000
15000 +
28800 +
36000 +
24000
31625 / 12
156000 +
103800 +
10000 +
7205 +
156000 +
103800 +
10000 +
7205
316250 - 31625
156000 +
103800 +
10000 +
7205
284625 - 277005
156000 +
103805 +
17000 +
7825
103800 + 31625
156000 +
135425 +
17000 +
7825
30000 +
36000 +
36000 +
36000
2635 * 12 *0.98
30875 / 12
2572.917 * 12
15000 +
28800 +
36000 +
24000
138000 +
103800 +
30000 +
1500 +
4575
277875 +
30875
install.packages("PerformanceAnalytics")
sample_returns <- c(-0.02, 0.00, 0.00, 0.06, 0.02, 0.03, -0.01, 0.04)
install.packages("PerformanceAnalytics")
library("PerformanceAnalytics")
mean.geometric(sample_returns)
mean(sample_returns)
(sample_returns - mean(sample_returns)) / sd(sample_returns)
mean(sample_returns)
mean.geometric(sample_returns)
sd(sample_returns)
(mean(sample_returns) - 0.004) / sd(sample_returns)
setwd("~/GoogleDrive/epopcon")
data <- read.csv("stock_sample.csv")
View(data)
library(ggplot2)
library(dplyr)
library(lubridate)
data <- read.csv("stock_sample.csv")
View(data)
data$REG_DT <- ymd_hms(data$REG_DT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT)) + geom_point()
head(data)
str(data)
data$label <- as.factor(data$label)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd_hms(data$REG_DT)
data$label <- as.factor(data$label)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
data
View(data)
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd_hms(data$REG_DT)
data <- read.csv("stock_sample_na.csv")
data
head(data)
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd(data$REG_DT)
data$label <- as.factor(data$label)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
data
data$STOCK_AMOUNT
install.packages("imputeTS")
library(imputeTS)
na.kalman(data$STOCK_AMOUNT)
data$STOCK_AMOUNT <- na.kalman(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
library(ggplot2)
library(dplyr)
library(lubridate)
library(imputeTS)
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd(data$REG_DT)
data$label <- as.factor(data$label)
data$STOCK_AMOUNT
is.na(data$STOCK_AMOUNT)
data$STOCK_AMOUNT[is.na(data$STOCK_AMOUNT)]
data$label[is.na(data$STOCK_AMOUNT)]
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd(data$REG_DT)
data$label[is.na(data$STOCK_AMOUNT)]
data$label[is.na(data$STOCK_AMOUNT)] <- "NA"
data$label <- as.factor(data$label)
data$STOCK_AMOUNT2 <- na.kalman(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.interpolation(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.seadec(data$STOCK_AMOUNT)
data$STOCK_AMOUNT2 <- na.seasplit(data$STOCK_AMOUNT)
data$STOCK_AMOUNT2 <- na.ma(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.ma(data$STOCK_AMOUNT, weighting = 'exponential')
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd(data$REG_DT)
data$label[is.na(data$STOCK_AMOUNT)] <- "NA"
data$label <- as.factor(data$label)
data$STOCK_AMOUNT2 <- na.ma(data$STOCK_AMOUNT, weighting = 'exponential')
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.kalman(data$STOCK_AMOUNT, weighting = 'exponential')
data$STOCK_AMOUNT2 <- na.kalman(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.random(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.random(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.locf(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
data$STOCK_AMOUNT2 <- na.interpolation(data$STOCK_AMOUNT, option = 'stine')
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
library(ggplot2)
library(dplyr)
library(lubridate)
library(imputeTS)
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd(data$REG_DT)
data$label[is.na(data$STOCK_AMOUNT)] <- "NA"
data$label <- as.factor(data$label)
data$STOCK_AMOUNT2 <- na.interpolation(data$STOCK_AMOUNT, option = 'stine')
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
library(ggplot2)
library(dplyr)
library(lubridate)
library(imputeTS)
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd(data$REG_DT)
data$label[is.na(data$STOCK_AMOUNT)] <- "NA"
data$label <- as.factor(data$label)
data$STOCK_AMOUNT2 <- na.interpolation(data$STOCK_AMOUNT, option = 'stine')
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
library(ggplot2)
library(dplyr)
library(lubridate)
library(imputeTS)
data <- read.csv("stock_sample_na.csv")
data$REG_DT <- ymd(data$REG_DT)
data$label[is.na(data$STOCK_AMOUNT)] <- "NA"
data$label <- as.factor(data$label)
data$STOCK_AMOUNT2 <- na.kalman(data$STOCK_AMOUNT)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT2, color=label)) + geom_point()
library(ggplot2)
library(dplyr)
library(lubridate)
library(imputeTS)
data <- read.csv("data/tmp3.csv")
data
Veiw(data)
head(data)
head(data)
names(data)
data <- read.csv("data/tmp3.csv")
head(data)
data <- read.csv("data/tmp3.csv")
head(data)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT)) + geom_point()
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
data <- factor(data$label)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
data <- read.csv("data/tmp3.csv")
data <- factor(data$label)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
head(data)
data <- read.csv("data/tmp3.csv")
data$label <- factor(data$label)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
data <- read.csv("data/tmp2.csv")
data <- read.csv("data/tmp2.csv")
data
head(data)
head(data)
# head(data)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
# head(data)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()
data <- read.csv("data/tmp2.csv")
# head(data)
ggplot(data, aes(x=REG_DT, y=STOCK_AMOUNT, color=label)) + geom_point()