R: Test for equal elevation among several lines fitted with...

elev.com {smatr} | R Documentation

## Test for equal elevation among several lines fitted with (standardised) major axes of common slope.

### Description

Test if several major axis or standardised major axis lines share a common elevation. This can now be done via `sma(y~x+groups)`, see help on the `sma` function.

### Usage

    elev.com(y, x, groups, data = NULL, method = 'SMA', alpha = 0.05, robust=FALSE,
      V = array(0, c(2, 2, length(unique(groups)))),
      group.names = sort(unique(groups)))

### Arguments

`y` | The Y-variable for all observations (as a vector).
`x` | The X-variable for all observations (as a vector).
`groups` | Coding variable identifying which group each observation belongs to (as a factor or vector).
`data` | Deprecated. Use with() instead (see Examples).
`method` | The line fitting method: 'SMA' or 1 standardised major axis (this is the default) 'MA' or 2 major axis
`alpha` | The desired confidence level for the 100(1-alpha)% confidence interval for the common elevation. (Default value is 0.05, which returns a 95% confidence interval.)
`robust` | If TRUE, uses a robust method to fit the lines and construct the test statistic.
`V` | The estimated variance matrices of measurement error, for each group. This is a 3-dimensional array with measurement error in Y in the first row and column, error in X in the second row and column,and groups running along the third dimension. Default is that there is no measurement error.
`group.names` | (optional: rarely required). A vector containing the labels for ‘groups’. (Only actually useful for reducing computation time in simulation work).

### Details

Calculates a Wald statistic to test for equal elevation of several MA's or SMA's with a common slope. This is done by testing for equal mean residual scores across groups.

Note that this test is only valid if it is reasonable to assume that the axes for the different groups all have the same slope.

The test assumes the following:

- each group of observations was independently sampled

- the axes fitted to all groups have a common slope

- y and x are linearly related within each group

- residual scores independently follow a normal distribution with equal variance at all points along the line, within each group

Note that we do not need to assume equal variance across groups, unlike in tests comparing several linear regression lines.

The assumptions can be visually checked by plotting residual scores against fitted axis scores, and by constructing a Q-Q plot of residuals against a normal distribution, available using the `plot.sma` function. On a residual plot, if there is a distinct increasing or decreasing trend within any of the groups, this suggests that all groups do not share a common slope.

Setting `robust=TRUE` fits lines using Huber's M estimation, and modifies the test statistic as proposed in Taskinen & Warton (in review).

The common slope (b) is estimated from a maximum of 100 iterations, convergence is reached when the change in b < 10^-6.

### Value

`stat` | The Wald statistic testing for no shift along the common axis
`p` | The P-value of the test. This is calculated assuming that stat has a chi-square distribution with (g-1) df, if there are g groups
`a` | The estimated common elevation
`ci` | A 100(1-alpha)% confidence interval for the true common elevation
`as` | Separate elevation estimates for each group

### Author(s)

Warton, D.I.David.Warton@unsw.edu.au, J. Ormerod, & S. Taskinen

### References

Warton D. I., Wright I. J., Falster D. S. and Westoby M. (2006) A review of bivariate line-fitting methods for allometry. Biological Reviews 81, 259–291.

Taskinen, S. and D.I. Warton. in review. Robust tests for one or more allometric lines.

### See Also

`sma`, `plot.sma`, `line.cis`, `slope.com`, `shift.com`

### Examples

    # Load leaf longevity data
    data(leaflife)

    # Test for common SMA slope amongst species at low soil nutrient sites
    # with different rainfall:
    leaf.low.soilp <- subset(leaflife, soilp == 'low')
    with(leaf.low.soilp, slope.com(log10(longev), log10(lma), rain))

    # Now test for common elevation of the groups fitted with an axis
    # of common slope, at low soil nutrient sites:
    with(leaf.low.soilp, elev.com(log10(longev), log10(lma), rain))

    # Or test for common elevation amongst the MA's of common slope,
    # for low soil nutrient sites, and construct 99% a confidence interval
    # for the common elevation:
    with(leaf.low.soilp, elev.com(log10(longev), log10(lma), rain, method='MA',
       alpha=0.01))

[Package smatr version 3.4-3 Index]