Last data update: 2014.03.03

R: Multivariate Two Sample Shift Estimates
mv.2sample.estR Documentation

Multivariate Two Sample Shift Estimates

Description

Estimates the multivariate shift for different score functions and their asymptotic covariance matrices in the two sample case.

Usage

mv.2sample.est(X, g, score = "identity", stand = "outer", 
               maxiter = 100, eps = 1e-06, na.action = na.fail,
               ...)

Arguments

X

a numeric data frame or matrix.

g

a factor with two levels

score

the score to be used. Possible choices are identity, sign and rank.

stand

the standardization method used. Possible choices are outer and inner.

maxiter

maximum number of iterations. Used only for score = "sign" and score = "rank".

eps

convergence tolerance. Used only for score = "sign" and score = "rank".

na.action

a function which indicates what should happen when the data contain 'NA's. Default is to fail.

...

arguments that can be passed on to functions used for the estimation of location.

Details

This implements the location estimates and their asymptotic covariance matrices as described in chapter 11 of the MNM book. Note that the shift is the parameter for the defference between 'values of level 1 - values of level 2' where the levels are as defined in the factor g.

For the general c sample location case the function mv.l1lm might be used.

Value

A list with class 'mvloc' containing the following components:

location

the location estimate as a vector.

vcov

the asymptotic covariance matrix of the location estimate.

est.name

name of the location estimate.

dname

name of data set for which the location was computed.

Author(s)

Klaus Nordhausen

References

Oja, H. (2010), Multivariate Nonparametric Methods with R, Springer.

Nordhausen, K. and Oja, H. (2011), Multivariate L1 Methods: The Package MNM, Journal of Statistical Software, 43, 1-28.

See Also

spatial.sign, spatial.signrank

Examples

X1<- rmvnorm(50,c(0,0,0))
X2<- rmvnorm(70,c(1,1,2))
X<-rbind(X1,X2)
g<-factor(rep(1:2,c(50,70)))

  est.Hot.X <- mv.2sample.est(X, g)
  est.SS.o.X <- mv.2sample.est(X, g, "s")
  est.SS.i.X <- mv.2sample.est(X, g, "s", "i")
  est.SR.o.X <- mv.2sample.est(X, g, "r")
  est.SR.i.X <- mv.2sample.est(X, g, "r", "i")

  est.SS.o.X
  
  summary(est.SS.o.X)
  
  # plotting
   
  plotMvloc(est.Hot.X, est.SS.i.X, est.SR.i.X)

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(MNM)
Loading required package: ICSNP
Loading required package: mvtnorm
Loading required package: ICS
Loading required package: SpatialNP
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MNM/mv.2sample.est.Rd_%03d_medium.png", width=480, height=480)
> ### Name: mv.2sample.est
> ### Title: Multivariate Two Sample Shift Estimates
> ### Aliases: mv.2sample.est
> ### Keywords: multivariate nonparametric
> 
> ### ** Examples
> 
> X1<- rmvnorm(50,c(0,0,0))
> X2<- rmvnorm(70,c(1,1,2))
> X<-rbind(X1,X2)
> g<-factor(rep(1:2,c(50,70)))
> 
>   est.Hot.X <- mv.2sample.est(X, g)
>   est.SS.o.X <- mv.2sample.est(X, g, "s")
>   est.SS.i.X <- mv.2sample.est(X, g, "s", "i")
>   est.SR.o.X <- mv.2sample.est(X, g, "r")
>   est.SR.i.X <- mv.2sample.est(X, g, "r", "i")
> 
>   est.SS.o.X
$location
[1] -1.091289 -1.039539 -1.947939

$vcov
             [,1]         [,2]         [,3]
[1,]  0.039739076 -0.006759150  0.009373882
[2,] -0.006759150  0.023874630 -0.002090189
[3,]  0.009373882 -0.002090189  0.039062047

>   
>   summary(est.SS.o.X)
The difference between spatial medians of X by g is:
[1] -1.0913 -1.0395 -1.9479

And has the covariance matrix:
        [,1]    [,2]    [,3]
[1,]  0.0397 -0.0068  0.0094
[2,] -0.0068  0.0239 -0.0021
[3,]  0.0094 -0.0021  0.0391
>   
>   # plotting
>    
>   plotMvloc(est.Hot.X, est.SS.i.X, est.SR.i.X)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>