R: Finds minimum number of inversion steps

findadds {adlift} | R Documentation

## Finds minimum number of inversion steps

### Description

This function finds the minimum inversion steps to perform to fully reconstruct (a subset of) data

### Usage

    findadds(rem, neighbrs, po, index = 1:(length(rem) + length(po)))

### Arguments

`rem` | the `removelist` variable from a lifting decomposition. See `fwtnp`.
`neighbrs` | A list of neighbour indices corresponding to lifting steps in a decomposition. See `fwtnp`.
`po` | The `pointsin` variable in a lifting decomposition (the index into the unlifted datapoints). See `fwtnp`.
`index` | a vector of indices into the original data, indicating which points should be fully reconstructed during inversion.

### Details

This function gives a computational shortcut to get datapoint information in certain inversion cases. In some circumstances,when inverting, you might only be interested in the inverted coefficients for a subset of timepoints. In this case, it is not necessary to do a full inversion to look at the desired coefficients; the function uses the neighbourhood and removal order of the forward transform information and notes: 1) when the desired points were lifted (if at all) and 2) when the desired points were used as neighbours in prediction (if applicable). The number of inversion steps needed for each index individually is then taken as the maximum for these two conditions to be met. Inverting the transform with this number will yield the correct inverted coefficient. Note that to get the correct coefficients for all `index`, the number of inversion steps is `max(adds)`.

### Value

`adds`: a vector corresponding to `index`, each element of which is the number of inversion steps needed for that datapoint to be fully reconstructed.

### Author(s)

Matt Nunes (nunesrpackages@gmail.com)

### See Also

`invtnp`

### Examples

    #create data:
    x<-runif(256)

    f<-make.signal2("bumps",x=x)

    #do forward transform:
    fwd<-fwtnp(x,f)

    #I want to invert enough so that points 1:3 are reconstructed.

    adds<-findadds(fwd$removelist,fwd$neighbrs,fwd$pointsin,1:3)
    adds

    #now reconstruct...
    fhat<-invtnp(fwd,f,nadd=max(adds))

    #...and check that the desired points are the same:
    f[1:3]
    fhat[1:3]

[Package adlift version 1.4-1 Index]