Materi 5 Pembangkitan Bil Acak Dan Resampling
Materi 5 Pembangkitan Bil Acak Dan Resampling
Des, 2017
r = F(x)
x = F-1(r) r1
x1
Histogram of x
Dalam R (misal membangkitkan 1000):
n <- 1000
2.5
u <- runif(n)
2.0
x <- u^(1/3)
Density
1.5
#cek
1.0
hist(x, prob=TRUE)
y <- seq(0,1,.01)
0.5
lines(y, 3*y^2)
0.0
500
400
Dalam R
300
n <- 1000
200
p <- 0.4
100
u <- runif(n)
x <- as.integer(u>0.6)
0
0 1
barplot(table(x))
Department of Statistics, IPB Dr. Agus Mohamad Soleh 14
ITM: Kasus Sebaran Diskret
Ilustrasi: Misal banyaknya pengiriman, x, dari suatu
perusahaan adalah 0, 1, atau 2 kali
Data – Sebaran Peluang:
x p(x) F(x)
0 0.50 0.50
1 0.30 0.80
2 0.20 1.00
Metode– Diberikan U,
Skema pembangkit:
0, U 0.5
x 1, 0.5 U 0.8
2, 0.8 U 1.0
Perhatikan U1 = 0.73:
F(xi-1) < U <= F(xi)
F(x0) < 0.73 <= F(x1)
Maka, x1 = 1
Tahap:
1. Ambil g(x) dari sebaran Uniform(0,1)
2. Maka f(x)/g(x) ≤ 6 untuk 0 < x < 1.
3. Sebuah x acak dari g(x) diterima jika
f(x)/ [c g(x)] = 6x(1-x) / [6(1)] = x(1-x) > u
1.5
u <- runif(1)
j <- j+1
x <- runif(1)
1.0
if (x*(1-x) > u) {
k <- k+1 # terima x Density
Des, 2017
Y1 Y2 Y3 YN
•The distribution of our estimator (Y) depends on both the true distribution and the size (k) of our sample
Mean=4.13
X=(3.12, 0, 1.57,
19.67, 0.22, 2.20)
Mean=4.46
Mean=4.64
X3=(0.22, 3.12,1.57,
3.12, 2.20, 0.22)
Mean=1.74
• Another methods:
• Convert into pseudovalues:
φ1 = n⋅s - (n-1)s-1
φ2 = n⋅s - (n-1)s-2
Etc.
Fixed n
Variable n
Self-comparisons not a problem
Self-comparisons a problem
Reduces Bias
e.g. Mean of associations
Gives SE’s, confidence intervals and Only directly gives SE
profile of confidence Confidence intervals need assumption of normality