Last data update: 2014.03.03

R: Minimum Averaged Mean Squared Error (MAMSE) Weights.
MAMSE-packageR Documentation

Minimum Averaged Mean Squared Error (MAMSE) Weights.

Description

This package provides algorithms to calculate the nonparametric adaptive MAMSE weights. The MAMSE weights can be used for the weighted likelihood (see references below), or as mixing probabilities to define mixtures of empirical distributions. They provide a framework to borrow strenght with minimal assumptions.

Details

Package: MAMSE
Type: Package
Version: 0.1
Date: 2009-02-01
License: GPL-2
LazyLoad: yes

Function MAMSE calculates the MAMSE weights for univariate data, right-censored data, or for the copula underlying the distribution of multivariate data. The function WKME is used to compute the MAMSE-Weighted Kaplan-Meier estimate with (optional) bootstrap confidence intervals.

Author(s)

Jean-Francois Plante, <jfplante(at)hec.ca>.

Maintainer: Jean-Francois Plante, <jfplante(at)hec.ca>.

References

F. Hu and J. V. Zidek (2002). The weighted likelihood, The Canadian Journal of Statistics, 30, 347–371.

J.-F. Plante (2007). Adaptive Likelihood Weights and Mixtures of Empirical Distributions. Unpublished doctoral dissertation, University of British Columbia.

J.-F. Plante (2008). Nonparametric adaptive likelihood weights. The Canadian Journal of Statistics, 36, 443-461.

J.-F. Plante (2009). Asymptotic properties of the MAMSE adaptive likelihood weights. Journal of Statistical Planning and Inference, 139, 2147-2161.

J.-F. Plante (2009). About an adaptively weighted Kaplan-Meier estimate. Lifetime Data Analysis, 15, 295-315.

X. Wang (2001). Maximum weighted likelihood estimation, unpublished doctoral dissertation, Department of Statistics, The University of British Columbia.

See Also

MAMSE, WKME.

Examples

set.seed(2009)

# MAMSE weights for univariate data
x=list(rnorm(25),rnorm(250,.1),rnorm(100,-.1))
wx=MAMSE(x)

# Weighted Likelihood estimate for the mean (Normal model)
sum(wx*sapply(x,mean))

#MAMSE weights for copulas
rho=c(.25,.3,.15,.2)
r=2*sin(rho*pi/600)
y=list(0,0,0,0)
for(i in 1:4){
  sig=matrix(c(1,r,r,1),2,2)
  y[[i]]=matrix(rnorm(150),nc=2)
}
wy=MAMSE(y)

# Weighted coefficient of correlation
sum(wy*sapply(y,cor,method="spearman")[2,])

#MAMSE weights for right-censored data

z=list(0,0,0)
for(i in 1:3){  
  zo=rexp(100)
  zc=pmin(rexp(100),rexp(100),rexp(100))
  z[[i]]=cbind(pmin(zo,zc),zo<=zc)
}

MAMSE(z,.5,surv=TRUE)

allz=pmin(.5,c(z[[1]][z[[1]][,2]==1,1],z[[2]][z[[2]][,2]==1,1],
   z[[3]][z[[3]][,2]==1,1]))
K=WKME(z,.5,time=sort(unique(c(0,.5,allz,allz-.0001))))
plot(K$time,K$wkme,type='l',col="blue",xlab="x",ylab="P(X<=x)",
   ylim=c(0,.5))
lines(K$time,K$kme[,1],col="red")
legend(0,.5,c("Weighted Kaplan-Meier","Kaplan-Meier"),
   col=c("blue","red"),lty=c(1,1))

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(MAMSE)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MAMSE/MAMSE-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MAMSE-package
> ### Title: Minimum Averaged Mean Squared Error (MAMSE) Weights.
> ### Aliases: MAMSE-package
> ### Keywords: package multivariate nonparametric survival univar
> 
> ### ** Examples
> 
> set.seed(2009)
> 
> # MAMSE weights for univariate data
> x=list(rnorm(25),rnorm(250,.1),rnorm(100,-.1))
> wx=MAMSE(x)
> 
> # Weighted Likelihood estimate for the mean (Normal model)
> sum(wx*sapply(x,mean))
[1] 0.01458792
> 
> #MAMSE weights for copulas
> rho=c(.25,.3,.15,.2)
> r=2*sin(rho*pi/600)
> y=list(0,0,0,0)
> for(i in 1:4){
+   sig=matrix(c(1,r,r,1),2,2)
+   y[[i]]=matrix(rnorm(150),nc=2)
+ }
> wy=MAMSE(y)
> 
> # Weighted coefficient of correlation
> sum(wy*sapply(y,cor,method="spearman")[2,])
[1] -0.01438126
> 
> #MAMSE weights for right-censored data
> 
> z=list(0,0,0)
> for(i in 1:3){  
+   zo=rexp(100)
+   zc=pmin(rexp(100),rexp(100),rexp(100))
+   z[[i]]=cbind(pmin(zo,zc),zo<=zc)
+ }
> 
> MAMSE(z,.5,surv=TRUE)
[1] 0.6862467 0.0000000 0.3137533
> 
> allz=pmin(.5,c(z[[1]][z[[1]][,2]==1,1],z[[2]][z[[2]][,2]==1,1],
+    z[[3]][z[[3]][,2]==1,1]))
> K=WKME(z,.5,time=sort(unique(c(0,.5,allz,allz-.0001))))
> plot(K$time,K$wkme,type='l',col="blue",xlab="x",ylab="P(X<=x)",
+    ylim=c(0,.5))
> lines(K$time,K$kme[,1],col="red")
> legend(0,.5,c("Weighted Kaplan-Meier","Kaplan-Meier"),
+    col=c("blue","red"),lty=c(1,1))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>