DPrandom: Extracts Random Effects

Description Usage Arguments Author(s) Examples

Description

This generic function extracts Random Effects' information from DPpackage model objects.

Usage

1
DPrandom(object,centered=FALSE,predictive=FALSE)

Arguments

object

DP fitted model object from which random effects estimates can be extracted.

centered

logical variable indicating whether the random effects should be extracted centered, bi, or uncentered thetai.

predictive

logical variable indicating whether actual or predictive information of the random effects should be extracted.

Author(s)

Alejandro Jara <atjara@uc.cl>

Examples

 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
## Not run: 
    # School Girls Data Example

      data(schoolgirls)
      attach(schoolgirls)

    # Prior information
    # Prior information

      tinv<-diag(10,2)
      prior<-list(alpha=1,nu0=4.01,tau1=0.001,tau2=0.001,
      tinv=tinv,mub=rep(0,2),Sb=diag(1000,2))

    # Initial state
      state <- NULL

    # MCMC parameters

      nburn<-5000
      nsave<-25000
      nskip<-20
      ndisplay<-1000
      mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,ndisplay=ndisplay)

    # Fit the model
    
      fit1<-DPlmm(fixed=height~1,random=~age|child,prior=prior,mcmc=mcmc,
                  state=state,status=TRUE)
      fit1


    # Extract random effects
    
      DPrandom(fit1)
      DPrandom(fit1,centered=TRUE)
      
      plot(DPrandom(fit1))
      plot(DPrandom(fit1,centered=TRUE))

    # Extract predictive information of random effects
    
      DPrandom(fit1,predictive=TRUE)
      DPrandom(fit1,centered=TRUE,predictive=TRUE)
      
      plot(DPrandom(fit1,predictive=TRUE))
      plot(DPrandom(fit1,centered=TRUE,predictive=TRUE))

## End(Not run)

DPpackage documentation built on May 1, 2019, 10:23 p.m.