graphrate.fun: Plot fitted and empirical PP occurrence rates

Description Usage Arguments Details See Also Examples

View source: R/graphrate.fun.r

Description

This function calculates the empirical and the cumulative fitted occurrence rate of a PP on overlapping or disjoint intervals and plot them versus time.

Usage

1
2
3
graphrate.fun(objres = NULL, fittedlambda = NULL, emplambda = NULL, t = NULL, 
lint = NULL, typeI = "Disjoint", tit = "", scax = NULL, scay = NULL, 
xlegend = "topleft",histWgraph=TRUE)

Arguments

objres

Optional. A list with (at least) elements fittedlambda, emplambda, t, and typeI. For example, the output from CalcRes.fun or CalcResD.fun; see those functions for details.

fittedlambda

Optional. Numeric vector of the cumulative fitted intensities \hat λ(t) over the considered intervals (and usually divided by the length of the interval).

emplambda

Optional. Numeric vector of the empirical PP occurrence rates estimated over the considered intervals (usually divided by the length of the interval).

t

Optional. Time vector of the PP observation period.

lint

Optional. Length of the intervals used to calculate the empirical and the (cumulative) fitted occurrence intensities.

typeI

Label indicating the type ('Overlapping' or 'Disjoint') of the intervals.

tit

Character string. A title for the plot.

scax

Optional. Vector of two values giving the range of values for the x-axis. An adequate range is selected by default.

scay

Optional. Vector of two values giving the range of values for the y-axis. An adequate range is selected by default.

xlegend

Label indicating the position where the legend on the graph will be located.

histWgraph

Logical flag. If it is TRUE, a new graphical device is opened with the option record=TRUE. This option may not work on some platforms; for example, RStudio does not allow the user to open new graphical devices.

Details

Either the argument objres or the set of arguments (fittedlambda, emplambda, t) must be specified. If objres is provided, fittedlambda, emplambda, t,lint and typeI are ignored.

In order to make comparable the empirical and the fitted occurrence rates, a cumulative fitted rate must be used. That means that argument fittedlambda must be the sum of the intensities fitted by the model over the same interval where the empirical rates have been calculated.

See Also

CalcRes.fun, CalcResD.fun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##plot of rates based on overlapping intervals
graphrate.fun(emplambda=runif(500,0,1), fittedlambda=runif(500,0,1), 
	t=c(1:500), lint=100, tit="Example", typeI="Overlapping")

#plot of rates based on disjoint intervals
graphrate.fun(emplambda=runif(50,0,1), fittedlambda=runif(50,0,1), 
	t=c(1:50), lint=10, tit="Example", typeI="Disjoint")

#Example using objres as input. In this example X1 has no influence on the rate;
#consequently the fitted rate is almost a constant.

X1<-rnorm(1000)

modE<-fitPP.fun(tind=TRUE,covariates=cbind(X1), 
	posE=round(runif(40,1,1000)), inddat=rep(1,1000),
	tim=c(1:1000), tit="Simulated example", start=list(b0=1,b1=0),
	modCI=FALSE,modSim=TRUE,dplot=FALSE)

ResDE<-CalcResD.fun(mlePP=modE,lint=50)

graphrate.fun(ResDE, tit="Example")

NHPoisson documentation built on Feb. 19, 2020, 5:07 p.m.