#FERTIG
momente <- function(fx,Fx){
if(missing(fx)) {
fx <- c(Fx[1], diff(Fx))
}
if(missing(Fx)) {
Fx <- cumsum(fx)
}
x <- 1:length(fx)
df <- cbind(x,fx,Fx)
erwartungswert <- sum(x*fx)
varianz <- sum((x-erwartungswert)^2 * fx)
standardabweichung <- sqrt(varianz)
zaehler_schiefe <- sum((x-erwartungswert)^3 * fx)
nenner_schiefe <- standardabweichung^3
zaehler_woelbung <- sum((x-erwartungswert)^4 * fx)
nenner_woelbung <- standardabweichung^4
schiefe <- round(zaehler_schiefe/nenner_schiefe,4)
woelbung <- round(zaehler_woelbung/nenner_woelbung,4)
erg <- list(
Verteilungstabelle = df,
Schiefe =noquote(paste0("Die Schiefe lautet: ", schiefe)),
Woelbung = noquote(paste0("Die Woelbung lautet: ", woelbung)),
Visualisierung_siehe_Rechts = ggplot2::ggplot(data.frame(df), ggplot2::aes(x=x, y = Fx)) +
ggplot2::geom_step()
)
return(erg)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.