createOrthogonalX {ptycho}R Documentation

Create Design Matrix With Orthogonal Columns

Description

Create a design matrix whose columns are orthogonal to each other.

Usage

createOrthogonalX(n, p)

Arguments

n

Number of rows in XX

p

Number of columns in XX

Details

First create X^=(Ip   Ip      Ip)T,\hat{X} = (I_p\,\,\,I_p\,\,\,\cdots\,\,\,I_p)^T, where IpI_p, the identity matrix of size pp, is repeated ceiling(n/p) times. If p does not divide n, remove rows at the bottom so that X^\hat{X} has n rows. Divide by the root mean square of the columns of X^\hat{X}.

Value

Matrix with n rows, p columns, and column names X1, X2, and so forth.

Author(s)

Laurel Stell and Chiara Sabatti
Maintainer: Laurel Stell <lstell@stanford.edu>

See Also

createData

Examples

n <- 50; p <- 5
X <- createOrthogonalX(n, p)
XtX <- t(X) %*% X
D <- diag(n-1, nrow=p)
# XtX and D are not quite equal due to roundoff error
range(XtX - D)

[Package ptycho version 1.1-4 Index]