R: Extracts Random Effects

PTrandom {DPpackage} | R Documentation

## Extracts Random Effects

### Description

Extracts random effects from PTglmm objects: PTlmm, PTolmm, and PTglmm.

### Usage

    PTrandom(object,centered=FALSE,predictive=FALSE,ngrid=1000,gridl=NULL)

### Arguments

`object` | PT 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`. This option cannot be only used to get the density estimates.
`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 and if predictive=TRUE. 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>

Tim Hanson <hansont@stat.sc.edu>

### Examples

    ## Not run:
        # School Girls Data Example
          data(schoolgirls)
          attach(schoolgirls)

        # Prior information
          prior<-list(alpha=1,
                      M=4,
                      tau1=0.01,tau2=0.01,
                      nu0=4.01,
                      tinv=diag(10,2),
                      mub=rep(0,2),
                      Sb=diag(1000,2))

        # Initial state
          state <- NULL

        # MCMC parameters

          nburn<-5000
          nsave<-5000
          nskip<-0
          ndisplay<-100
          mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,ndisplay=ndisplay,
                        tune1=1.5,tune2=1.1)

        # Fitting the model

          fit1<-PTlmm(fixed=height~1,random=~age|child,prior=prior,mcmc=mcmc,
                      state=state,status=TRUE)
          fit1

        # Extract random effects

          PTrandom(fit1)

          plot(PTrandom(fit1))

        # Extract predictive information of random effects

          PTrandom(fit1,predictive=TRUE)
          plot(PTrandom(fit1,predictive=TRUE,gridl=c(75,89,3.8,7.5)))

    ## End(Not run)

[Package DPpackage version 1.1-7.4 Index]