ATRANSDENSITY: ATRANSDENSITY

Description Usage Arguments Value Examples

Description

A function evaluates density of linearly transformed random vector on a given grid. It is used in processing EMFASTICAALG object to obtain density estimation of the mixture components.

Usage

1

Arguments

grid

A matrix whose columns store the grid points.

A

Matrix for the linear transformation.

f

Density function before the linear transformation.

Value

answer

Matrix of the same size as grid, with each element being the evaluated linear transformed density at the corresponding grid point.

comp2

Description of 'comp2'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## An example that evaluates the 2-D uniform distribution on a linear transformation of [1,3]x[1,3]
## f1ind is the density of the uniform distribution on [1,3]^r
f1ind <- function(grid){# mixture component 1 original signal density function
  n <- ncol(grid)
  r <- nrow(grid)
  answer <- rep(1,n)
  for(i in 1:n){
    for(j in 1:r){
      answer[i] <- answer[i] * (grid[j,i] >= 1 & grid[j,i] <= 3) / 2
    }
  }
  answer
}

A <- matrix(c(6, 9, -12, 15), 2, 2, byrow = FALSE)

gridpoints <- t(as.matrix(expand.grid(seq(-32,12,2),seq(18,80,2))))

f1trans <- ATRANSDENSITY(gridpoints, A, f1ind)

plot(t(gridpoints),col=(f1trans>0))

xiaotianzhu/icamix documentation built on May 20, 2019, 6:02 p.m.