uni.npmle: Univariate NPMLE

Description Usage Arguments Value Examples

Description

General nonparametric maximum likelihood estimation for a univariate mixing distribution, implemented using EM. Assumes that the observed data are X_i with marginal likelihood

\int f(X_i;u)dG(u),

where G is the mixing distribution to be estimated. Suppose there are p observations and G is to be estimated on a grid of d points.

Usage

1
uni.npmle(D, maxit = 200, tol = 1e-04, verbose = FALSE)

Arguments

D

p x d matrix of conditional density values, where the ijth entry is f(X_i;u_j)

maxit

maximum number of EM iterations

tol

error tolerance

verbose

TRUE to print the error attained by each EM iteration

Value

g

d x 1 vector of probability masses at each grid point

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## generate parameters from mixing distribution
p <- 1000;
set.seed(1); theta <- rnorm(p);
## generate observed variables
X <- rnorm(p,theta,1);
## set grid points
d <- 25;
Theta <- seq(min(X),max(X),length=d);
## calculate D matrix
D <- outer(X,Theta,function(x,y){
  dnorm(x,y,1);
});
## fit npmle
g <- uni.npmle(D);
plot(Theta,g/sum(g*(Theta[2]-Theta[1])),type="l");
lines(Theta,dnorm(Theta),col="red");

sdzhao/ssa documentation built on May 18, 2019, 2:36 p.m.