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

Description Usage Arguments Details Value Author(s) References See Also Examples

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

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

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)

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#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'))

Example output

Loading required package: plyr
          coef(SMA) lower limit upper limit
elevation -2.822586   -3.387011   -2.258162
slope      1.323612    1.095732    1.598883
           coef(MA) lower limit upper limit
elevation -2.962207   -3.652955   -2.271458
slope      1.386042    1.114518    1.751817

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