forked from Wandergarten/OpenDataMInfo_TeamMarhack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
512 lines (512 loc) · 25.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
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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
"GMMBoost","bst","sboost","C50",
"kernlab","svmpath","nnet","gnn","rnn",
"spnn","brnn","RSNNS","AMORE","simpleNeural",
"ANN2","yap","yager","deep","neuralnet",
"TeachNet","deepnet","RcppDL","tensorflow","h2o",
"kerasR","deepNN","Buddle","automl","RLT",
"ReinforcementLearning","MDPtoolbox","lime","localModel",
"iml","flashlight","interpret","outliertree",
"dockerfiler", "sparklyr","cloudml","ggvis",
"htmlwidgets","maps","sunburstR","lattice","predict3d",
"rgl","rglwidget","plot3Drgl","ggmap","ggplot2",
"plotly","RColorBrewer","dygraphs","canvasXpress","qgraph",
"moveVis","ggcharts","visNetwork","visreg","sjPlot",
"squash","mlr3viz","DiagrammeR",
"pavo","rasterVis","timelineR","DataViz","d3r","breakDown",
"dashboard","highcharter","rbokeh","rvest",
"Rcrawler","ralger","scrapeR","devtools","usethis",
"roxygen2","knitr","rmarkdown","flexdashboard","shiny",
"xtable","httr","profvis")
# create list of missing packages
new.packages <- AllPackages[!(AllPackages %in% installed.packages()[,"Package"])]
# install missing packages
if(length(new.packages)) install.packages(new.packages)
# load all recommended packages
lapply(AllPackages, library, character.only = TRUE)
n
# Recommended R Libraries
# 0. All In One Cammand Wrap-Up
# from https://www.r-bloggers.com/2020/04/essential-list-of-useful-r-packages-for-data-scientists/
# List of recommended packages
AllPackages <- c("Hmisc","foreign","protr","readxl", "readODS",
"csv","readr","tidyverse","jsonlite","rjson",
"RJSONIO","jsonvalidate","sparkavro","arrow","feather",
"XML","odbc","RODBC","mssqlR","RMySQL",
"postGIStools","RPostgreSQL","odbc", "remotes",
"RSQLite","sqliter","dbflobr","RSQL","sqldf",
"queryparser","influxdbr","janitor","outliers",
"missForest","frequency","Amelia","diffobj","mice", "VIM",
"mi","wrangle","mitools",
"stringr","lubridate","glue","scales","hablar",
"dplyr","magrittr","data.table","plyr",
"tidyr","tibble","reshape2","stats","lars",
"caret","survival","gam","glmnet","quantreg",
"sgd","BLR","MASS","car","mlogit","RRedshiftSQL",
"earth","faraway","nortest","lmtest","nlme",
"splines","sem","pls","tree","rpart","rio",
"FuzzyNumbers","ez","psych","pastecs","CCA","CCP",
"icapca","gvlma","smacof","MVN","rpca",
"EFA.MRFA","MFAg","MVar","fabMix", "fad","spBFA","mnlfa",
"GFA","lmds","SPCALDA","semds","superMDS",
"vcd","vcdExtra","ks","rrcov","eRm",
"MNP","bayesm","ltm","fpc","cluster",
"treeClust","e1071","NbClust","skmeans","kml",
"compHclust","protoclust","pvclust","genie","tclust",
"ClusterR","dbscan","CEC","GMCM","EMCluster",
"randomLCA","MOCCA","factoextra","poLCA",
"zoo","xts","timeSeries","tsModel","TSMining",
"TSA","fma","fpp2","fpp3","tsfa",
"TSdist","TSclust","feasts","MTS","dse",
"sazedR","kza","fable","forecast","tseries",
"nnfor","quantmod","fastnet","tsna","sna",
"networkR","InteractiveIGraph","SemNeT","igraph",
"dyads","staTools","CINNA","tm","tau","NetworkToolbox",
"koRpus","lexicon","sylly","textir","textmineR",
"MediaNews","lsa","ngram","ngramrr","corpustools",
"udpipe","textstem","tidytext","text2vec","crossval",
"klaR","gencve","cvAUC",
"CVThresh","cvTools","dcv","cvms","blockCV",
"randomForest","grf","ipred","party","randomForestSRC",
"BART","Boruta","LTRCtrees","REEMtree",
"binomialRF","superml","gbm",
"GMMBoost","bst","sboost","C50",
"kernlab","svmpath","nnet","gnn","rnn",
"spnn","brnn","RSNNS","AMORE","simpleNeural",
"ANN2","yap","yager","deep","neuralnet",
"TeachNet","deepnet","RcppDL","tensorflow","h2o",
"kerasR","deepNN","Buddle","automl","RLT",
"ReinforcementLearning","MDPtoolbox","lime","localModel",
"iml","flashlight","interpret","outliertree",
"dockerfiler", "sparklyr","cloudml","ggvis",
"htmlwidgets","maps","sunburstR","lattice","predict3d",
"rgl","rglwidget","plot3Drgl","ggmap","ggplot2",
"plotly","RColorBrewer","dygraphs","canvasXpress","qgraph",
"moveVis","ggcharts","visNetwork","visreg","sjPlot",
"squash","mlr3viz","DiagrammeR",
"pavo","rasterVis","timelineR","DataViz","d3r","breakDown",
"dashboard","highcharter","rbokeh","rvest",
"Rcrawler","ralger","scrapeR","devtools","usethis",
"roxygen2","knitr","rmarkdown","flexdashboard","shiny",
"xtable","httr","profvis")
# create list of missing packages
new.packages <- AllPackages[!(AllPackages %in% installed.packages()[,"Package"])]
# install missing packages
if(length(new.packages)) install.packages(new.packages)
# load all recommended packages
lapply(AllPackages, library, character.only = TRUE)
# Quick Install DataBionics CRAN-Packages
# DataBionics Faculty - AG Datenbionik
# FB 12 - Mathematics and Computer Science
# Philipps University of Marburg, Germany
# List of CRAN(!) packages
AllDBPackages <- c('GeneralizedUmatrix', 'DatabionicSwarm', 'DataVisualizations',
'AdaptGauss', 'ABCanalysis', 'ProjectionBasedClustering','FCPS')
# create list of missing packages
new.DB.packages <- AllDBPackages[!(AllDBPackages %in% installed.packages()[,"Package"])]
# install missing packages
if(length(new.DB.packages)) {
install.packages(new.DB.packages)
}
# load all recommended packages
lapply(AllDBPackages, library, character.only = TRUE)
# Quick Install DataBionics CRAN-Packages
# DataBionics Faculty - AG Datenbionik
# FB 12 - Mathematics and Computer Science
# Philipps University of Marburg, Germany
# List of CRAN(!) packages
AllDBPackages <- c('GeneralizedUmatrix', 'DatabionicSwarm', 'DataVisualizations',
'AdaptGauss', 'ABCanalysis', 'ProjectionBasedClustering','FCPS')
# create list of missing packages
new.DB.packages <- AllDBPackages[!(AllDBPackages %in% installed.packages()[,"Package"])]
# install missing packages
if(length(new.DB.packages)) {
install.packages(new.DB.packages)
}
# load all recommended packages
lapply(AllDBPackages, library, character.only = TRUE)
# Credible Visualization for Two-Dimensional Projections of Data
# https://github.com/Mthrun/GeneralizedUmatrix
# remotes::install_github("Mthrun/GeneralizedUmatrix")
install.packages("GeneralizedUmatrix",dependencies = TRUE)
install.packages("GeneralizedUmatrix", dependencies = TRUE)
# The Databionic swarm is an unsupervised machine learning method for cluster analysis and the visualization of structures of high-dimensional data.
# https://github.com/Mthrun/DatabionicSwarm
# remotes::install_github("Mthrun/DatabionicSwarm")
install.packages("DatabionicSwarm",dependencies = TRUE)
install.packages("DatabionicSwarm", dependencies = TRUE)
# Time Series Analysis Tools (TSAT) can be used to describe event-pattern detection as a part of Complex event processing (CEP) for categorial time series and gives several approaches for numerical times series, like Filtering through FFT, WVT or predictions (e.g. compound model).
# https://github.com/Mthrun/TSAT
remotes::install_github('mthrun/TSAT')
# Hidden Markov Models
# https://github.com/Mthrun/RHmm
remotes::install_github('mthrun/RHmm')
# Databionics Toolbox for the Analysis of Fluorescence-Activated Cell Sorting (FACS) Data
# https://github.com/Mthrun/dbt.FlowCytometry
remotes::install_github('mthrun/dbt.FlowCytometry')
# Databionics Toolbox for the Analysis of Fluorescence-Activated Cell Sorting (FACS) Data
# https://github.com/Mthrun/dbt.FlowCytometry
remotes::install_github('mthrun/dbt.FlowCytometry')
# Common Supervised Maschine Learning algorithms
# https://github.com/Mthrun/Classifiers
remotes::install_github('mthrun/Classifiers')
# https://github.com/aultsch/DataIO
remotes::install_github('aultsch/DataIO')
# Functions For Different Distance Measures
# https://github.com/Mthrun/Distances
remotes::install_github('mthrun/Distances')
# Updating R and R packages from CRAN
#verify R to be up to date
if (!require('installr')) install.packages('installr')
library(installr)
updateR()
# list all packages where an update is available
old.packages()
# update all available packages
update.packages(ask = FALSE)
install.packages("spatialEco")
library(spatialEco)
random_data_sample <- runif(1000)
confinterval4mean <- conf.interval(random_data_sample, cl = 0.95, stat = "mean", std.error = TRUE)
print(confinterval4mean)
confinterval4mean
# Beispiel 1: sample size = 1000
random_data_sample1 <- runif(1000)
confinterval4mean <- conf.interval(random_data_sample1, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean
confinterval4mean1 <- conf.interval(random_data_sample1, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean1
e = 100
random_data_sample_smallN <- runif(1000)
confinterval4mean_smallN <- conf.interval(random_data_sample_smallN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_smallN
random_data_sample_bigN <- runif(1000)
confinterval4mean_bigN <- conf.interval(random_data_sample_bigN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_bigN
# install.packages("spatialEco")
# see: https://cran.r-project.org/package=spatialEco
library(spatialEco)
# Beispiel 1: sample size = 1000
random_data_sample_bigN <- runif(1000)
confinterval4mean_bigN <- conf.interval(random_data_sample_bigN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_bigN
# Beispiel 2: sample size = 100
random_data_sample_smallN <- runif(1000)
confinterval4mean_smallN <- conf.interval(random_data_sample_smallN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_smallN
# Explanation of results:
# lci
d <- density(random_data_sample_bigN)
plot(d, type="n", main = "PDF with mean and 0.95 confidence interval")
polygon(d, col="cyan3")
abline(v=mean(x, na.rm = TRUE), lty = 2)
segments( x0=cr[["lci"]], y0=mean(d$y), x1=cr[["uci"]],
y1=mean(d$y), lwd = 2.5,
col = "black")
segments( x0=confinterval4mean_bigN[["lci"]], y0=mean(d$y), x1=confinterval4mean_bigN[["uci"]],
y1=mean(d$y), lwd = 2.5,
col = "black")
legend("topright", legend = c("mean", "CI"),
lty = c(2,1), lwd = c(1,2.5))
d <- density(random_data_sample_bigN)
plot(d, type="n", main = "PDF with mean and 0.95 confidence interval")
polygon(d, col="cyan3")
abline(v=mean(x, na.rm = TRUE), lty = 2)
segments( x0=confinterval4mean_bigN[["lci"]], y0=mean(d$y), x1=confinterval4mean_bigN[["uci"]],
y1=mean(d$y), lwd = 2.5,
col = "black")
legend("topright", legend = c("mean", "ConfInterval"),
lty = c(2,1), lwd = c(1,2.5))
d <- density(random_data_sample_bigN)
plot(d, type="n", main = "PDF with mean and 0.95 confidence interval")
polygon(d, col="cyan3")
abline(v=mean(x, na.rm = TRUE), lty = 2)
segments( x0=confinterval4mean_bigN[["lci"]], y0=mean(d$y), x1=confinterval4mean_bigN[["uci"]],
y1=mean(d$y), lwd = 2.5,
col = "black")
legend("topright", legend = c("mean", "ConfInterval"),
lty = c(2,1), lwd = c(1,2.5))
x <- random_data_sample_bigN
se <- function(x) { sqrt(stats::var(x, na.rm = TRUE) / length(stats::na.omit(x)))}
se
se(x)
e = stats::qt(cl, df = length(x)-1) * se(x)
e = stats::qt(0.95, df = length(x)-1) * se(x)
cie <- mean(x) + c(-e, e)
cie
mean(x) + -e
# Manuell korrekt nachberechnet:
linkerFehler <- mean(x) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
linkerFehler
rechterFehler <- mean(x) + (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
rechterFehler
mean(random_data_sample_bigN)
# rechterFehler
mean(x) + (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# Aufgabe 1
# a)
# install.packages("spatialEco")
# see: https://cran.r-project.org/package=spatialEco
library(spatialEco)
# function 'conf.interval' is used to calculate confidence interval for mean of a distribution with unknown variance
# Beispiel I: sample size = 1000
random_data_sample_bigN <- runif(1000)
confinterval4mean_bigN <- conf.interval(random_data_sample_bigN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_bigN
# Beispiel II: sample size = 100
random_data_sample_smallN <- runif(1000)
confinterval4mean_smallN <- conf.interval(random_data_sample_smallN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_smallN
# Explanation of results:
# lci = lower confidence interval value
## Berechnung in R mittels quantile function ('qt') aus dem enthaltenen 'stats' package
## (siehe https://stat.ethz.ch/R-manual/R-devel/library/stats/html/TDist.html):
## Pseudocode: estimate = stats::qt(conf_level = 0.95, data = length(sample N - 1) * std.error(sample N), sodass
## Formel: lower confidence interval value = mean(sample N) - estimate
## in R: lci = mean(sample N) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# uci = upper confidence interval value
## analog zu lci aber als Addition
## upper confidence interval value = mean(sample N) + estimate
# mean = mean value of distribution
## Berechnung: mean(sample N)
# std.error = standard error of distribution
## Beachte: für die Berechnung der Standardabweichung wird die genormte Standardabweichung benutzt:
## Formel: std.error = sqrt(variance/length(sample N))
## in R: std.error = sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# lci: I --> 0.4721724; II --> 0.4868976
# uci: I --> 0.5016414; II --> 0.5171098
# mean: I --> 0.4869069; II --> 0.5020037
# std.error: I --> 0.008949626; II --> [1] 0.009175342
# Je größer N desto kleiner sind die Werte von linkem/rechtem Fehler, Standardabweichung und Mittelwert!
# Manuell korrekt nachberechnet:
# linkerFehler
mean(x) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# rechterFehler
mean(x) + (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# Mittelwert
mean(random_data_sample_bigN)
# Manuell korrekt nachberechnet:
# linkerFehler
mean(random_data_sample_bigN) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# rechterFehler
mean(random_data_sample_bigN) + (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# Aufgabe 1
# a)
# install.packages("spatialEco")
# see: https://cran.r-project.org/package=spatialEco
library(spatialEco)
# function 'conf.interval' is used to calculate confidence interval for mean of a distribution with unknown variance
# Beispiel I: sample size = 1000
random_data_sample_bigN <- runif(1000)
confinterval4mean_bigN <- conf.interval(random_data_sample_bigN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_bigN
# Beispiel II: sample size = 100
random_data_sample_smallN <- runif(1000)
confinterval4mean_smallN <- conf.interval(random_data_sample_smallN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_smallN
# Explanation of results:
# lci = lower confidence interval value
## Berechnung in R mittels quantile function ('qt') aus dem enthaltenen 'stats' package
## (siehe https://stat.ethz.ch/R-manual/R-devel/library/stats/html/TDist.html):
## Pseudocode: estimate = stats::qt(conf_level = 0.95, data = length(sample N - 1) * std.error(sample N), sodass
## Formel: lower confidence interval value = mean(sample N) - estimate
## in R: lci = mean(sample N) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# uci = upper confidence interval value
## analog zu lci aber als Addition
## upper confidence interval value = mean(sample N) + estimate
# mean = mean value of distribution
## Berechnung: mean(sample N)
# std.error = standard error of distribution
## Beachte: für die Berechnung der Standardabweichung wird die genormte Standardabweichung benutzt:
## Formel: std.error = sqrt(variance/length(sample N))
## in R: std.error = sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# lci: I --> 0.4721724; II --> 0.4868976
# uci: I --> 0.5016414; II --> 0.5171098
# mean: I --> 0.4869069; II --> 0.5020037
# std.error: I --> 0.008949626; II --> [1] 0.009175342
# Je größer N desto kleiner sind die Werte von linkem/rechtem Fehler, Standardabweichung und Mittelwert!
# Manuell korrekt nachberechnet:
# linkerFehler
mean(random_data_sample_bigN) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# rechterFehler
mean(random_data_sample_bigN) + (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# Mittelwert
mean(random_data_sample_bigN)
# Angepasst an unsymmetrische Fehlerverteilung, d.h. links 1% und rechts 4%:
# links
mean(random_data_sample_bigN) - (stats::qt(0.99, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# rechts
mean(random_data_sample_bigN) + (stats::qt(0.96, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# Aufgabe 1
# a)
# install.packages("spatialEco")
# see: https://cran.r-project.org/package=spatialEco
library(spatialEco)
# function 'conf.interval' is used to calculate confidence interval for mean of a distribution with unknown variance (see: https://github.com/jeffreyevans/spatialEco/blob/master/R/conf.interval.R)
# Beispiel I: sample size = 1000
random_data_sample_bigN <- runif(1000)
confinterval4mean_bigN <- conf.interval(random_data_sample_bigN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_bigN
# Beispiel II: sample size = 100
random_data_sample_smallN <- runif(1000)
confinterval4mean_smallN <- conf.interval(random_data_sample_smallN, cl = 0.95, stat = "mean", std.error = TRUE)
confinterval4mean_smallN
# Explanation of results:
# lci = lower confidence interval value
## Berechnung in R mittels quantile function ('qt') aus dem enthaltenen 'stats' package
## (siehe https://stat.ethz.ch/R-manual/R-devel/library/stats/html/TDist.html):
## Pseudocode: estimate = stats::qt(conf_level = 0.95, data = length(sample N - 1) * std.error(sample N), sodass
## Formel: lower confidence interval value = mean(sample N) - estimate
## in R: lci = mean(sample N) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# uci = upper confidence interval value
## analog zu lci aber als Addition
## upper confidence interval value = mean(sample N) + estimate
# mean = mean value of distribution
## Berechnung: mean(sample N)
# std.error = standard error of distribution
## Beachte: Wir benutzen die Standardverteilung der theoretischen Distribution des sample Mittelwertes
## Formel: std.error = sqrt(variance/length(sample N))
## in R: std.error = sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
# lci: I --> 0.4721724; II --> 0.4868976
# uci: I --> 0.5016414; II --> 0.5171098
# mean: I --> 0.4869069; II --> 0.5020037
# std.error: I --> 0.008949626; II --> [1] 0.009175342
# Je größer N desto kleiner sind die Werte von linkem/rechtem Fehler, Standardabweichung und Mittelwert!
# Manuell korrekt nachberechnet:
# links
mean(random_data_sample_bigN) - (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
#
# rechts
mean(random_data_sample_bigN) + (stats::qt(0.95, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
#
# Mittelwert
mean(random_data_sample_bigN)
#
# Angepasst an unsymmetrische Fehlerverteilung, d.h. links 1% und rechts 4%:
# links
mean(random_data_sample_bigN) - (stats::qt(0.99, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
#
# rechts
mean(random_data_sample_bigN) + (stats::qt(0.96, df = length(random_data_sample_smallN)-1) * sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE) / length(stats::na.omit(random_data_sample_smallN))))
#
qnorm(.95)
margin_of_error <- qqnorm(.95)*(sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE)/sqrt(random_data_sample_bigN))
margin_of_error <- qqnorm(.95)*(sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE))/sqrt(random_data_sample_bigN))
margin_of_error <- qqnorm(.95)*(sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE))/sqrt(random_data_sample_bigN))
margin_of_error <- qqnorm(.95)*(sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE))/sqrt(random_data_sample_bigN))
margin_of_error <- qnorm(.95)*(sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE))/sqrt(random_data_sample_bigN))
margin_of_error
lower_bound <- mean(random_data_sample_bigN) - margin_of_error
lower_bound
lower_bound
margin_of_error <- qnorm(.95)*(sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE))/sqrt(random_data_sample_bigN))
margin_of_error
lower_bound <- mean(random_data_sample_bigN) - margin_of_error
lower_bound
qnorm(.95)
margin_of_error <- 1.644854*(sqrt(stats::var(random_data_sample_smallN, na.rm = TRUE))/sqrt(random_data_sample_bigN))
margin_of_error
margin_of_error <- 1.644854*(sqrt(stats::var(random_data_sample_smallN))/sqrt(random_data_sample_bigN))
margin_of_error
margin_of_error <- 1.644854*(sqrt(var(random_data_sample_smallN))/sqrt(random_data_sample_bigN))
margin_of_error
margin_of_error <- qnorm(0.95*(sqrt(var(random_data_sample_smallN))/sqrt(random_data_sample_bigN))
lower_bound <- mean(random_data_sample_bigN) - margin_of_error
margin_of_error <- qnorm(0.95)*(sqrt(var(random_data_sample_smallN))/sqrt(random_data_sample_bigN))
margin_of_error
sqrt(var(random_data_sample_smallN))
margin_of_error <- qnorm(0.95)*(sqrt(var(random_data_sample_smallN))/sqrt(length(random_data_sample_bigN)=)
lower_bound <- mean(random_data_sample_bigN) - margin_of_error
margin_of_error <- qnorm(0.95)*(sqrt(var(random_data_sample_smallN))/sqrt(length(random_data_sample_bigN))
margin_of_error <- qnorm(0.95)*(sqrt(var(random_data_sample_smallN))/sqrt(length(random_data_sample_bigN)))
margin_of_error
lower_bound <- mean(random_data_sample_bigN) - margin_of_error
lower_bound
alpha=0.0
z(alpha/2)
alpha=0.05
alpha/2
alpha=0.1
alpha/2
margin_of_error <- qnorm(1-alpha/2)*(sqrt(var(random_data_sample_smallN))/sqrt(length(random_data_sample_bigN)))
margin_of_error
lower_bound <- mean(random_data_sample_bigN) - margin_of_error
lower_bound
# Confidence interval 95%
alpha = 0.05
alpha/2
# Confidence interval 90%
alpha_90 = 0.1
alpha_90/2
margin_of_error_90 <- qnorm(1-alpha_90/2)*(sqrt(var(random_data_sample_smallN))/sqrt(length(random_data_sample_bigN)))
margin_of_error_90
lower_bound_90 <- mean(random_data_sample_bigN) - margin_of_error
lower_bound_90
# Confidence interval 95%
alpha_95 = 0.05
alpha_95/2
margin_of_error_95 <- qnorm(1-alpha_95/2)*(sqrt(var(random_data_sample_smallN))/sqrt(length(random_data_sample_bigN)))
margin_of_error_95
lower_bound_95 <- mean(random_data_sample_bigN) - margin_of_error
lower_bound_95
margin_of_error_90 <- qnorm(1-alpha_90/2)*(sd(random_data_sample_smallN)/sqrt(length(random_data_sample_bigN)))
margin_of_error_90
margin_of_error_90 <- qnorm(1-alpha_90/2)*(sqrt(var(random_data_sample_smallN))/sqrt(length(random_data_sample_bigN)))
margin_of_error_90
margin_of_error_95 <- qnorm(1-alpha_95/2)*(sd(random_data_sample_smallN)/sqrt(length(random_data_sample_bigN)))
margin_of_error_95
upper_bound_90 <- mean(random_data_sample_bigN) + margin_of_error
upper_bound_90
# Confidence interval 90%
alpha_90 = 0.1
alpha_90/2
margin_of_error_90 <- qnorm(1-alpha_90/2)*(sd(random_data_sample_smallN)/sqrt(length(random_data_sample_bigN)))
margin_of_error_90
lower_bound_90 <- mean(random_data_sample_bigN) - margin_of_error_90
lower_bound_90
upper_bound_90 <- mean(random_data_sample_bigN) + margin_of_error_90
upper_bound_90
# Confidence interval 95%
alpha_95 = 0.05
alpha_95/2
margin_of_error_95 <- qnorm(1-alpha_95/2)*(sd(random_data_sample_smallN)/sqrt(length(random_data_sample_bigN)))
margin_of_error_95
lower_bound_95 <- mean(random_data_sample_bigN) - margin_of_error_95
lower_bound_95
upper_bound_95 <- mean(random_data_sample_bigN) + margin_of_error_95
upper_bound_95
textENpng <- ocr("./samples/sampleEN2.png", engine = eng)
library(tesseract)
# English (default): PNG to Text
# tesseract engine Defaults to English ('eng')!
eng <- tesseract("eng")
textENpng <- ocr("./samples/sampleEN2.png", engine = eng)
setwd("C:/Code/CollectoR/CollectoR")
# English (default): PNG to Text
# tesseract engine Defaults to English ('eng')!
eng <- tesseract("eng")
textENpng <- ocr("./samples/sampleEN2.png", engine = eng)
textENpng <- ocr("./samples/sampleEN2.png", engine = eng)
setwd("C:/Code/CollectoR/CollectoR/OCR_tesseract")
# English (default): PNG to Text
# tesseract engine Defaults to English ('eng')!
eng <- tesseract("eng")
textENpng <- ocr("./samples/sampleEN2.png", engine = eng)
cat(textENpng)
#install.packages("tesseract")
library(tesseract)
setwd("C:/Code/OpenDataMInfo_TeamMarhack/Code")
textENpng <- ocr("./Data/TimoBollMaLong2017WC/image0.png", engine = eng)
setwd("C:/Code/OpenDataMInfo_TeamMarhack/")
# English (default): PNG to Text
# tesseract engine Defaults to English ('eng')!
eng <- tesseract("eng")
textENpng <- ocr("./Data/TimoBollMaLong2017WC/image0.png", engine = eng)
cat(textENpng)
textENpng <- ocr("./Data/TimoBollMaLong2017WC/image1.png", engine = eng)
cat(textENpng)
textENpng <- ocr("./Data/TimoBollMaLong2017WC/image2.png", engine = eng)
cat(textENpng)
textENpng <- ocr("./Data/TimoBollMaLong2017WC/image3.png", engine = eng)
cat(textENpng)
textENpng <- ocr("./Data/TimoBollMaLong2017WC/image4.png", engine = eng)
cat(textENpng)