Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- ## Grafico de uma FDP + Normal
- #
- #variaveis iniciais (gerando matriz de dados aleatoria)
- x1 <- sample(1:100, 1)
- x2 <- sample(101:200, 1)
- vx <- sample(x1:x2, 1) #para gerar uma dupla camada de aleatoridade
- dad <- rnorm(vx, mean=0, sd=1)
- med <- mean(dad); medx <- round(med, 2)
- des <- sd(dad); desx <- round(des, 2)
- leg1 <- paste0("valor de x ", "(n= ", vx, ")")
- plot(density(dad), xlim=c(-4, 4), ylim=c(0, 0.8), bty="l",
- mgp=c(2.5, 0.7, 0), xlab=leg1, ylab="probabilidade",
- main="Funcao Densidade de Probabilidade - FDP")
- plot(function(x) dnorm(x, med, des), from=-4, to=4,
- add=TRUE, col=2, lty=2)
- leg2 <- paste0("X ~ N( ", medx, ", ", desx, ")")
- legend(x="topright", legend=c(leg2, "observado"),
- lty=c(2, 1), col=c(2, 1), bty="n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement