Skip to contents

Function to generate the empirical distribution of the runs test statistic, given some data and a model.

Usage

getEmpDistribution(
  n.sim,
  simData,
  model,
  data,
  plot = FALSE,
  returnDist = TRUE,
  dots = TRUE
)

Arguments

n.sim

The number of simulated sets of data.

simData

A matrix, where each column is a set of data simulated under independence, with rows the same length as the data used for the model.

model

a glm or gamMRSea model object

data

data set used to fit the model.

plot

logical flag. If TRUE, a plot is made showing the 5% critical values for the empirical distribution vs the N(0,1) distribution. Default is FALSE

returnDist

logical flag. Do you want the distribution of test statistics returned (TRUE) or just the 5% critical values (FALSE)

dots

(Default: TRUE. Logical stating whether to show a printout of block numbers to assess progress. TRUE will print dots into the workspace.

Author

LAS Scott-Hayward, University of St Andrews

Examples

data(ns.data.re)

model<-gamMRSea(birds ~ observationhour + as.factor(floodebb) + as.factor(impact),  
              family='poisson', data=ns.data.re)

simData<-generateNoise(n=500, response=fitted(model), family='poisson')
empdist<-getEmpDistribution(500, simData, model, data=ns.data.re, plot=FALSE, 
                returnDist=TRUE,dots=FALSE)