
set.seed(99)
maenner <- rnorm(n=10, mean=175, sd=15)
frauen <- rnorm(10, 165, 15)

library(ctest)

test <- t.test(maenner, frauen)
class(test)
test
test$estimate

myDF <- data.frame(Groesse = c(maenner, frauen),
                      Geschlecht = gl(2, 10, 20, labels = c("m", "f")))
class(myDF)
names(myDF)
myDF[c(1:2, 13), ]



x <- seq(100, 240, 1) 
plot(x, dnorm(x, 175, 15), col="blue", type="l",
 xlab="Größe (cm)", ylab="f(x)", main="Normalität in der iX", ylim=c(0, 0.038))
lines(x, dnorm(x, 165, 15), col="red")
text(170, 0.0325,
    expression(paste(f[i](x) == frac(1, sigma[i]*phantom(.)*sqrt(2*pi)), 
    ~~ plain(exp), bgroup("(", {frac(-(x-mu[i])^2, 2*sigma[i]^2)}, ")"))))
text(100, 0.02, "Frauen", col="red", pos=4)
text(100, 0.015, expression(paste(mu[2]==165, ", ", sigma[2]==15)), col="red", pos=4)
text(195, 0.02, "Männer", col="blue", pos=4)
text(195, 0.015, expression(paste(mu[1]==175, ", ", sigma[1]==15)),
col="blue", pos=4)
boxplot(frauen, col="red", add=TRUE, horizontal=TRUE, at=0.008, boxwex=0.004)
boxplot(maenner, col="blue", add=TRUE, horizontal=TRUE, at=0.002, boxwex=0.004)

