R: Auxiliary functions (for internal use)

auxiliary {aws} | R Documentation

## Auxiliary functions (for internal use)

### Description

Function `gethani` determines a bandwidth that leads to, for the specified kernel, a variance reduction for a non-adaptive kernel estimate by a factor of `value`. `getvofh` calculates the sum of location weights for a given bandwidth vector and kernel. `sofmchi` precomputes the variance of a non-central chi distribution with `2*L` degrees of freedom as a function of the noncentrality parameter for an interval `c(0,to)`. Functions `residualVariance` and `residualSpatialCorr` are used in package `fmri` to calculate variances and spatial correlations from residual objects.

### Usage

    gethani(x, y, lkern, value, wght, eps = 0.01)
    getvofh(bw, lkern, wght)
    sofmchi(L, to = 50, delta = 0.01)
    residualVariance(residuals, mask, resscale = 1, compact = FALSE)
    residualSpatialCorr(residuals, mask, lags = c(5, 5, 3), compact = FALSE)

### Arguments

`x` | lower bound of search interval
`y` | upper bound of search interval
`lkern` | code for location kernel
`value` | target sum of location weights
`wght` | relative size of voxel dimensions `c(0,0)` for 1D and `c(w1,0)` for 2D problems.
`eps` | attempted precision for bandwidth search
`bw` | vector of bandwidths, length equal to 1,2 or 3 depending on the dimensionality of the problem.
`L` | number of effective coils, `2*L` is the degree of freedom of the non-central chi distribution.
`to` | upper interval bound.
`delta` | discretization width.
`residuals` | array of residuals, if`compact` only containing voxel with mask, otherwise for complete data cubes.
`mask` | mask of active voxel (e.g. brain masks)
`resscale` | scale for residuals (residuals may be scaled for optimal integer*2 storage)
`compact` | logical, determines if only information for voxel within mask or full for full data cubes is given.
`lags` | positive integer vector of length 3, maximum lags for spatial correlations for each coordinate direction to be computed

### Details

These are auxiliary functions not to be used by the user. They are only exported to be available for internal use in packages `fmri`, `dti`, `qMRI` and `adimpro`.

### Value

`gethani` returns a vector of bandwidths, `getvofh` returns the variance reduction that would be obtained with a kernel estimate employing the specified kernel and bandwidth, `sofmchi` returns a list with, e.g., components `ncp` and `s2` containing vectors of noncentralityparameter values and corresponding variances, respectively, for the specified noncentral Chi distribution, `residualVariance` returns a vector (compact==TRUE) or array(compact==FALSE) of voxelwise residual variances, `residualSpatialCorr` returns an array of dimension `lags` containing spatial correlations.

### Note

These functions are for internal use only. They are only exported to be available in other packages.

### Author(s)

Joerg Polzehl polzehl@wias-berlin.de

[Package aws version 2.5-1 Index]