Test if the slope of a major axis or standardised major axis equals a specific value. This can now be done via sma(y~x, slope.test=1), see help on sma.

slope.test(
  y,
  x,
  test.value = 1,
  data = NULL,
  method = "SMA",
  alpha = 0.05,
  V = matrix(0, 2, 2),
  intercept = TRUE,
  robust = FALSE
)

Arguments

y

The Y-variable

x

The X-variable

test.value

The hypothesised value of the slope (default value is 1)

data

Deprecated. Use with() instead (see Examples).

method

The line fitting method:

'OLS' or 0

linear regression

'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 slope. (Default value is 0.05, which returns a 95% confidence interval.)

V

The estimated variance matrix of measurement error. Average measurement error for Y is in the first row and column, and average measurement error for X is in the second row and column. The default is that there is no measurement error.

intercept

(logical) Whether or not the line includes an intercept.

FALSE

no intercept, so the line is forced through the origin

TRUE

an intercept is fitted (this is the default)

robust

If TRUE, uses a robust method to fit the lines and construct the test statistic.

Value

r

The test statistic - the sample correlation between residuals and fitted values

p

The P-value, taken from the F-distribution. This is an exact test if residuals are normally distributed.

test.value

The hypothesised value of the slope

b

The estimated slope

ci

A 100(1-alpha)% CI for the slope.

Details

Tests if the line relating y to x has a slope equal to test.value (which has a default value of 1). The line can be a linear regression line, major axis or standardised major axis (as selected using the input argument choice). The test is carried out by testing for correlation between residual and fitted values, as described in Warton et al (in review).

A confidence interval for the slope is also returned, which is the primary confidence interval found by inverting the one-sample test statistic.

If measurement error is present, it can be corrected for through use of the input argument V, which makes adjustments to the estimated sample variances and covariances then proceeds with the same method of inference. Note, however, that this method is only approximate (see Warton et al in review for more details).

The test assumes the following:

  1. y and x are linearly related

  2. residuals independently follow a normal distribution with equal variance at all points along the line

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.

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

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

Author

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

Examples


#load the leaflife dataset:
data(leaflife)

#consider only the low rainfall sites:
leaf.low.rain <- leaflife[leaflife$rain=='low',]

#test if the SMA slope amongst species at low rainfall sites is 1,
#for log (base 10) transformed data:
with(leaf.low.rain, slope.test(log10(longev), log10(lma)))
#> $F
#> [1] 9.29037
#> 
#> $r
#> [1] 0.4801931
#> 
#> $p
#> [1] 0.004680958
#> 
#> $test.value
#> [1] 1
#> 
#> $b
#> [1] 1.323612
#> 
#> $ci
#>          [,1]     [,2]
#> [1,] 1.095732 1.598883
#> 
    
#test if the MA slope is 2/3
with(leaf.low.rain, slope.test(log10(longev), log10(lma), test.value = 2/3, method = 'MA'))
#> $F
#> [1] 40.21607
#> 
#> $r
#> [1] 0.7514686
#> 
#> $p
#> [1] 4.659633e-07
#> 
#> $test.value
#> [1] 0.6666667
#> 
#> $b
#> [1] 1.386042
#> 
#> $ci
#>          [,1]     [,2]
#> [1,] 1.114518 1.751817
#>