Add 11 February class

Change-Id: I6e135c02a44e6031de24d9cad88b0acb9093c927
diff --git a/classes/11feb.R b/classes/11feb.R
new file mode 100644
index 0000000..48d5432
--- /dev/null
+++ b/classes/11feb.R
@@ -0,0 +1,32 @@
+# == COMPARANT FUNCIONS TEÒRIQUES I EMPÍRIQUES ==
+y = rnorm(100)
+
+# Densitats de probabilitat
+hist(y, freq=F) # freq=F fa que la suma sigui 1 (si no passarà que serà la suma
+                # de freqüències)
+curve(dnorm(x), add=T)
+curve(dnorm(x, 0, 1.2), col="red", add=T)
+curve(dnorm(x, 0.1, 1), col="blue", add=T)
+
+# Funcions de probabilitat acumulada
+plot(sort(y), (1:100)/100, type="S")
+curve(pnorm(x), add=T)
+curve(pnorm(x, 0.1, 1), col="red", add=T)
+
+z = matrix(y, nrow=10, ncol=10)
+z
+
+# == DATA FRAMES ==
+x = rexp(100)
+x
+d=data.frame(x, y)
+head(d)
+d$x
+d$y
+d[1,]
+d[,1]
+d[,2]
+
+dd = data.frame(x, y, z)
+dd$z
+head(dd)
diff --git a/classes/11feb_practica1.R b/classes/11feb_practica1.R
new file mode 100644
index 0000000..5daa5f6
--- /dev/null
+++ b/classes/11feb_practica1.R
@@ -0,0 +1,62 @@
+# == GENERACIÓ VARIABLES ALEATÒRIES ==
+n = 100
+
+# Nid
+nid = sample(100:999, n, replace=F)
+
+# Gènere
+genere = sample(c("H", "D"), n, replace=T, prob=c(38, 62))
+tg = table(genere)
+tg
+barplot(tg)
+
+# Edat
+edat_weights = c(5, 4, 2, 2, 1, 1)
+edat = sample(19:24, n, replace=T, prob=edat_weights)
+te = table(edat)
+te_teoric = edat_weights*100/sum(edat_weights)
+
+rbind(te, te_teoric)
+
+plot(table(edat), ty="h")
+points(19:24 + 0.1, te_teoric, ty="h", col="red")
+
+# Pes
+gamma_shape = 300
+gamma_scale = 0.2
+pes = rgamma(n, shape=gamma_shape, scale=gamma_scale)
+
+mean(pes)
+mithteorica = gamma_shape*gamma_scale
+mithteorica
+
+hist(pes, freq=F)
+curve(dgamma(x, shape=gamma_shape, scale=gamma_scale), add=T)
+curve(dgamma(x, shape=310, scale=0.22), col="red", add=T)
+
+plot(sort(pes), (1:n)/n, ty="s")
+curve(pgamma(x, shape=gamma_shape, scale=gamma_scale), add=T)
+curve(pgamma(x, shape=301, scale=gamma_scale), add=T)
+
+# Alçada
+alçada = rnorm(n, 170, 8)
+
+# Coneixement anglès
+con_angles = sample(c("Cap", "Baix", "Mitjà", "Alt", "Molt Alt"), n, replace=T, prob=c(2, 7, 40, 30, 21))
+barplot(table(con_angles))
+barplot(table(con_angles)[c("Cap", "Baix", "Mitjà", "Alt", "Molt Alt")])
+
+# Nombre de germans
+binom_prob = .3
+binom_size = .5
+ngermans = rnbinom(n, binom_size, binom_prob)
+ngermans
+
+table(ngermans)
+plot(table(ngermans))
+points(0:9 + 0.1, 100*dnbinom(0:9, binom_prob, binom_size), ty="h", col="red")
+
+# == DATA FRAME ==
+dd = data.frame(nid, genere, edat, pes, alçada, con_angles, ngermans)
+head(dd)
+write.csv2(dd, 'practica1.csv')
\ No newline at end of file