Bayesian nonparametrics Dr. Jarad Niemi STAT 615 - Iowa State - - PowerPoint PPT Presentation

bayesian nonparametrics
SMART_READER_LITE
LIVE PREVIEW

Bayesian nonparametrics Dr. Jarad Niemi STAT 615 - Iowa State - - PowerPoint PPT Presentation

Bayesian nonparametrics Dr. Jarad Niemi STAT 615 - Iowa State University December 5, 2017 Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 1 / 34 Bayesian nonparametrics Bayesian nonparametrics There are two main


slide-1
SLIDE 1

Bayesian nonparametrics

  • Dr. Jarad Niemi

STAT 615 - Iowa State University

December 5, 2017

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 1 / 34

slide-2
SLIDE 2

Bayesian nonparametrics

Bayesian nonparametrics

There are two main approaches to Bayesian nonparametrics for density estimation Dirichlet process and Polya trees See M¨ uller and Mitra (2013) for a general overview of all Bayesian nonparametric problems, e.g. density estimation, clustering, regression, random effects distributions, etc.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 2 / 34

slide-3
SLIDE 3

Bayesian nonparametrics

Motivation

0.00 0.05 0.10 0.15 0.20 4 8

phi density Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 3 / 34

slide-4
SLIDE 4

Bayesian nonparametrics

Goal

Let Yi come from an unknown probability measure G, i.e. Yi ∼ G. As a Bayesian, the natural approach is to put a prior on G. That is, we want to make statements like P(Yi ∈ A) = G(A) for any set A.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 4 / 34

slide-5
SLIDE 5

Bayesian nonparametrics

Dirichlet process

One approach is to use a Dirichlet process (Ferguson 1973). We write G ∼ DP(aG0) where a > 0 is concentration (or total mass) parameter and G0 is the base measure, i.e. a probability distribution defined on the support of G. For any partition A1, . . . , AK of the sample space S, the probability vector [G(A1), . . . , G(AK)] follows a Dirichlet distribution, i.e. [G(A1), . . . , G(AK)] ∼ Dir([aG0(A1), . . . , aG0(aK)]). Thus E[G(A1)] = G0(A1) and V ar[G(A1)] = G0(A1)[1−G0(A1)]

1+a

.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 5 / 34

slide-6
SLIDE 6

Bayesian nonparametrics

Conjugacy of the Dirichlet process

Assume Yi

ind

∼ G and G ∼ DP(aG0) then for any partition {A1, . . . , AK}, we have [G(A1), . . . , G(AK)]|y ∼ Dir ([aG0(A1) + n

i=1 I(yi ∈ A1), . . . , aG0(AK) + n i=1 I(yi ∈ AK)])

and thus G|y ∼ DP

  • aG0 +

n

  • i=1

δyi

  • which has

E[G(A)|y] =

  • a

a + n

  • G0(A) +
  • n

a + n

  • n
  • i=1

1 nI(yi ∈ A)

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 6 / 34

slide-7
SLIDE 7

Bayesian nonparametrics

Stick-breaking representation

A constructive representation of the Dirichlet process is the stick-breaking

  • representation. Assume G ∼ DP(aG0), then

G(·) =

  • h=1

πhδθh(·) where π ∼ stick(a) and θh

ind

∼ G0. The stick distribution is the following: πh = νh

  • ℓ<h(1 − νℓ) and

νh

ind

∼ Be(1, a).

1 π1 π2 π3 π4 π5 …

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 7 / 34

slide-8
SLIDE 8

Bayesian nonparametrics

Realizations from a DP

Base measure is a standard normal. Realizations are across the columns and values for a are down the rows.

1 2 3 4 0.01 0.1 1 10 100 −5.0 −2.5 0.0 2.5 5.0 −5.0 −2.5 0.0 2.5 5.0 −5.0 −2.5 0.0 2.5 5.0 −5.0 −2.5 0.0 2.5 5.0 0.0 2.5 5.0 7.5 10.0 0.0 2.5 5.0 7.5 10.0 0.0 2.5 5.0 7.5 10.0 0.0 0.5 1.0 1.5 2.0 0.0 0.2 0.4 0.6 0.8

theta density Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 8 / 34

slide-9
SLIDE 9

Bayesian nonparametrics

DP mixture

If we have an absolutely continuous distribution we are trying to approximate, then a DP is not reasonable. Thus, we may want to use a DP mixture, i.e. Yi

ind

∼ p(·|θi), θi

ind

∼ G, G ∼ DP(aG0) for some parametric model p(·|θ). Alternatively, if we use the stick-breaking construction, we have Yi

ind

∼ p(·|θi), θi

ind

  • h=1

πhδθ∗

h

where θ∗

h ind

∼ G0 and π ∼ stick(a).

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 9 / 34

slide-10
SLIDE 10

Bayesian nonparametrics

Finite approximation to the stick-breaking representation

For some ǫ > 0, there exists an H such that ∞

h=H πh < ǫ and

components H and beyond can reasonably be ignored. The resulting model is Yi

ind

∼ p(·|θi), θi

ind

H

  • h=1

πhδθ∗

h

where πh = νh

  • ℓ<h(1 − νℓ)

νh

ind

∼ Be(1, a) for h < H, and νH = 1.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 10 / 34

slide-11
SLIDE 11

Bayesian nonparametrics Normal example

Normal example

A DP mixture model for the marginal distribution for Yi = φi is Yi

ind

∼ N(µi, σ2

i )

µi σ2

i

H

  • h=1

πhδ(µ∗

h,σ2∗ h )

where H

h=1 πh = 1.

Alternatively, we can introduce a latent variable ζi = h if observation i came from group h. Then Yi|ζi = h

ind

∼ N(µ∗

h, σ2∗ h )

ζi

ind

∼ Cat(H, π) where ζ ∼ Cat(H, π) is a categorical random variable with P(ζ = h) = πh for h = 1, . . . , H and π = (π1, . . . , πH).

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 11 / 34

slide-12
SLIDE 12

Bayesian nonparametrics Normal example

Normal example

Let Yi

ind

∼ N(µi, σ2

i ),

(µi, σ2

i ) ind

H

  • h=1

πhδ(µ∗

h,σ2∗ h )

where the base measure G0 is µ∗

h|σ2∗ h ind

∼ N(mh, v2

hσ2∗ h )

and σ2∗

h ind

∼ IG(ch, dh). But since each (µi, σ2

i ) must equal (µ∗ h, σ2∗ h ) for some h, we can rewrite

the model as Yi

ind

H

  • h=1

πhN(µ∗

h, σ2∗ h )

with a prior that is equal to the base measure. Thus this model is equivalent to our finite mixture with the exception of the prior for π.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 12 / 34

slide-13
SLIDE 13

Bayesian nonparametrics Normal example

MCMC - Blocked Gibbs sampler

The steps of a Gibbs sampler with stationary distribution p(π, µ, σ2, ζ|y) ∝ p(y|ζ, µ, σ2)p(ζ|π)p(µ|σ2)p(σ2)p(π) has steps

  • 1. For i = 1, . . . , n, independently sample ζi from its full conditional

P(ζi = h| . . .) ∝ πhN(yi; µ∗

h, σ2∗ h )

  • 2. Jointly sample π and µ, σ2 because they are conditionally independent.
  • a. Sample νh

ind

∼ Be(1 + Zh, a + Z+

h ) for V = 1, . . . , H − 1 where

Zh = n

i=1 I(ζi = h) and Z+ h = H h′=h+1 Zh′ and set νH = 1. Then

calculate πh = νh

  • ℓ<h(1 − νℓ).
  • b. For h = 1, . . . , H, sample µh, σ2

h from their full conditional

µ∗

h|σ2∗ h ind

∼ N(m′

h, v′2 h σ2∗ h )

σ2∗

h ind

∼ IG(c′

h, d′ h)

where m′

h, v′2 h , c′ h, and d′ h are exactly the same as in the normal finite

mixture MCMC.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 13 / 34

slide-14
SLIDE 14

Bayesian nonparametrics JAGS library("rjags") dp_normal_blocked = " model { for (i in 1:n) { y[i] ~ dnorm(mu[zeta[i]], tau[zeta[i]]) zeta[i] ~ dcat(pi[]) } for (h in 1:H) { mu[h] ~ dnorm(2,1/3) tau[h] ~ dgamma(.1,.1) sigma[h] <- 1/sqrt(tau[h]) } # Stick breaking for (h in 1:(H-1)) { V[h] ~ dbeta(1,a) } V[H] <- 1 pi[1] <- V[1] for (h in 2:H) { pi[h] <- V[h] * (1-V[h-1]) * pi[h-1] / V[h-1] } }" tmp = hat[sample(nrow(hat), 1000),] dat = list(n=nrow(tmp), H=25, y=tmp$phi, a=1) jm = jags.model(textConnection(dp_normal_blocked), data = dat, n.chains = 3) r = jags.samples(jm, c('mu','sigma','pi','zeta'), 1e3) Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 14 / 34

slide-15
SLIDE 15

Bayesian nonparametrics JAGS

Monitor convergence of density

As previously discussed, the model as constructed as identifiability problems among the πh, µ∗

h, and σ2∗ h due to label switching. What is

identified in the model is the value of the density at any particular value. So rather than directly monitoring the parameters, we will monitor the estimated density, i.e. at iteration m of the MCMC, the estimated density at location x is

H

  • h=1

π(m)

h

N(x; µ∗(m)

h

, σ2∗(m)

h

). Monitoring this quantity at a variety of locations x will provide appropriate convergence assessment.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 15 / 34

slide-16
SLIDE 16

Bayesian nonparametrics JAGS

Monitor convergence of density

1.32209172503982 1.73489943657589 −2.53078024929682 −2.11797253776076 250 500 750 1000 250 500 750 1000 250 500 750 1000 250 500 750 1000 0.3 0.4 0.5 0.6 0.7 0.05 0.07 0.09 0.11 0.13 0.000 0.001 0.002 0.003 0.004 0.005 0.06 0.08 0.10 0.12

iteration density chain

1 2 3

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 16 / 34

slide-17
SLIDE 17

Bayesian nonparametrics JAGS

Monitoring the number of utilized components

Since we are using a finite approximation to the DP, we should monitor the index of the maximum occupied component (or the number of

  • ccupied clusters). If the finite approximation is reasonable, then this

number will be smaller than H. If not, then H should be increased. Specifically, at iteration m, we monitor max{ζ(m)

1

, . . . , ζ(m)

n

, } the index of the maximum occupied cluster, or

H

  • h=1

I(Zh > 0), the number of occupied clusters.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 17 / 34

slide-18
SLIDE 18

Bayesian nonparametrics JAGS

Monitoring the number of utilized components

10 15 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000

iteration max_index chain

1 2 3

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 18 / 34

slide-19
SLIDE 19

Bayesian nonparametrics JAGS

Posterior density estimation

0.0 0.2 0.4 0.6 4 8

x density Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 19 / 34

slide-20
SLIDE 20

Bayesian nonparametrics JAGS

Chinese restaurant process

Rather than utilizing the finite approximation to the DP, we can use the DP directly, by marginalizing out G. This results in a prior directly on θ1, . . . , θn via θi|θ1, . . . , θi−1 ∼

  • a

a + i − 1

  • G0(θi) +

i−1

  • j=1
  • 1

a + i − 1

  • δθj

The conditional prior for θi is θi|θ−i ∼

  • a

a + n − 1

  • G0(θi) +
  • j=i
  • 1

a + n − 1

  • δθj
  • r, equivalently,

θi|θ−i ∼

  • a

a + n − 1

  • G0(θi) +

H(−i)

  • h=1
  • n(−i)

h

a + n − 1

  • δθ∗

h

where H(−i) is the number of components without i and n(−i)

h

is the number of

  • bservations in each component without i.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 20 / 34

slide-21
SLIDE 21

Bayesian nonparametrics JAGS

Marginalized Gibbs sampler

Using this Chinese restaurant process, we have the following n + 1-step MCMC

  • 1. For i = 1, . . . , n, sample ζi from its full conditional

P(ζi = h|ζ−i, . . .) ∝

  • n(−i)

h

p(yi|θ∗

h)

h = 1, . . . , H(−i) a

  • p(yi; θ)dG0(θ)

h = H(−i) + 1 If ζi = H(−i) + 1, then sample θ∗

ζi from its posterior using yi as the

  • nly observation.
  • 2. For h = 1, . . . , H, sample θ∗

h from their full conditional

θ∗

h| . . . ∝ G0(θ∗ h)

  • i:ζi=h

p(yi|θ∗

h)

i.e. sample the parameters from their posteriors using only the data in that group.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 21 / 34

slide-22
SLIDE 22

Bayesian nonparametrics JAGS

Marginalized Gibbs sampler - Normal example

For the normal example, we have this n + 1-step sampler

  • 1. For i = 1, . . . , n, sample ζi from its full conditional

P(ζi = h|ζ−i, . . .) ∝

  • n(−i)

h

N(yi; µ∗

h, σ2∗ h )

h = 1, . . . , H(−i) a t2c(yi; m, v2[d/c]) h = H(−i) + 1 If ζi = H(−i) + 1, then sample µ∗

ζi, σ2∗ ζi from its

normal-inverse-gamma posterior using yi as a the only observation.

  • 2. For h = 1, . . . , H, sample µh, σ2

h from their full conditional

µ∗

h|σ2∗ h ind

∼ N(m′

h, v′2 h σ2∗ h )

σ2∗

h ind

∼ IG(c′

h, d′ h)

where m′

h, v′2 h , c′ h, and d′ h are exactly the same as in the normal finite

mixture MCMC.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 22 / 34

slide-23
SLIDE 23

Bayesian nonparametrics JAGS

Putting a prior on the concentration parameter

If G ∼ DP(aG0), then the concentration parameter (a) controls the prior

  • n the number of clusters. For example, if a = 1, then in the prior two

randomly selected observations have a 0.5 probability of belonging to the same cluster. As a increases, then you have more clusters and more concentration around G0. As a decreases, then you have fewer clusters and the data are more informative. Rather than setting the concentration parameter, we can learn it. Let G ∼ DP(αG0) and α ∼ Ga(a, b) then the full conditional for α is α| . . . ∼ Ga

  • a + H − 1, b −

H−1

  • h=1

log(1 − νh)

  • .

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 23 / 34

slide-24
SLIDE 24

Bayesian nonparametrics Hierarchical dependence

Multiple groups

Suppose we have Yij for i = 1, . . . , nj and j = 1, . . . , J, i.e. we have J groups with nj observations per group. We may consider a DP for each group individually, i.e. Yij

ind

∼ Gj, Gj

ind

∼ DP(αjG0j) where we must now specify αj and G0j for j = 1, . . . , J. More importantly, this model does not allow us to borrow any information across the groups since the observations across groups given αj and G0j. Some possible models to allow borrowing of information are the Dependent Dirichlet process (DDP) Hierarchical Dirichlet process (HDP) Nested Dirichlet process (NDP)

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 24 / 34

slide-25
SLIDE 25

Bayesian nonparametrics Hierarchical dependence

Dependent Dirichlet process

Suppose we are interested in estimating a collection of random probability measures G1, . . . , GJ. We would like for the measures to be DPs marginally, i.e. Gj

ind

∼ DP(αjG0j) but we may want to incorporate dependency between the measures and thus borrow information across the measures. One approach is a “fixed-π DDP” which is defined via the stick-breaking process such that each measure has the same weights π but the locations vary, i.e. Gj

d

=

  • h=1

πhδθ∗

jh,

π ∼ stick(α), θ∗

jh ∼ G0

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 25 / 34

slide-26
SLIDE 26

Bayesian nonparametrics Hierarchical dependence

Hierarchical Dirichlet process

An alternative is to build a hierarchical model, i.e. Gj

ind

∼ DP(αG0) G0 ∼ DP(βG00) The stick-breaking process related to this model is Gj

d

=

  • h=1

πjhδθ∗

h,

G0

d

=

  • h=1

λhδθ∗

h,

θ∗

h ∼ G00

where πj = (πj1, πj2, . . .) ∼ stick(α) and λ = (λ1, λ2, . . .) ∼ stick(β). Like the DDP, the HDP allows individuals in different groups to be clustered together, i.e. have the same θ∗

h.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 26 / 34

slide-27
SLIDE 27

Bayesian nonparametrics Hierarchical dependence

Nested Dirichlet process

Rather than clusting individuals across groups, we may be interested in clustering groups themselves, i.e. groups that have the same distribution should be treated as the same group. Here we can use the nested Dirichlet process: Gj

ind

∼ G, G ∼ DP(αG0), G0 ≡ DP(βG00). The stick-breaking process related to this model is Gj

ind

∼ G d =

  • h=1

πhδG∗

h,

π ∼ stick(α), G∗

h ind

∼ DP(βG00). A natural combination of the HDP and NDP is to place a DP on G00 which results in common set of global atoms, i.e. θ∗

h, but with varying

weights for each cluster.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 27 / 34

slide-28
SLIDE 28

Bayesian nonparametrics Applications

Applications of DP

Primarily we have been discussing the use of the DP prior as a tool for Bayesian nonparametric density estimation. Here we discuss additional uses in the context of Random effects Error distributions Functional data analysis

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 28 / 34

slide-29
SLIDE 29

Bayesian nonparametrics Applications

Random effects model

Let yij be the observation for individual i in group j and assume yij = µj + ǫij, µj

ind

∼ F, ǫij

ind

∼ G A typical parametric model would assume F

d

= N(η, τ 2) and G

d

= N(0, σ2). Suppose we would like to be less informative about these distributional

  • assumptions. One possibility is to assume

F

ind

∼ DP(αF0). Now we will estimate the density for the random effects µj. To estimate F, we will need many groups, i.e. J should be large. Alternatively (or additionally), we could assume ǫij

ind

∼ N(0, σ2

i ),

σ2

i ind

∼ G, G ∼ DP(βG0). Here we use the Dirichlet Process mixture to assure that the distribution for the

  • bservations are continuous. To estimate G, we need many observations per

group.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 29 / 34

slide-30
SLIDE 30

Bayesian nonparametrics Applications

Functional data analysis

Let yij be the observation and xij be an explanatory variable for individual i in group j and assume yij = fj(xij) + ǫij, fj(x) =

H

  • h=1

θjhbh(x) where bh(x) for h = 1, . . . , H be a collection of basis functions. Now assume θj = (θj1, . . . , θjH)

ind

∼ G, G ∼ DP(αG0) To provide parismony, i.e. dropping basis functions, we can utilize a base measure that a point-mass mixtures, i.e. G0h

d

= π0hδ0 + (1 − π0h)N(0, τ 2

h)

If we want t alternatives, let τ ∗

h ∼ IG(·, ·). A conditionally conjugate prior on the

π is π0h

ind

∼ Be(a, b). If exact zeros are not necessary, then let θ∗

ch ind

∼ N(0, τ 2

ch),

τ 2

ch ind

∼ IG(·, ·) and thus have t distribution for the θ∗

ch, but now the MCMC is more efficient.

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 30 / 34

slide-31
SLIDE 31

Bayesian nonparametrics Bayesian nonparametrics in R

Bayesian nonparametrics in R

From CRAN Task View: Bayesian Inference, the packages that contain Dirichlet process related Bayesian nonparametrics are bayesm DPpackage growcurves PReMiuM

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 31 / 34

slide-32
SLIDE 32

Bayesian nonparametrics Bayesian nonparametrics in R

Density estimation in the DPpackage

library("DPpackage") prior = list(alpha=1, m1 = 2, k0 = 1/3, nu1 = 0.2, psiinv1=diag(0.2,1)) mcmc = list(nburn=1000, nsave=10000, nskip=10, ndisplay=100) state = NULL # initial state dp = DPdensity(y = hat$phi, prior = prior, mcmc = mcmc, state=state, status=TRUE) Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 32 / 34

slide-33
SLIDE 33

Bayesian nonparametrics Bayesian nonparametrics in R

Density estimation in the DPpackage

?DPlmm ?DPglmm ?DPMlmm ?PMglmm ?DPolmm ?HDPMdensity ?PTdensity Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 33 / 34

slide-34
SLIDE 34

Bayesian nonparametrics Bayesian nonparametrics in R

References

Ferguson, T. S. (1973). A Bayesian analysis of some nonparametric

  • problems. The Annals of Statistics, 209-230.

Neal, R. M. (2000). Markov Chain sampling methods for Dirichlet process mixture models. Journal of Computational and Graphical Statistics, 9: 249-265. M¨ uller, P., and Mitra, R. (2013). Bayesian nonparametric inferencewhy and how. Bayesian Analysis, 8(2).

Jarad Niemi (STAT615@ISU) Bayesian nonparametrics December 5, 2017 34 / 34