projectDataInto1d: Project multidimensional data onto a line.

projectDataInto1dR Documentation

Project multidimensional data onto a line.

Description

Project multidimensional dataset onto a line described by two points (centers).

Usage

projectDataInto1d(x, 
    c0, c1)

Arguments

x

multidimensional data (n x k matrix)

c0

first center (vector in k-dimensional space)

c1

second center (vector in k-dimensional space)

Value

A vector of length n holding the projection of data onto the line aligned along centers c0 and c1. Points in the hyperplane perpendicular to the line and intersecting center c0 get mapped to 0, points in the hyperplane perpendicular to the line and intersecting center c1 get mapped to 1, etc.

Author(s)

Tomas Sieger

Examples

set.seed(1)
x1<-cbind(rnorm(100,-2),rnorm(100))
x2<-cbind(rnorm(100,2),rnorm(100))
p<-projectDataInto1d(rbind(x1,x2),c0=c(-2,0),c1=c(2,0))

layout(rbind(1,2))
plot(rbind(x1,x2),frame=FALSE,main='2D data')
hist(p,breaks=50,main='1D projection')
layout(1)

tsieger/tsiMisc documentation built on Oct. 10, 2023, 10:24 p.m.