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 X

p

Number of columns in X

Details

First create \hat{X} = (I_p\,\,\,I_p\,\,\,\cdots\,\,\,I_p)^T, where I_p, the identity matrix of size p, is repeated ceiling(n/p) times. If p does not divide n, remove rows at the bottom so that \hat{X} has n rows. Divide by the root mean square of the columns of \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]