orthog.complete | R Documentation |
Construct an orthogonal matrix which is an arbitrary completion of the column space of the input set of columns.
orthog.complete(x, normalize=TRUE, abs2.rows=1:nrow(x),
Int=TRUE, drop.Int=Int)
orthog.construct(y, x, x.rows, normalize=FALSE)
x |
For |
y |
matrix of coefficients specifying the linear combinations
estimated. This will usually be the |
normalize , abs2.rows , x.rows |
The default normalizes the
sum of squares of the rows
in |
Int |
logical. Default |
drop.Int |
logical. The default is to drop the constant column and to keep all columns when the constant is not automatically generated. |
This function is based on qr.Q
. The input matrix x
has
n
rows and an arbitrary non-zero number of columns. The result
is an n
by n
orthogonal matrix. By default the first
column of the result is constant and is not returned. The second
column of the result is orthogonal to the first result column.
Together the first two result columns span the space of the constant
column and the first input column. The third result column is
orthogonal to the first two result columns and the the three result
columns together span the space of the constant column and the first
two inout columns. Similarly for the remaining result columns.
Result columns beyond the number of input columns are constructed as
an arbitrary orthogonal completion.
If the input columns are orthogonal to each other and to the constant column, then the result columns are rescaled versions of the input columns.
Optionally (drop.Int=FALSE
), the constant column can be returned.
By default the columns are scaled to have sum of squares equal 1. If
normalize="abs2"
, they are scaled to make the sum of all
positive value equal 1 and the sum of all negative values equal -1
.
Together, the sum of the absolute values of each column is 2.
If the input is a set of columns from a contrast matrix for a design
that has multiple terms, the abs2.rows
argument is used to
specify which rows are to be included in the normalization. These
will normally be rows associated with one of the main effects.
Matrix of orthogonal columns.
Richard M. Heiberger <rmh@temple.edu>
Heiberger, Richard M. and Holland, Burt (2015). Statistical Analysis and Data Display: An Intermediate Course with Examples in R. Second Edition. Springer-Verlag, New York. https://link.springer.com/book/10.1007/978-1-4939-2122-5
MMC
zapsmall(
orthog.complete(cbind("4-12"=c(-1,-1, 0, 2),
"1-2" =c( 1,-1, 0, 0)))
)
zapsmall(
orthog.complete(cbind("4-12"=c(-1,-1, 0, 2),
"1-2" =c( 1,-1, 0, 0)),
drop.Int=FALSE)
)
zapsmall(
orthog.complete(cbind("4-12"=c(-1,-1, 0, 2),
"1-2" =c( 1,-1, 0, 0)),
normalize="abs2")
)
## used in MMC plots
tmp <- data.frame(y=rnorm(12),
a=factor(c("u","u","u","u",
"v","v","v","v",
"w","w","w","w")))
tmp.aov <- aov(y ~ a, data=tmp)
lmat <- if.R(
s=multicomp(tmp.aov, focus="a")$lmat,
r={lmat.reduced <- t(glht(tmp.aov, linfct=mcp(a="Tukey"))$linfct)
rbind(lmat.reduced, AU=-apply(lmat.reduced[-1,], 2, sum))
})
zapsmall(lmat)
lmat.complete <- orthog.complete(lmat, abs2.rows=-1,
normalize="abs2",
drop.Int=FALSE)[,1:3]
zapsmall(lmat.complete)
if.R(r=zapsmall(lmat.complete[-4,]),
s={})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.