R: UndoPointsUpdatemp

UndoPointsUpdatemp {adlift} | R Documentation

## UndoPointsUpdatemp

### Description

This function undoes the update lifting step in the multiple observation inverse transform.

### Usage

    UndoPointsUpdatemp(X, coeff, nbrs, newnbrs, index, remove, r, N, pointsin,
     gamweights, lengths, lengthrem)

### Arguments

`X` | the vector of grid values.
`coeff` | the vector of detail and scaling coefficients at that step of the transform.
`nbrs` | the indices (into X) of the neighbours to be used in the lifting step.
`newnbrs` | as nbrs, but repeated according to the multiple point structure of the grid.
`index` | the indices into pointsin of nbrs, the neighbours of remove, the point to be added.
`remove` | the index (into X) of the point to be added.
`r` | the index into pointsin of the added point, remove.
`N` | length(pointsin).
`pointsin` | The indices of gridpoints still to be added.
`gamweights` | the prediction weights obtained from the regression in the prediction step of the transform.
`lengths` | the vector of interval lengths at the present step of the transform.
`lengthrem` | the interval length associated to the point to be added.

### Details

This procedure uses minimum norm update coefficients to invert the update step of the transform. The prediction weights are used to change the interval lengthsm before the update weights are used to modify coefflist.

### Value

`coeff` | vector of (modified) detail and scaling coefficients to be used later in the transform.
`lengths` | vector of interval lengths after inverting the update step of the transform.
`alpha` | the weights used to modify lengths and coeff.

### Author(s)

Matt Nunes (nunesrpackages@gmail.com), Marina Knight

### See Also

`AdaptNeighmp`, `AdaptPredmp`, `CubicPredmp`, `invtnpmp`, `LinearPredmp`, `PointsUpdatemp`, `QuadPredmp`

### Examples

    #read in data with multiple values...

    data(motorcycledata)
    times<-motorcycledata$time
    accel<-motorcycledata$accel
    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]]]
    }

    I<-intervals(X,"reflect")
    lengths<-lengthintervals(X,I,neighbours=2,closest=TRUE)

    #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

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

    nbrs<-p$newinfo[[3]]
    newnbrs<-NULL
    for (i in 1:length(nbrs)){
    newnbrs<-c(newnbrs,rep(nbrs[i],times=length(g[[nbrs[i]]])))
    }
    coefflist[[31]]<-p$results[[6]][31]

    u<-PointsUpdatemp(X,coefflist,p$newinfo[[2]],newnbrs,p$newinfo[[3]],31,order(X),p$results[[4]],
    lengths)

    p2<-setdiff(order(X),31)
    a<-which(order(X)==31)
    l2<-lengths[setdiff(1:length(X), a)]
    #
    #remove the lifted coefficient
    #
    #now undo the update step...
    #
    undo<-UndoPointsUpdatemp(X,coeff,newnbrs,p$newinfo[[2]],p$newinfo[[3]],31,
    a,length(X)-1,p2,p$results[[4]],l2,lengths[a])
    #

[Package adlift version 1.4-1 Index]