mvhist: Multivariate histograms

Description Usage Arguments Details Value Warning Examples

Description

Tabulate and plot histograms for multivariate data, including directional histograms

Usage

1
2
3
4
5
6
7
8
9
histDirectional( x, k, p=2, plot.type="default", freq=TRUE, positive.only=FALSE, 
     report="summary", label.orthants=TRUE, normalize.by.area=FALSE, ... )
histDirectionalQuantileThreshold( x, probs=1, p=2, k=3, positive.only=FALSE, ... )
histDirectionalAbsoluteThreshold( x, thresholds=0, p=2, k=3, positive.only=FALSE,...)     
histRectangular( x, breaks=10, plot.type="default", freq=TRUE, report="summary", ... )
histSimplex( x, S, plot.type="default", freq=TRUE, report="summary", ... )

TallyHrep( x, H, report="summary" )  
DrawPillars( S, height, shift=rep(0.0,3), ... )

Arguments

x

data in an (n x d) matrix; rows are d-dimensional data vectors

k

number of subdivisions

p

power of p-norm

freq

TRUE for a frequency histogram, FALSE for a relative frequency histogram. See note about normalize.by.area

normalize.by.area

if TRUE, then the counts are normalized by the surface area of the corresponding simplex on the sphere. This is useful since in general the surface area varies and counts will vary accordingly. In particular, isotropic data will not appear isotropic without setting this to TRUE. If TRUE, the value of freq is ignored: the histogram always shows count/surface area

breaks

specifes the subdivision of the region; see 'breaks' in SolidRectangle

plot.type

type of plot, see details below

positive.only

If TRUE, look only in the first orthant

report

level of warning messages; one of "summary", "all", "none".

label.orthants

If plot.type="index", this controls whether or not the orthants are labeled on the plot.

probs

vector of probabilites specifying what fraction of the extremes to keep

thresholds

vector of thresholds specifying cutoff for extremes to keep

...

Optional arguments to plot

S

(vps x d x nS) array of simplices in V representation, see V2Hrep

H

array of simplices in H representation, see V2Hrep

height

vector of length nS giving the heights of the pillars

shift

shift of the pillars, typically (0,0,0) for 2d data or (0,0,z0) for 3d data

Details

Calculate and plot multivariate histograms. histDirectional plots a directional histogram for all the data, histDirectionalQuantileThreshold plots m=length(probs) directional histograms, with plot i using the top probs[i] fraction of the data, histDirectionalAbsoluteThreshold plots m=length(cut.off) directional histograms, with plot i using the top probs[i] fraction of the data, histSimplex plots histogram based on simplices specified in S, histRectangular plots histogram based on a rectangular grid,

In all cases, the bins are simplices described in the H-representation and tallied by TallyHrep. TallyCones does a similar function for cones from the origin and generated by a list of base simplices.

'plot.type' values depend on the type of plot being used. Possible values are:

Value

A plot is drawn (unless plot.type="none"). A list is returned invisibly, with fields:

Warning

This is experimental code, and not throughly tested. If you have problems, please let me know.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# two dimensional, isotropic
x <- matrix( rnorm(8000), ncol=2 )
histDirectional( x, k=1 )

## Not run: 

histRectangular( x, breaks=5 )

# some directional 2-dim data
n <- 1000
A <- matrix( c(1,2, 4,1), nrow=2,ncol=2)
x2 <- matrix( 0.0, nrow=n, ncol=2 )
for (i in 1:n) { x2[i,] <- A 
dev.new(); par(mfrow=c(2,2))
plot(x2,main="Raw data",col='red')
histDirectionalQuantileThreshold( x2, probs=c(1,0.25,0.1), p=1, 
    positive.only=TRUE, col='green',lwd=3)
dev.new(); par(mfrow=c(2,2))
histDirectionalAbsoluteThreshold( x2, thresholds=c(0,50,100,200), p=1, 
    positive.only=TRUE, col='blue',lwd=3)


# three dimensional positive data
x3 <- matrix( abs(rnorm(9000)), ncol=3 )
histDirectional( x3, k=3, positive.only=TRUE, col='blue', lwd=3 )
histRectangular( x3, breaks=4 )

demo(mvhist) # shows a range of multivariate histograms
}


## End(Not run)

mvmesh documentation built on Feb. 12, 2020, 1:09 a.m.