Skip to content

huijiefeng/ScoreTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScoreTest

This is an R package containing the implementation of the score test function from the paper ''A General Theory of Hypothesis Tests and Confidence Regions for Sparse High Dimensional Models'' by Yang Ning and Han Liu. To install this package, please follow the following steps:

  1. Install package devtools from CRAN.
install.packages("devtools")
  1. Load the devtools package.
library(devtools)
  1. Install ScoreTest.
install_github("huijiefeng/ScoreTest")

[Warning] It looks like after installing this package for the first time, the help page for the main function dScore() will not show properly. As far as I know this is an issue due to devtools and to fix this, simply restart your R session and the help page should look good. Sorry for the inconvenience

To test the package, feel free to play with the following toy example (more examples in Demo.R):

library(mvtnorm)
library(ScoreTest)

#data generation
d  <-  200
a  <-  0
rho  <-  0.25
signal  <-  0.45
n  <-  100
s   <-  3
mean  <-  rep(0,d)
Sgm   <-  diag(d) 
coi    <-  4 

# Generate covariance matrix
for (i in 1:d)
{
  for (j in 1:d)
  {
    Sgm[i,j]  <-  rho^(abs(i-j))
  }
}

X   <-  rmvnorm(n=n,mean=mean,sigma = Sgm) 
#X = matrix(rnorm(n*d),n)
bt  <-  c(rep(signal,s),rep(0,d-s)) 

#gaussian
Y   <-  X%*%bt + rnorm(n)
#true alternative
dScore(Y, X, 1,family = 'gaussian')$pval
#true null
dScore(Y, X, 4,family = 'gaussian',refit = T)$pval

About

R package ScoreTest

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages