Description Usage Arguments Value Examples
General nonparametric maximum likelihood estimation for a bivariate mixing distribution, implemented using EM. Assumes that the observed data are tuples (X_{1i},X_{2i}) with marginal likelihood
\int f_1(X_{1i};u_1)f_2(X_{2i};u_2)dG(u_1,u_2),
where G is the mixing distribution to be estimated. Suppose there are p observed tuples and G is to be estimated on a grid of d1 x d2 points.
1 |
D1 |
p x d1 matrix of conditional density values, where the ijth entry is f_1(X_{1i};u_{1j}). |
D2 |
p x d2 matrix of conditional density values, where the ijth entry is f_2(X_{2i};u_{2j}). |
maxit |
maximum number of EM iterations |
tol |
error tolerance |
verbose |
TRUE to print the error attained by each EM iteration |
g |
d1 x d2 matrix of probability masses at each grid point |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## generate parameters from mixing distribution
p <- 1000;
set.seed(1); theta1 <- rnorm(p); theta2 <- -theta1+rnorm(p);
## generate observed variables
X1 <- rnorm(p,theta1,1); X2 <- rnorm(p,theta2,1);
## set grid points
d1 <- 25; d2 <- 30;
Theta1 <- seq(min(X1),max(X1),length=d1);
Theta2 <- seq(min(X2),max(X2),length=d2);
## calculate D matrices
D1 <- outer(X1,Theta1,function(x,y){
dnorm(x,y,1);
});
D2 <- outer(X2,Theta2,function(x,y){
dnorm(x,y,1);
});
## fit npmle
g <- bi.npmle(D1,D2);
contour(Theta1,Theta2,g);
points(theta1,theta2);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.