DPMrandom: Extracts Random Effects

Description Usage Arguments Author(s) Examples

Description

Extracts random effects from DPpackage objects: DPMlmm, DPMolmm, and DPMglmm.

Usage

1
2
DPMrandom(object,centered=FALSE,predictive=FALSE,
          ngrid=1000,gridl=NULL)

Arguments

object

DPM 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.

ngrid

number of grid points where the density estimate is evaluated. This is only used if dimension of the random effects is lower or equal than 2. The default value is 1000.

gridl

The limits of the interval or rectangle covered by the grid as c(xl,xu) or c(xl, xu, yl, yu), respectively. If not specified the grid is defined automatically. This is only used if dimension of the random effects is lower or equal than 2 and if predictive=TRUE.

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
49
50
51
52
## Not run: 

    # School Girls Data Example

      data(schoolgirls)
      attach(schoolgirls)

    # Prior information

      prior<-list(alpha=1,
                  tau1=0.01,tau2=0.01,
                  nu0=4.01,
                  tinv=diag(10,2),
                  nub=4.01,
                  tbinv=diag(10,2),
                  mb=rep(0,2),
                  Sb=diag(1000,2))

    # Initial state
      state <- NULL

    # MCMC parameters

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

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

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

    # Extract predictive information of random effects
    
      DPMrandom(fit1,predictive=TRUE)
      plot(DPMrandom(fit1,predictive=TRUE,gridl=c(75,89,3.8,7.5)))


## End(Not run)

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