coef.lm.rrpp | R Documentation |
Computes ordinary or generalized least squares coefficients
over the permutations of an lm.rrpp
model fit with predefined
random permutations.
For each coefficient vector, the Euclidean distance is calculated as an
estimate of
the amount of change in Y, the n x p matrix of dependent variables; larger
distances mean more change
in location in the data space associated with a one unit change in the model
design, for the parameter
described. Random coefficients are based on either RRPP or FRPP, as defined
by the
lm.rrpp
model fit.
The following details will also be removed:
This function can be used to test the specific coefficients of an lm.rrpp fit. The test statistics are the distances (d), which are also standardized (Z-scores). The Z-scores might be easier to compare, as the expected values for random distances can vary among coefficient vectors.
If RRPP is used, all distributions of coefficient vector distances are based on appropriate null models, as defined by SS type. Please be aware that this can result in two seemingly strange but reasonable phenomena. First, if type II or type III SS is used, the intercept will not appear in test results (because the function seeks model parameter differences to know for which coefficients to calculate Euclidean distances). Even if it appears for type I SS, this is merely an artifact of sequential model building and there really is no meaningful test of intercept = 0. Second, Euclidean distances might not always be logical, especially when viewing univariate coefficients, in which case the expected d is |b|. Coefficients without a test are based on the full model; tests are based on the estimates of coefficients (b), given a null model. For example, for a model, y ~ b1 + b2 + b3, with type I SS, b2 will be estimated and tested, using a null model, y ~ b1 and a full model, y ~ b1 + b2. The estimate for b2 might not be the same in the test as when estimated from the model, y ~ b1 + b2 + b3. Therefore, the d statistic might not reflect what one would expect from the full model (like when using type III SS).
The test for coef.lm.rrpp uses the square-root of inner-products of vectors (d) as a
test statistic and only tests the null hypothesis that the length of the vector is 0.
The significance of the test is based on random values produced by RRPP, based on the
matrices of coefficients that are produced in all permutations. The null models for generating
RRPP distributions are consistent with those used for ANOVA, as specified in the
lm.rrpp
fit by choice of SS type. Therefore, the random coefficients are
consistent with those produced by RRPP for generating random estimates used in ANOVA.
The betaTest analysis allows different null hypotheses to be used (vector length is not necessarily 0) and unless otherwise specified, uses a null model that lacks one vector of parameters and a full model that contains all vectors of parameters, for the parameter for which coefficients are estimated. This is closest to a type III SS method of estimation, but each parameter is dropped from the model, rather than terms potentially comprising several parameters. Additionally, betaTest calculates Mahalanobis distance, in addition to Euclidean distance, for vectors of coefficients. This statistic is probably better for more types of models (like generalized least squares fits).
## S3 method for class 'lm.rrpp'
coef(object, SE = FALSE, test = FALSE, confidence = 0.95, ...)
object |
Object from |
SE |
Whether to include standard errors of coefficients. Standard errors are muted if test = TRUE. |
test |
Logical argument that if TRUE, performs hypothesis tests (Null hypothesis is vector distance = 0) for the observed coefficients. If FALSE, only the observed coefficients are returned. |
confidence |
The desired confidence limit to print with a table of summary statistics, if test = TRUE. Because distances are directionless, confidence limits are one-tailed. |
... |
Other arguments (currently none) |
Michael Collyer
betaTest
## Not run:
# See examples for lm.rrpp to see how anova.lm.rrpp works in conjunction
# with other functions
data(Pupfish)
names(Pupfish)
Pupfish$logSize <- log(Pupfish$CS)
fit <- lm.rrpp(coords ~ logSize + Sex*Pop,
SS.type = "I", data = Pupfish, verbose = TRUE)
coef(fit) # Just coefficients
coef(fit, SE = TRUE) # Coefficients with SE
coef(fit, test = TRUE,
confidence = 0.99) # Test of coefficients
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.