line.cis {smatr} | R Documentation |
Calculates the slope and elevation of a major axis or standardised major axis, and constructs confidence intervals for the true slope and elevation
line.cis(y, x, alpha = 0.05, data = NULL, method = "SMA", intercept = TRUE, V = matrix(0, 2, 2), f.crit = 0)
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 |
(optional) data frame containing the data |
method |
The line fitting method:
|
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.
|
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.) |
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.
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:
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.
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. |
Warton, D. David.Warton@unsw.edu.au, translated to R by Ormerod, J. 2005-12-08
Warton D. I., Wright I. J., Falster D. S. and Westoby M. (2006) A review of bivariate line-fitting methods for allometry. Biological Reviews (in press)
#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 line.cis(log10(longev),log10(lma),data=leaf.low.rain) #produce CI's for MA slope and elevation: line.cis(log10(longev),log10(lma),data=leaf.low.rain, method='MA')