Last data update: 2014.03.03

R: Test for a vector being in the null space of a double cone
doubconetestR Documentation

Test for a vector being in the null space of a double cone

Description

Given an n-vector y and the model y=m+e, and an m by n "irreducible" matrix amat, test the null hypothesis that the vector m is in the null space of amat.

Usage

doubconetest(y, amat, nsim = 1000)

Arguments

y

a vector of length n

amat

an m by n "irreducible" matrix

nsim

number of simulations to approximate null distribution – default is 1000, but choose more if a more precise p-value is desired

Details

The matrix amat defines a polyhedral convex cone of vectors x such that amat%*%x>=0, and also the opposite cone amat%*%x<=0. The linear space C is those x such that amat%*%x=0. The function provides a p-value for the null hypothesis that m=E(y) is in C, versus the alternative that it is in one of the two cones defined by amat.

Value

pval

The p-value for the test

p0

The least-squares fit under the null hypothesis

p1

The least-squares fit to the "positive" cone

p2

The least-squares fit to the "negative" cone

Author(s)

Mary C Meyer and Bodhisattva Sen

References

TBA, Meyer, M.C. (1999) An Extension of the Mixed Primal-Dual Bases Algorithm to the Case of More Constraints than Dimensions, Journal of Statistical Planning and Inference, 81, pp13-31.

See Also

agconst,partlintest

Examples

## test against a constant function
n=100
x=1:n/n
mu=4-5*(x-1/2)^2
y=mu+rnorm(n)
amat=matrix(0,nrow=n-1,ncol=n)
for(i in 1:(n-1)){amat[i,i]=-1;amat[i,i+1]=1}
ans=doubconetest(y,amat)
ans$pval
plot(x,y,col="slategray");lines(x,mu,lty=3,col=3)
lines(x,ans$p1,col=2)
lines(x,ans$p2,col=4)

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(DoubleCone)
Loading required package: coneproj
Loading required package: Matrix
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DoubleCone/doubconetest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: doubconetest
> ### Title: Test for a vector being in the null space of a double cone
> ### Aliases: doubconetest
> ### Keywords: monotone regression hypothesis test cone projection
> 
> ### ** Examples
> 
> ## test against a constant function
> n=100
> x=1:n/n
> mu=4-5*(x-1/2)^2
> y=mu+rnorm(n)
> amat=matrix(0,nrow=n-1,ncol=n)
> for(i in 1:(n-1)){amat[i,i]=-1;amat[i,i+1]=1}
> ans=doubconetest(y,amat)
> ans$pval
[1] 0.091
> plot(x,y,col="slategray");lines(x,mu,lty=3,col=3)
> lines(x,ans$p1,col=2)
> lines(x,ans$p2,col=4)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>