Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/AstroStat/astro193/VLK_feb18.pdf
Дата изменения: Thu Feb 19 01:16:48 2015
Дата индексирования: Sun Apr 10 10:02:28 2016
Кодировка:
Astro 193 : Feb 18
·

Follow up
· ·

projects MI dof -- yes, the square is outside dof = (N-1) (1 + (N/(N+1))(Wii/Bii))
2

· · · ·

least-squares fitting and HW 4 Moments and intervals Random Numbers Binomial, Poisson, Gamma, Normal, І, Student's t


Moments
·

Mm = x p(x) dx or Mm = x p(x) M0=1, mean=M1, variance=M2-M
2 1

m

m

·

Moment Generating Function e f(x) Mm = M/x
x m m

·

Characteristic Function () = e f(x) dx (i) /k! M f(x) = d e
-ix iz k k

(i) /k! M

k

k


Intervals
·

[a,b] such that [
· · ·

a,b]

p(x) dx = c

non-unique equal-tail intervals highest-posterior density intervals

· ·

1 - one-sided and two-sided Gaussian-equivalent 1


Random Numbers


· · · ·

What are random numbers? PRNGs -- Pseudo Random Number Generators Random draws from distributions Rejection sampling


Random Number
·

How many bits are needed to represent the number? Entropy: H(X) = i p(X=x) log p(X=x) Practical issue: must represent a known distribution with high fidelity

· ·


PRNG
·

Generate long, seemingly random sequences that are fully deterministic, keyed to a short initial seed If internal state has n bits, repeats with period at most 2n Beware of: short periodicity, correlations, weak seeds, lack of uniformity, failure against Zipf-law like tests

·

·


PRNG-Examples
· ·

digits of , 2, etc. middle-square method (von Neumann): take a digit, square it, pick the middle digits multiply-with-carry: (axk+bk ) mod 2Ё2, (axk +bk)/2Ё2 Mersenne twister: MT19937 -- default in R, python, IDL, Matlab, Ruby, PHP, etc. Not cryptographically secure, but optimized for Monte Carlo sampling
·

· ·

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html


Draws from Distributions
·

cdf method: from analytical or tabulated 1D functions
· · ·

trivial example: -function -function with a pedestal arbitrary cdf: given r=F(x), compute x=F-1(r)


Rejection sampling
·

Suppose we cannot sample f() directly, but can find g() such that f() Mg() sample ' ~ g() sample u ~ unif(0,1) if u f(')/Mg('), accept ', otherwise reject ' and sample again

· · ·


Rejection sampling

·

Extra reading: Chapter 3 of Robinson


Distributions
Reading: Chapters 2 and 4.5 of Robinson Chapter 4 of Eadie et al


Distributions
What are distributions? where do they come from? how to use them? Binomial, Poisson, Normal, Student's t, І

·

·


R> help(distributions)


Binomial
One or the other, with probability k of one, out of a total of N p(;N,k) = NCk k (1-) cf. (p+q) M
m+1 N N-k

· · · · ·

= N Mm + (1-) Mm/

M0=1, M1=N, M2=N22 + N(1-), variance = N(1-)


Poisson

· · · ·

N k, = Rt/N, N µ finite p(k|µ) = (1/k!) µk e-µ M
m+1

= µ Mm + µ Mm/µ

M0=1, M1= µ, M2= µ2 + µ, variance = µ