R: adjustx

adjustx {adlift} | R Documentation

## adjustx

### Description

This function produces new grid values to cope with data with repeated grid values according to the method chosen to deal with it.

### Usage

    adjustx(x, f, type = "mean")

### Arguments

`x` | a vector of the original (repeated) gridpoints.
`f` | the vector of function values associated to the grid vector X.
`type` | The method used to cope with the multiple points. "mean" averages all function values with the same grid value. The "jitter" option adds a small amount to all but one of each repeated grid value, and associates the function values to these new gridpoints. In this way, the each gridpoint value corresponds uniquely to the function values.

### Details

The function compares x to `unique(x)` to find the occurences of repeated grid values, and stores the information in groups. In the "jitter" case, this is then used to modify the original gridpoints by adding an epsilon to the repeated values. In the case of type="mean", the new gridpoints are, in fact `unique(x)`, and the information is used to average the groups of original function values to construct sepf.

### Value

`sepx` | the vector of new gridpoints.
`sepf` | the function values associated to sepx.
`groups` | a list of indices into x showing where the original repeated grid values occured.

### Author(s)

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

### See Also

`fwtnp`,

### Examples

    #read in the motorcycle crash data
    #
    data(motorcycledata)

    #
    dim(motorcycledata)

    #check data.
    #
    times<-motorcycledata$time
    accel<-motorcycledata$accel

    a<-adjustx(times,accel,"mean")
    #
    #note the repeated values in the original grid data
    #
    #display new data vectors
    a$sepx
    #
    a$sepf
    #
    #and now the new adjusted data has length 94.
    #

[Package adlift version 1.4-1 Index]