Skip to contents

This function has been superseded by the much more versatile transform.scdf function. Shifting the values might be helpful in cases where the measurement time is given as a time variable (see example below).

Usage

shift(data, value, var)

Arguments

data

A single-case data frame. See scdf() to learn about this format.

value

Number by which to shift the values

var

Character string with the name of the target variable. Defaults to the measurement time variable.

Value

A scdf with shifted data

See also

Examples

### Shift the measurement time for a better estimation of the intercept
ex <- shift(example_A24, value = -1996)
#> Warning: This function is deprecated. It might be dropped without any further notice in a future update of scan.
#> Please use function 'transform' instead of 'shift'.
plm(ex)
#> Piecewise Regression Analysis
#> 
#> Contrast model: W / level = first, slope = first
#> 
#> Fitted a gaussian distribution.
#> F(3, 19) = 46.74; p = 0.000; R² = 0.881; Adjusted R² = 0.862
#> 
#>                      B     2.5%    97.5%     SE      t     p delta R²
#> Intercept      258.714  223.364  294.065 18.036 14.344 0.000         
#> Trend year       1.857   -7.947   11.662  5.002  0.371 0.715    0.001
#> Level phase B -150.383 -200.743 -100.024 25.694 -5.853 0.000    0.215
#> Slope phase B   -1.726  -11.926    8.474  5.204 -0.332 0.744    0.001
#> 
#> Autocorrelations of the residuals
#>  lag    cr
#>    1  0.10
#>    2 -0.13
#>    3 -0.10
#> Ljung-Box test: X²(3) = 0.99; p = 0.804 
#> 
#> Formula: injuries ~ 1 + year + phaseB + interB
#> 

# Please use transform instead:
example_A24 |>
  transform(year = year - 1996) |>
  plm()
#> Piecewise Regression Analysis
#> 
#> Contrast model: W / level = first, slope = first
#> 
#> Fitted a gaussian distribution.
#> F(3, 19) = 46.74; p = 0.000; R² = 0.881; Adjusted R² = 0.862
#> 
#>                      B     2.5%    97.5%     SE      t     p delta R²
#> Intercept      258.714  223.364  294.065 18.036 14.344 0.000         
#> Trend year       1.857   -7.947   11.662  5.002  0.371 0.715    0.001
#> Level phase B -150.383 -200.743 -100.024 25.694 -5.853 0.000    0.215
#> Slope phase B   -1.726  -11.926    8.474  5.204 -0.332 0.744    0.001
#> 
#> Autocorrelations of the residuals
#>  lag    cr
#>    1  0.10
#>    2 -0.13
#>    3 -0.10
#> Ljung-Box test: X²(3) = 0.99; p = 0.804 
#> 
#> Formula: injuries ~ 1 + year + phaseB + interB
#>