Learn R Programming

dlsem (version 1.3.2)

applyDiff: Differentiation

Description

Apply k-th order differentiation to one or more quantitative variables. A single group factor may be taken into account.

Usage

applyDiff(x = NULL, group = NULL, time = NULL, data, k = 0)

Arguments

x
A vector containing the names of the quantitative variables to be differenced. If NULL, all quantitative variables will be differenced.
group
The name of a group factor (optional). If NULL, no groups are considered.
time
The name of a time factor (optional). If NULL and group is not NULL, data are assumed temporally ordered within each group. If both group and time are NULL, data are assumed temporally ordered.
data
An object of class data.frame containing the variables to be differenced, the group factor if group is not NULL, and the time factor if time is not NULL.
k
The order of differentiation to be applied to all variables, or a vector of orders of differentiation, one for each variable to be differenced. Default is 0 (no differentiation).

Value

data.frame provided to argument data, where the requested variables have been differenced.

See Also

unirootTest, EM.imputation

Examples

Run this code
data(agres)
applyDiff(c("NPATENT","GVA"),group="COUNTRY",data=agres,k=1)

Run the code above in your browser using DataLab