#include <cumres.hpp>

Collaboration diagram for target::cumres:

Public Member Functions

 cumres (const arma::vec &r, const arma::mat &dr, const arma::mat &ic)
 Constructor. More...
 
void order (const arma::mat &inp, arma::vec b=arma::vec())
 Set variables to order after and bandwidth.
 
arma::vec rnorm ()
 Draw n samples from standard normal distribution. More...
 
arma::mat obs ()
 Calculate observed cumulative residual process. More...
 
arma::mat sample (const arma::umat &idx=arma::umat())
 Simulate one process under the null hypothesis of a correctly specified model. More...
 
arma::mat sample (unsigned R, const arma::umat &idx=arma::umat(), bool quantiles=true)
 Sample R processes and calculate test statistics under the null (Suprememum and L2 statistics) More...
 

Public Attributes

unsigned n
 Sample size.
 
arma::vec r
 Residuals.
 
arma::umat ord
 Stores order of observations to cumulate after.
 
arma::mat dr
 Derivative of residuals wrt model parameters.
 
arma::mat ic
 Influence curve.
 
arma::mat inp
 Variable to order residuals after.
 
arma::vec b
 Bandwidth of moving average.
 
arma::mat qt
 Stores data for calculations of quantiles.
 
arma::mat eta
 Cumulative derivative of residuals.
 

Detailed Description

The cumres class provides a data structure for calculating goodness-of-fit statistics based on aggregation of residuals (cumulative residuals) of a statistical model.

Definition at line 20 of file cumres.hpp.

Constructor & Destructor Documentation

target::cumres::cumres ( const arma::vec &  r,
const arma::mat &  dr,
const arma::mat &  ic 
)

Constructor.

Constructor for the cumres class.

Parameters
rcolumn vector of residuals
drmatrix of partial deriatives of the residuals wrt to the parameter vector
icmatrix with the estimated influence functions for the parametric model

Definition at line 22 of file cumres.cpp.

Member Function Documentation

arma::mat target::cumres::obs ( )

Calculate observed cumulative residual process.

Calculate the observed cumulative residual process

\[ W(t) = n^{-1/2}\sum_{i=1}^n 1\{t-b<X_i\leq t\}r_i, \]

where \(r_i\) is the the residual corresponding to the \(i\)th observation and \(X_i\) is the variable which the process is ordered against (as defined by the inp argument to cumres::order).

When b is not set (i.e., an empty vector) the standard cumulative residual process is calculated (corresponding to \(b=\infty\)):

\[ W(t) = n^{-1/2}\sum_{i=1}^n 1\{X_i\leq t\}r_i.\]

Definition at line 89 of file cumres.cpp.

arma::vec target::cumres::rnorm ( )

Draw n samples from standard normal distribution.

Sample n independent standard normal distributed variables.

Definition at line 64 of file cumres.cpp.

arma::mat target::cumres::sample ( const arma::umat &  idx = arma::umat())

Simulate one process under the null hypothesis of a correctly specified model.

Obtain a single sample of the residual process under the null hypothesis (true model).

Parameters
idxindices in which to evaluate the process. If this is an empty vector the process is evaluated in all observed points.

Definition at line 117 of file cumres.cpp.

arma::mat target::cumres::sample ( unsigned  R,
const arma::umat &  idx = arma::umat(),
bool  quantiles = true 
)

Sample R processes and calculate test statistics under the null (Suprememum and L2 statistics)

Draw R samples from the cumulative residual process under the null hypothesis (true model)

Parameters
RNumber of process to sample
idxsubset of indices to evalute the process in
quantilesBoolean that defines whether quantiles of the sampled process is to be estimated
Returns
arma::mat \(R\times 2p\) matrix with Supremum and L2 test statistics for each of the \(p\) variables (columns in the inp variable defined in cumres::order)

Definition at line 162 of file cumres.cpp.


The documentation for this class was generated from the following files: