Kody z rozdziału 4. Niezbędnik statystyka ,,Przewodnika po programie R’’ wydanie 4.
Aby zainstalować i włączyć pakiet Przewodnik
wykonaj poniższe dwie liniki.
devtools::install_github("pbiecek/PrzewodnikPakiet")
library("Przewodnik")
(RNGkind("Super", "Box"))
## [1] "Mersenne-Twister" "Inversion"
(RNGkind("Super", "Ahr"))
## [1] "Super-Duper" "Box-Muller"
.Random.seed[1:6]
## [1] 102 -1448306788 981750765 NA NA NA
save.seed <- .Random.seed
rnorm(9)
## [1] -0.7360222 -1.1023027 0.3359402 0.4308841 0.3730457 1.0314422
## [7] 0.1541606 -0.1940883 -2.4327144
.Random.seed <- save.seed
rnorm(9)
## [1] -0.7360222 -1.1023027 0.3359402 0.4308841 0.3730457 1.0314422
## [7] 0.1541606 -0.1940883 -2.4327144
set.seed(1313)
runif(10)
## [1] 0.27578588 0.06637362 0.82379757 0.52979504 0.91424061 0.51159113
## [7] 0.94690240 0.56341309 0.61462777 0.54047574
set.seed(1313)
runif(10)
## [1] 0.27578588 0.06637362 0.82379757 0.52979504 0.91424061 0.51159113
## [7] 0.94690240 0.56341309 0.61462777 0.54047574
runif(5)
## [1] 0.7338347 0.1627882 0.1364178 0.4895255 0.6499082
punif(0.5)
## [1] 0.5
dunif(0.5)
## [1] 1
qunif(0.1)
## [1] 0.1
x <- seq(-4,4,by=0.01)
plot(x, dnorm(x), type="l", lwd=3, cex.axis=1.5, cex.lab=1.5)
par(usr=c(-4,4,-0.04,1.04))
lines(x, pnorm(x), lty=2, lwd=3, cex.axis=1.5, cex.lab=1.5)
axis(side=4, cex.axis=1.5, cex.lab=1.5)
mtext(side=4, "pnorm()", line=2.5, cex.axis=1.5, cex=1.5)