Gustoće

Column

Funkcije gustoća po aktivnostima

Column

Brojčane vrijednosti

aktivnost MEAN MEDIAN MIN MAX
KOL 1 12.270251 12.42 3.29 19.37
KOL 2 10.174378 10.50 0.00 15.88
KOL 3 7.876580 7.92 0.00 16.75
KP 8.608865 8.90 0.00 17.60
PROJEKT 12.159091 12.00 1.50 19.00

Violine

Ukupni bodovi

Column

Frekvencije ukupnih bodova

Ocjene

Column

Distribucija bodova

Korelacije

Column

Korelacije

Column

p-vrijednosti korelacija

---
title: "MMZI 2022/2023 -- analiza"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    source_code: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(readxl)
library(corrplot)
options(pillar.sigfig = 4)

podaci <- read_excel("MMZI 2022_2023.xlsx") %>% drop_na(OCJENA)

podaci_KOL <- podaci %>% 
  unite("student", Ime, Prezime, sep = " ") %>%
  select(c(student:"KOL 3", KP, PROJEKT)) %>%
  pivot_longer(c("KOL 1":"KOL 3", "KP", "PROJEKT"), names_to = "aktivnost", values_to = "bodovi")

podaci_korelacije <- podaci %>% select(c("KOL 1", "KOL 2", "KOL 3", KP, PROJEKT))
testRes = cor.mtest(podaci_korelacije, conf.level = 0.975)

AS_MED <- podaci_KOL %>% group_by(aktivnost) %>% 
  summarise(mean_value = mean(bodovi,na.rm=TRUE), median_value = median(bodovi,na.rm=TRUE))
```

Gustoće
=======================================================================

Column {data-width=500}
-----------------------------------------------------------------------

### Funkcije gustoća po aktivnostima

```{r warning=FALSE, fig.width=17, fig.height=9}
ggplot(podaci_KOL, aes(x=bodovi)) + 
  geom_histogram(aes(y=..density..), binwidth = 1, color="#ec8ae5", fill="#48d09b", alpha=0.7) +
  geom_density(alpha=.2, fill="yellow") +
  scale_x_continuous(name = "bodovi na kolokviju", breaks = seq(0,21,2), limits = c(-1,21)) + 
  scale_y_continuous(limits = c(0, 0.2)) + guides(color = "none", fill = "none") +
  facet_wrap(vars(aktivnost)) +
  geom_vline(data=AS_MED, aes(xintercept=mean_value), color="blue", linetype="dashed", size=0.5, alpha=0.6) +
  geom_vline(data=AS_MED, aes(xintercept=median_value), color="red", linetype="dashed", size=0.5, alpha=0.6) + 
  annotate(geom="point", x=16, y=0.14, size=2, shape=21, fill="red",color="red") +
  annotate(geom="text", x=16.4, y=0.141, label="median",size=3.5,hjust=0) +
  annotate(geom="point", x=16, y=0.13, size=2, shape=21, fill="blue",color="blue") +
  annotate(geom="text", x=16.4, y=0.131, label="mean",size=3.5,hjust=0) +
  geom_rug(alpha=0.3)
```

Column {data-width=150}
-----------------------------------------------------------------------

### Brojčane vrijednosti

```{r warning=FALSE}
podaci_KOL %>% group_by(aktivnost) %>%
  summarize(MEAN = mean(bodovi, na.rm = TRUE), 
            MEDIAN = median(bodovi, na.rm = TRUE), 
            MIN = min(bodovi, na.rm = TRUE),
            MAX = max(bodovi, na.rm = TRUE)) %>% knitr::kable()
```

Violine
=======================================================================

```{r warning=FALSE, fig.width=17, fig.height=9}
ggplot(podaci_KOL, aes(x=aktivnost, y=bodovi, fill=aktivnost)) +
  geom_dotplot(binaxis='y', stackdir='center', fill='black', dotsize=0.25, alpha=0.3, binwidth = 0.8) +
  geom_violin(trim=F, alpha=0.3) + geom_boxplot(width=0.05, alpha=1) + xlab('') +
  theme(axis.text.x=element_text(size=11), axis.text.y=element_text(size=11), legend.position='none')
```

Ukupni bodovi
=======================================================================

Column {data-width=400}
-----------------------------------------------------------------------

### Frekvencije ukupnih bodova

```{r warning=FALSE, fig.width=10, fig.height=5}
ggplot(podaci, aes(x=UKUPNO)) + 
  geom_histogram(binwidth = 1, color="#ec8ae5", fill="#48d09b", alpha=0.7) +
  scale_x_continuous(name = "ukupni bodovi", breaks = seq(0,100,5), limits = c(0,100)) + 
  scale_y_continuous(name = "broj studenata", breaks = seq(0,16)) +
  theme(panel.grid.minor = element_blank())
```

### Ocjene

```{r warning=FALSE, fig.width=10, fig.height=5}
ggplot(podaci, aes(x=factor(OCJENA))) +
  geom_bar(width=0.7, fill="steelblue") +
  geom_text(stat="count", aes(label=..count..), vjust=-0.5, nudge_x = -0.2, size = 5) +
  geom_text(aes( label = sprintf('(%s)', scales::percent(..prop..)), group = 1), stat= "count", 
            vjust = -.5, nudge_x = 0.15, size = 5) +
  scale_x_discrete(name = "Ocjena") +
  scale_y_continuous(name = "broj studenata", breaks = seq(0,120,10), limits = c(0,120)) +
  theme(panel.grid.major.x = element_blank())
```

Column {data-width=400}
-----------------------------------------------------------------------

### Distribucija bodova

```{r warning=FALSE, fig.width=10, fig.height=7}
ggplot(podaci, aes(x=UKUPNO)) + 
  geom_histogram(aes(y=..density..), color="#ec8ae5", fill="#48d09b", alpha=0.5, 
                 breaks = c(0,20,50,61,75,91,100)) +
  geom_vline(aes(xintercept=mean(UKUPNO)),color="blue", linetype="dashed", size=0.5, alpha=0.6) +
  geom_vline(aes(xintercept=median(UKUPNO)),color="red", linetype="dashed", size=0.5, alpha=0.6) +
  annotate(geom="point", x=90, y=0.035, size=2, shape=21, fill="red",color="red") +
  annotate(geom="text", x=91, y=0.035, label="median",size=3.5,hjust=0) +
  annotate(geom="point", x=90, y=0.033, size=2, shape=21, fill="blue",color="blue") +
  annotate(geom="text", x=91, y=0.033, label="mean",size=3.5,hjust=0) +
  geom_density(alpha=.2, fill="yellow") +
  geom_rug() +
  scale_x_continuous(name = "ukupni bodovi", breaks = seq(0,100,5), limits = c(0,100)) +
  theme(panel.grid.minor.x = element_blank())
```

Korelacije
=======================================================================

Column {data-width=400}
-----------------------------------------------------------------------

### Korelacije

```{r warning=FALSE, fig.width=10, fig.height=7}
corrplot(round(cor(podaci_korelacije, use = "pairwise.complete.obs"), 2), type = "lower",
         diag=FALSE, addCoef.col = 'black', tl.srt = 45)
```

Column {data-width=400}
-----------------------------------------------------------------------

### p-vrijednosti korelacija

```{r warning=FALSE, fig.width=10, fig.height=7}
corrplot(round(cor(podaci_korelacije, use = "pairwise.complete.obs"), 2), type = "lower",
         diag=FALSE, tl.srt = 45, p.mat = testRes$p, insig = 'p-value', sig.level = -1)
```