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
1 2 3 4 5 
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 ( 
eval.LCs 
on what LCs should the estimate be
evaluated? If 
state 
integer; which stateconditional 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 
Value
estimate_LC_pdfs
returns an N \times
K matrix.
estimate_LC.pdf.state
returns a vector of
length N with the stateconditional density
evaluated at eval.LCs
.
Examples
1 2 3 4 5 6 7 8 9 10 11 12  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")
