Learn R Programming

LogConcDEAD (version 1.6-10)

getweights: Find appropriate weights for likelihood calculations

Description

This function takes takes a matrix of (possibly binned) data and returns a matrix containing the distinct observations, and a vector of weights \(w\) as described below.

Usage

getweights(x)

Value

xout

A matrix containing the distinct rows of the input matrix x

w

A real-valued vector of weights as described above

Arguments

x

a data matrix

Author

Madeleine Cule

Robert Gramacy

Richard Samworth

Details

Given an \(n \times d\) matrix \(x\) of points in \(R^d\), this function removes duplicated observations, and counts the number of times each observation occurs. This is used to compute a vector \(w\) such that $$w_i = \frac{\# \textrm{ of times value } i\textrm{ is observed }}{\# \textrm{ of observations}}.$$

This function is called by mlelcd in order to compute the maximum likelihood estimator when the observed data values are not distinct. In this case, the log likelihood function is of the form $$\sum_{j=1}^m w_j \log f(X_j),$$ where the sum is over distinct observations.

See Also

mlelcd

Examples

Run this code
## simple normal example

x <- matrix(rnorm(200),ncol=2)
tmp <- getweights(x)
lcd <- mlelcd(tmp$x,tmp$w)
plot(lcd,type="ic")

Run the code above in your browser using DataLab