# elev.com: Test for equal elevation among several lines fitted with... In smatr: (Standardised) Major Axis Estimation and Testing Routines

## 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

 ```1 2 3``` ```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.

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

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```# 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)) ```

### Example output

```\$LR
[1] 2.366711

\$p
[1] 0.123948

\$b
[1] 1.5514

\$ci
[1] 1.109374 2.011726

\$varb
[1] 0.04001762

\$lambda
[1] 2.406841

\$bs
high      low
slope        1.1768878 1.786551
lower.CI.lim 0.7631512 1.257257
upper.CI.lim 1.8149286 2.538672

\$df
[1] 1

\$stat
[,1]
[1,] 6.566201

\$p
[,1]
[1,] 0.01039336

\$a
[,1]
[1,] -2.969185

\$ci
[1] -3.822525 -2.115845

\$as
elevation lower CI limit upper CI limit
high -3.140896      -4.079825      -2.201966
low  -3.304865      -4.353328      -2.256403

\$df
[1] 1

\$stat
[,1]
[1,] 6.489554

\$p
[,1]
[1,] 0.01085102

\$a
[,1]
[1,] -3.32005

\$ci
[1] -4.888304 -1.751796

\$as
elevation lower CI limit upper CI limit
high -3.694360      -5.539928      -1.848792
low  -3.878244      -6.049395      -1.707092

\$df
[1] 1
```

smatr documentation built on May 2, 2019, 1:04 p.m.