Compare commits
6
Commits
1871414592
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1b11d1dce | ||
|
|
fc8d0245bc | ||
|
|
6584495be7 | ||
|
|
8cfb62c7bd | ||
|
|
2738e6d032 | ||
|
|
a5474df9b3 |
No files matched your search
@@ -45,4 +45,5 @@ docs/
|
||||
# translation temp files
|
||||
po/*~
|
||||
|
||||
*.onetoc2
|
||||
Open Notebook.onetoc2
|
||||
+27
-19
@@ -11,7 +11,7 @@
|
||||
|
||||
<meta name="author" content="Marc Gauch" />
|
||||
|
||||
<meta name="date" content="2022-11-25" />
|
||||
<meta name="date" content="2022-12-02" />
|
||||
|
||||
<title>Quantitative Methods HS22</title>
|
||||
|
||||
@@ -1487,7 +1487,7 @@ border-radius: 0px;
|
||||
|
||||
<h1 class="title toc-ignore">Quantitative Methods HS22</h1>
|
||||
<h4 class="author">Marc Gauch</h4>
|
||||
<h4 class="date">2022-11-25</h4>
|
||||
<h4 class="date">2022-12-02</h4>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1498,9 +1498,9 @@ border-radius: 0px;
|
||||
install.packages("tidyverse")
|
||||
library(tidyverse)
|
||||
}
|
||||
if (!require(moments)) {
|
||||
install.packages("moments")
|
||||
library(moments)
|
||||
if (!require(e1071)) {
|
||||
install.packages("e1071")
|
||||
library(e1071)
|
||||
}</code></pre>
|
||||
</div>
|
||||
<div id="own-functions" class="section level1" number="2">
|
||||
@@ -1519,13 +1519,16 @@ ordered from wish.com</h2>
|
||||
valid_percent <- round(p * 100, digits = rounded_digits)
|
||||
na_percent <- round(na_count / length(data) * 100, digits = rounded_digits)
|
||||
|
||||
percent <- round(frequency/total_count*100, digits = rounded_digits)
|
||||
percent_raw <- frequency/total_count*100
|
||||
percent <- round(percent_raw, digits = rounded_digits)
|
||||
cumulative_percent <- round(cumsum(p) * 100, digits = rounded_digits)
|
||||
freq_table <- cbind(frequency, percent, valid_percent, cumulative_percent)
|
||||
freq_table <- cbind(frequency, percent, percent_raw, valid_percent, cumulative_percent)
|
||||
|
||||
valid_percent_sum <- sum(as.data.frame(freq_table)$percent)
|
||||
valid_percent_sum <- round(sum(as.data.frame(freq_table)$percent_raw), digits = rounded_digits)
|
||||
Valid_Total <- c(valid_count, valid_percent_sum, 100, NaN)
|
||||
|
||||
|
||||
freq_table <- subset(freq_table, select = -c(percent_raw))
|
||||
|
||||
NAs <- c(na_count, na_percent, NaN, NaN)
|
||||
Total <- c(total_count, 100, NaN, NaN)
|
||||
print(rbind(freq_table, Valid_Total, NAs, Total))
|
||||
@@ -1541,6 +1544,12 @@ and adapted</em></p>
|
||||
uniqv[which(x == max(x))]
|
||||
}</code></pre>
|
||||
</div>
|
||||
<div id="remove-na" class="section level2" number="2.3">
|
||||
<h2><span class="header-section-number">2.3</span> Remove NA</h2>
|
||||
<pre class="r"><code>removeNA <- function(d){
|
||||
return(d[!is.na(d)])
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div id="load-data" class="section level1" number="3">
|
||||
<h1><span class="header-section-number">3</span> Load Data</h1>
|
||||
@@ -2389,9 +2398,8 @@ gibt.</p>
|
||||
<div id="selbststudium-2.1" class="section level1" number="6">
|
||||
<h1><span class="header-section-number">6</span> Selbststudium 2.1</h1>
|
||||
<p>We have the year 2021 ## Preparation</p>
|
||||
<pre class="r"><code>birthyears <- litdata$D7
|
||||
# remove NAs
|
||||
birthyears <- birthyears[!is.na(birthyears)]
|
||||
<pre class="r"><code># remove NAs
|
||||
birthyears <- removeNA(litdata$D7)
|
||||
age <- 2021 - birthyears</code></pre>
|
||||
<div id="frequency" class="section level2" number="6.1">
|
||||
<h2><span class="header-section-number">6.1</span> Frequency</h2>
|
||||
@@ -2420,7 +2428,7 @@ age <- 2021 - birthyears</code></pre>
|
||||
## 48 1 0.94 0.94 98.11
|
||||
## 49 1 0.94 0.94 99.06
|
||||
## 50 1 0.94 0.94 100.00
|
||||
## Valid_Total 106 99.98 100.00 NaN
|
||||
## Valid_Total 106 100.00 100.00 NaN
|
||||
## NAs 0 0.00 NaN NaN
|
||||
## Total 106 100.00 NaN NaN</code></pre>
|
||||
<pre class="r"><code># with NA
|
||||
@@ -2449,7 +2457,7 @@ freq(2021 - litdata$D7)</code></pre>
|
||||
## 48 1 0.32 0.94 98.11
|
||||
## 49 1 0.32 0.94 99.06
|
||||
## 50 1 0.32 0.94 100.00
|
||||
## Valid_Total 106 33.89 100.00 NaN
|
||||
## Valid_Total 106 33.87 100.00 NaN
|
||||
## NAs 207 66.13 NaN NaN
|
||||
## Total 313 100.00 NaN NaN</code></pre>
|
||||
</div>
|
||||
@@ -2501,9 +2509,8 @@ Standardabweichung</h3>
|
||||
</div>
|
||||
<div id="schiefe" class="section level3" number="6.2.8">
|
||||
<h3><span class="header-section-number">6.2.8</span> Schiefe</h3>
|
||||
<pre class="r"><code>library(moments)
|
||||
skewness(age)</code></pre>
|
||||
<pre><code>## [1] 1.572229</code></pre>
|
||||
<pre class="r"><code>skewness(age)</code></pre>
|
||||
<pre><code>## [1] 1.550033</code></pre>
|
||||
<blockquote>
|
||||
<p>Die Kennzahl Schiefe ist wird Null bei einer perfekt symmetrischen
|
||||
Verteilung, größer als Null bei einer rechtsschiefen und kleiner als
|
||||
@@ -2512,8 +2519,9 @@ Null bei einer linksschiefen Verteilung. <a href="https://www.beratung-statistik
|
||||
</div>
|
||||
<div id="kurtosis" class="section level3" number="6.2.9">
|
||||
<h3><span class="header-section-number">6.2.9</span> Kurtosis</h3>
|
||||
<pre class="r"><code>kurtosis(age)</code></pre>
|
||||
<pre><code>## [1] 5.383429</code></pre>
|
||||
<pre class="r"><code>kurtosis(age, type = 2)</code></pre>
|
||||
<pre><code>## [1] 2.55861</code></pre>
|
||||
<p><em>SPSS berechnet die Kurtosis mit einer anderen <a href="https://rdrr.io/rforge/e1071/man/kurtosis.html">Formel</a>.</em></p>
|
||||
<blockquote>
|
||||
<p>Eine weitere bekannte Kennzahl ist die Kurtosis. Um eine Vorstellung
|
||||
von der Bedeutung der Kurtosis zu erhalten, betrachten Sie nachfolgende
|
||||
|
||||
+24
-11
@@ -24,9 +24,9 @@ if (!require(tidyverse)) {
|
||||
install.packages("tidyverse")
|
||||
library(tidyverse)
|
||||
}
|
||||
if (!require(moments)) {
|
||||
install.packages("moments")
|
||||
library(moments)
|
||||
if (!require(e1071)) {
|
||||
install.packages("e1071")
|
||||
library(e1071)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -45,13 +45,16 @@ freq <- function(data, rounded_digits = 2) {
|
||||
valid_percent <- round(p * 100, digits = rounded_digits)
|
||||
na_percent <- round(na_count / length(data) * 100, digits = rounded_digits)
|
||||
|
||||
percent <- round(frequency/total_count*100, digits = rounded_digits)
|
||||
percent_raw <- frequency/total_count*100
|
||||
percent <- round(percent_raw, digits = rounded_digits)
|
||||
cumulative_percent <- round(cumsum(p) * 100, digits = rounded_digits)
|
||||
freq_table <- cbind(frequency, percent, valid_percent, cumulative_percent)
|
||||
freq_table <- cbind(frequency, percent, percent_raw, valid_percent, cumulative_percent)
|
||||
|
||||
valid_percent_sum <- sum(as.data.frame(freq_table)$percent)
|
||||
valid_percent_sum <- round(sum(as.data.frame(freq_table)$percent_raw), digits = rounded_digits)
|
||||
Valid_Total <- c(valid_count, valid_percent_sum, 100, NaN)
|
||||
|
||||
|
||||
freq_table <- subset(freq_table, select = -c(percent_raw))
|
||||
|
||||
NAs <- c(na_count, na_percent, NaN, NaN)
|
||||
Total <- c(total_count, 100, NaN, NaN)
|
||||
print(rbind(freq_table, Valid_Total, NAs, Total))
|
||||
@@ -68,6 +71,15 @@ getmode <- function(v) {
|
||||
}
|
||||
```
|
||||
|
||||
## Remove NA
|
||||
```{r}
|
||||
removeNA <- function(d){
|
||||
return(d[!is.na(d)])
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Load Data
|
||||
## Load from CSV
|
||||
``` {r loadData}
|
||||
@@ -349,9 +361,8 @@ displayFunction1(litdata, "D8")
|
||||
We have the year 2021
|
||||
## Preparation
|
||||
```{r}
|
||||
birthyears <- litdata$D7
|
||||
# remove NAs
|
||||
birthyears <- birthyears[!is.na(birthyears)]
|
||||
birthyears <- removeNA(litdata$D7)
|
||||
age <- 2021 - birthyears
|
||||
```
|
||||
|
||||
@@ -405,7 +416,6 @@ sd(age)
|
||||
|
||||
### Schiefe
|
||||
```{r}
|
||||
library(moments)
|
||||
skewness(age)
|
||||
```
|
||||
> Die Kennzahl Schiefe ist wird Null bei einer perfekt symmetrischen Verteilung, größer als Null bei einer rechtsschiefen und kleiner als Null bei einer linksschiefen Verteilung.
|
||||
@@ -413,8 +423,11 @@ https://www.beratung-statistik.de/statistik-beratung-infos/r-tutorial/deskriptiv
|
||||
|
||||
### Kurtosis
|
||||
```{r}
|
||||
kurtosis(age)
|
||||
kurtosis(age, type = 2)
|
||||
```
|
||||
|
||||
*SPSS berechnet die Kurtosis mit einer anderen [Formel](https://rdrr.io/rforge/e1071/man/kurtosis.html).*
|
||||
|
||||
> Eine weitere bekannte Kennzahl ist die Kurtosis. Um eine Vorstellung von der Bedeutung der Kurtosis zu erhalten, betrachten Sie nachfolgende Graphik.
|
||||
In dieser Graphik sind eine Normalverteilung, sowie eine steilgipflige (aka leptokurtisch) und eine flachgipflige (aka platykurtisch) dargestellt.
|
||||
Die steilgipflige Verteilung ist in der Mitte spitzer als die Normalverteilung und an den Rändern breiter. Bei der flachgipligen Verteilung ist es anders herum. Die Kurtosis ist nun eine Kennzahl, mit der untersucht wird, ob eine Verteilung im Vergleich zur Normalverteilung flachgipflig oder steilgipflig ist:
|
||||
|
||||
Reference in new issue
Block a user