lengthintervals {adlift} | R Documentation |
lengthintervals
Description
This function constructs the vector of interval lengths from a vector of interval endpoints.
Usage
lengthintervals(X, I, type = "midpoints", neighbours, closest)
Arguments
X |
The vector of gridpoints. |
I |
a vector of interval endpoints. This is of length |
type |
a character string, either |
neighbours |
the number of neighbours to be used in the prediction step of the transform. This is only used if closest=TRUE, since it specifies how many distances to average over when type="average". |
closest |
indicates whether the neighbourhood structure to be used in the transform is symmetrical or not. When combined with type="average", enables the option of average closest neighbour distance as the associated interval lengths to the gridpoints. |
Details
The function computes the interval lengths by finding the differences between the consecutive entries of the supplied interval vector I. In the case of the choice of average closest neighbour distance interval association, the method uses the function getnbrs
to find the initial neighbours of each gridpoint to compute the average distances.
Value
lengths |
a vector of |
initialnbrs |
a matrix with columns |
initialindex |
If closest=TRUE and type="average", a matrix of dimension |
Author(s)
Matt Nunes (nunesrpackages@gmail.com), Marina Knight
See Also
Examples
input<-runif(10)
#gridpoint vector
#
I<-intervals(input,"reflect")
#create the interval endpoint vector using the input
#
lengthintervals(input,I,"average",3,TRUE)
#
#computes 'intervals' based on 3 closest neighbour distance averages
#