accruedErrors: Function to calculate error between partially accrued data...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/accruedErrors.R

Description

Returns the error between final data values and partially accruing values, by accrual lag.

Usage

1
accruedErrors(x, y=NULL, func=NULL)

Arguments

x

Object of the accrued class.

y

Optional second object of the accrued class.

func

Error function to calcuate errors. Default behavior depends on whether one or two objects are included in the call. The first argument is the final value of the indicator and the second argument is the lagged value of the indicator.

Details

If only x is specified, calculates the error between each lag value and the final value for each encounter date. If both x and y are specified, then the error is calculated for the ratio y/x (except in that X/0 is set to NA for all X). The deault error function in only x is specified is the difference between the lag value and the corresponding final value. The default error function if both are specified is the difference in logs of the two values.

Value

An object of the accruedErrors class which consists of a matrix with columns "EncounterDate", "Lag" and "Error".

Author(s)

Julie Eaton and Ian Painter

See Also

data.accrued, plot.accruedErrors, summary.accruedErrors

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
	data(accruedDataExample)	# simulated accrued data 
	testData <- data.accrued(accruedDataExample)	
	errors <- accruedErrors(testData)
	plot(errors)
	errors <- accruedErrors(testData, func = function(a,b) {sqrt(a) - sqrt(b)} )
	plot(errors)
	
	data(accruedDataILIExample)	# simulated accrued data - ILI counts
	testData2 = data.accrued(accruedDataILIExample)
	errors <- accruedErrors(testData, testData2)
	plot(errors)

accrued documentation built on May 30, 2017, 8:14 a.m.