User:Zelenka/Statistics/exercises 15.1.2008
From eqqon
< User:Zelenka | Statistics(Difference between revisions)
Zelenka (Talk | contribs)
(New page: ;5.4 rand.norm <- function (n,mu , sigma ) { r.n <- numeric (n) for (i in (1:n)) { r.u <- runif (12) r.n[i] <- sum (r.u)-6 } r.n <- mu+r.n* sigma } mu<-100; sigma<-10;...)
(New page: ;5.4 rand.norm <- function (n,mu , sigma ) { r.n <- numeric (n) for (i in (1:n)) { r.u <- runif (12) r.n[i] <- sum (r.u)-6 } r.n <- mu+r.n* sigma } mu<-100; sigma<-10;...)
Latest revision as of 10:38, 15 January 2008
- 5.4
rand.norm <- function (n,mu , sigma ) { r.n <- numeric (n) for (i in (1:n)) { r.u <- runif (12) r.n[i] <- sum (r.u)-6 } r.n <- mu+r.n* sigma } mu<-100; sigma<-10; n<-500; res<-rand.norm(n,mu,sigma) tmp.hist <- hist(res , plot = FALSE ) mp.dens <- dnorm(mu,mean=mu,sd=sigma) y.max<-max(tmp.hist$density,y.max) hist(res ,breaks=seq(mu-4*sigma-1,mu+4*sigma+1,length=round(sqrt(n))+1),prob=TRUE,xlab="" ,ylab="",main=paste(" Mittel =",mu ," Streuung =", sigma ,"n=",n), ylim =c(0,y.max)) x<-seq(mu -4* sigma ,mu +4* sigma , length =100) lines(x,dnorm(x,mu , sigma ),lty =1,lwd =2,col="red") rug(res)