Learn R Programming

adlift (version 0.8-2)

AdaptNeighmp: AdaptNeighmp

Description

This function performs the prediction lifting step over neighbourhoods and interpolation schemes, for multiple point data.

Usage

AdaptNeighmp(pointsin, X, coefflist, coeff, nbrs, newnbrs, remove, intercept,
 neighbours, mpdet, g)

Arguments

pointsin
The indices of gridpoints still to be removed.
X
the vector of grid values.
coeff
the vector of detail and scaling coefficients at that step of the transform.
coefflist
the list of detail and multiple scaling coefficients at that step of the transform.
nbrs
the indices (into X) of the neighbours to be used in the prediction step.
newnbrs
as nbrs, but repeated according to the multiple point structure of the grid.
remove
the index (into X) of the point to be removed.
intercept
Boolean value for whether or not an intercept is used in the prediction step of the transform.
neighbours
the number of neighbours in the computation of the predicted value. This is not actually used specifically in AdaptNeighmp, since this is known already from nbrs.
mpdet
how the mutiple point detail coefficients are computed. Possible values are "ave", in which the multiple detail coefficients produced when performing the multiple predictions are averaged, or "min", where the overall minimum detail coefficient is taken.
g
the group structure of the multiple point data.

Value

  • results.This is a ten item list giving the regression information chosen from the detail coefficient minimisation (i.e, the information supplied to AdaptNeigh by AdaptPred):
  • Xneighmatrix of X values corresponding to the neighbours of the removed point. The matrix consists of columns $1,X[nbrs],X[nbrs]^2,...$ depending on the order of the prediction used and whether or not an intercept is used. Refer to any reference on linear regression for more details.
  • mmthe matrix from which the prediction is made. In terms of Xneigh, it is $({Xneigh}^T Xneigh)^{-1} {Xneigh}^T$ .
  • bhatThe regression coefficients used in prediction.
  • weightsthe prediction weights for the neighbours.
  • predthe predicted function value obtained from the regression.
  • coeffvector of (modified) detail and scaling coefficients to be used in the update step of the transform.
  • intif TRUE, an intercept was used in the regression.
  • schemea character vector denoting the type of regression used in the prediction ("Linear", "Quad" or "Cubic").
  • detailsa vector of the detail coefficients from which AdaptPred selects the minimum value. There are six entries. The first three entries represent the detail coefficients from regression with no intercept in increasing order of prediction. The second three details are values for regression with intercept.
  • minindexthe index into details (results[[9]]) which produces the minimum value.
  • newinfo. A six item list containing extra information to be used in the main transform procedure (fwtnp) obtained from the minimisation in AdaptNeigh:
  • cloboolean value telling the configuration of the neighbours which produce the overall minimum detail coefficient.
  • totalminindexthe index into mindetails (below) indicating the overall minimum detail coefficient produced by the procedure.
  • nbrsthe indices into X of the neighbours used in the best prediction scheme.
  • indexthe indices into pointsin of the neighbours used in the best prediction.
  • mindetailsa vector of 3*neighbours entries giving the minimum details produced by each call of AdaptPred in AdaptNeigh (for the different number and configuration of neighbours).
  • minindicesvector of 3*neighbours entries giving the index (out of 6) of the schemes which produce the best predictions by each call of AdaptPred in AdaptNeigh.

Details

The procedure performs adaptive regression (through AdaptPred) over the three types of regression and also over the 3*neighbours configurations of neighbours. The combination (type of regression, configuration of neighbours) is chosen which gives the smallest detail coefficient (in absolute value).

See Also

AdaptPredmp, fwtnpmp

Examples

Run this code
#read in data with multiple values...

mcdata()

short<-adjustx(times,accel,"mean")
X<-short$sepx
coeff<-short$sepx
g<-short$g

coefflist<-list()
for (i in 1:length(g)){
coefflist[[i]]<-accel[g[[i]]]
}

#work out neighbours of point to be removed (31)

out<-getnbrs(X,31,order(X),2,TRUE)
nbrs<-out$n

nbrs

newnbrs<-NULL
for (i in 1:length(nbrs)){
newnbrs<-c(newnbrs,rep(nbrs[i],times=length(g[[nbrs[i]]])))
}

#work out repeated neighbours using g...
newnbrs

AdaptNeighmp(order(X),X,coefflist,coeff,nbrs,newnbrs,31,TRUE,2,"ave",g)

Run the code above in your browser using DataLab