line.cis: Slope and elevation of a (standardised) major axis, with...

View source: R/line.cis.R

line.cisR Documentation

Slope and elevation of a (standardised) major axis, with confidence intervals

Description

Calculates the slope and elevation of a major axis or standardised major axis, and constructs confidence intervals for the true slope and elevation. This can now be fitted via calls of the form sma(y~x, ...), see sma.

Usage

line.cis(
  y,
  x,
  alpha = 0.05,
  data = NULL,
  method = "SMA",
  intercept = TRUE,
  V = matrix(0, 2, 2),
  f.crit = 0,
  robust = FALSE,
  ...
)

Arguments

y

The Y-variable

x

The X-variable

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.)

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

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)

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.

f.crit

(optional - rarely required). The critical value to be used from the F distribution. (Only actually useful for reducing computation time in simulation work - otherwise, do not change.)

robust

If TRUE, uses a robust method to fit the lines and construct confidence intervals.

...

Further parameters (not passed anywhere at the moment).

Details

Fits a linear regression line, major axis, or standardised major axis, to a bivariate dataset. The slope and elevation are returned with confidence intervals, using any user-specified confidence level.

Confidence intervals are constructed by inverting the standard one-sample tests for elvation and slope (see slope.test and elev.test for more details). Only the primary confidence interval is returned - this is valid as long as it is known a priori that the (standardised) major axis is estimating the true slope rather than the (standardised) minor axis. For SMA, this means that the sign of the true slope needs to be known a priori, and the sample slope must have the same sign as the true slope.

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

These assumptions can be visually checked by plotting residuals against fitted axis scores, and by constructing a Q-Q plot of residuals against a normal distribution. An appropriate residual variable is y-bx, and for fitted axis scores use x (for linear regression), y+bx (for SMA) or by+x (for MA), where b represents the estimated slope.

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).

Setting robust=TRUE fits lines using Huber's M estimation, and modifies confidence interval formulae along the lines discussed in Taskinen & Warton (in review).

Value

coeff

A matrix containing the estimated elevation and slope (first column), and the lower and upper limits of confidence intervals for the true elevation and slope (second and third columns). Output for the elevation and slope are in the first and second rows, respectively.

Author(s)

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

References

Warton, D.I., I.J. Wright, D.S. Falster and M. Westoby. 2006. 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, slope.test, elev.test

Examples


#load the leaflife data
data(leaflife)

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

#estimate the SMA line for reserve vs coat
with(leaf.low.rain, line.cis(log10(longev),log10(lma)))

#produce CI's for MA slope and elevation:
with(leaf.low.rain, line.cis(log10(longev),log10(lma),method='MA'))


dfalster/smatr3 documentation built on Aug. 30, 2022, 5:25 a.m.