Last data update: 2014.03.03

R: Estimate PLC/FLC distributions for all states
estimate_LC_pdfsR Documentation

Estimate PLC/FLC distributions for all states

Description

estimate_LC_pdfs estimates the PLC and FLC distributions for each state k = 1, …, K. It iteratively applies estimate_LC.pdf.state.

estimate_LC.pdf.state estimates the PLC and FLC distributions using weighted maximum likelihood (cov.wt) and nonparametric kernel density estimation (wKDE) for one (!) state.

Usage

estimate_LC_pdfs(LCs, weight.matrix = NULL, method = c("nonparametric", "normal", 
    "huge"), eval.LCs = NULL)

estimate_LC_pdf_state(state, states = NULL, weights = NULL, LCs = NULL, eval.LCs = NULL, 
    method = c("nonparametric", "normal", "huge"))

Arguments

LCs

matrix of PLCs/FLCs. This matrix has N rows and n_p or n_f columns (depending on the PLC/FLC dimensionality)

weight.matrix

N \times K weight matrix

states

vector of length N with entry i being the label k = 1, …, K of PLC i

method

type of estimation: either a (multivariate) Normal distribution ("normal") or nonparametric with a kernel density estimator (method = "nonparametric"). For multivariate distributions (as usual for PLCs) only 'normal' should be used due to computational efficiency and statistical accuracy.

eval.LCs

on what LCs should the estimate be evaluated? If NULL then densities will be evaluated on the training data LCs

state

integer; which state-conditional density should be estimated

weights

weights of the samples. Either a i) length N vector with the weights for each observation; ii) N \times K matrix, where the state column of that matrix is used as a weight-vector.

Value

estimate_LC_pdfs returns an N \times K matrix.

estimate_LC.pdf.state returns a vector of length N with the state-conditional density evaluated at eval.LCs.

Examples

set.seed(10)
WW <- matrix(runif(10000), ncol = 10)
WW <- normalize(WW)
temp_flcs <- cbind(sort(rnorm(nrow(WW))))
temp_flc_pdfs <- estimate_LC_pdfs(temp_flcs, WW)
matplot(temp_flcs, temp_flc_pdfs, col = 1:ncol(WW), type = "l", xlab = "FLCs", 
    ylab = "pdf", lty = 1)
###################### one state only ###
temp_flcs <- temp_flcs[order(temp_flcs)]
temp_flc_pdf <- estimate_LC_pdf_state(state = 3, LCs = temp_flcs, weights = WW)

plot(temp_flcs, temp_flc_pdf, type = "l", xlab = "FLC", ylab = "pdf")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LICORS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LICORS/estimate_LC_pdfs.Rd_%03d_medium.png", width=480, height=480)
> ### Name: estimate_LC_pdfs
> ### Title: Estimate PLC/FLC distributions for all states
> ### Aliases: estimate_LC_pdfs estimate_LC_pdf_state estimate_LC.pdf.state
> ### Keywords: distribution multivariate nonparametric
> 
> ### ** Examples
> 
> set.seed(10)
> WW <- matrix(runif(10000), ncol = 10)
> WW <- normalize(WW)
> temp_flcs <- cbind(sort(rnorm(nrow(WW))))
> temp_flc_pdfs <- estimate_LC_pdfs(temp_flcs, WW)
> matplot(temp_flcs, temp_flc_pdfs, col = 1:ncol(WW), type = "l", xlab = "FLCs", 
+     ylab = "pdf", lty = 1)
> ###################### one state only ###
> temp_flcs <- temp_flcs[order(temp_flcs)]
> temp_flc_pdf <- estimate_LC_pdf_state(state = 3, LCs = temp_flcs, weights = WW)
> 
> plot(temp_flcs, temp_flc_pdf, type = "l", xlab = "FLC", ylab = "pdf")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>