content stringlengths 0 14.9M | filename stringlengths 44 136 |
|---|---|
library("aroma.affymetrix");
library("ACNE");
log <- verbose <- Arguments$getVerbose(-8, timestamp=TRUE);
dataSetName <- "Affymetrix_2006-TumorNormal";
chipType <- "Mapping250K_Nsp";
pairs <- matrix(c(
"CRL-2325D", "CRL-2324D",
"CRL-5957D", "CRL-5868D",
"CCL-256.1D", "CCL-256D",
"CRL-2319D", "CRL-2320D"... | /scratch/gouwar.j/cran-all/cranData/ACNE/inst/testScripts/system/chipTypes/Mapping250K_Nsp,Sty/test20090128,250K,TumorNormal,NMF.R |
library("ACNE");
verbose <- Arguments$getVerbose(-8, timestamp=TRUE);
dataSet <- "Affymetrix_2006-TumorNormal";
chipType <- "Mapping250K_Nsp";
res <- doACNE(dataSet, chipType=chipType, verbose=verbose);
print(res);
ds <- res$total;
dfR <- getAverageFile(ds, verbose=verbose);
df <- getFile(ds, 1);
baf <- getFile(res$f... | /scratch/gouwar.j/cran-all/cranData/ACNE/inst/testScripts/system/chipTypes/Mapping250K_Nsp,Sty/test20100517,250K,doACNE.R |
if (interactive()) savehistory();
library("aroma.affymetrix");
library("ACNE");
# - - - - - - - - - - - - - - - - - - - - - - -
# setup dataset and chip names
# - - - - - - - - - - - - - - - - - - - - - - -
log <- Arguments$getVerbose(-10, timestamp=TRUE);
dataSetName <- "HapMap270,100K,CEU,5trios"
chipType <- "Mappi... | /scratch/gouwar.j/cran-all/cranData/ACNE/inst/testScripts/system/chipTypes/Mapping50K_Hind240,Xba240/test20090122,50K,NMF,freqB.R |
if (interactive()) savehistory();
library("aroma.affymetrix");
library("ACNE");
# - - - - - - - - - - - - - - - - - - - - - - -
# setup dataset and chip names
# - - - - - - - - - - - - - - - - - - - - - - -
log <- Arguments$getVerbose(-10, timestamp=TRUE);
dataSetName <- "HapMap270,100K,CEU,5trios"
chipType <- "Mappi... | /scratch/gouwar.j/cran-all/cranData/ACNE/inst/testScripts/system/chipTypes/Mapping50K_Hind240,Xba240/test20090128,50K,NMF.R |
library("ACNE");
verbose <- Arguments$getVerbose(-8, timestamp=TRUE);
dataSet <- "HapMap270,100K,CEU,5trios";
chipType <- "Mapping50K_Hind240";
res <- doACNE(dataSet, chipType=chipType, verbose=verbose);
print(res);
ds <- res$total;
dfR <- getAverageFile(ds, verbose=verbose);
df <- getFile(ds, 1);
baf <- getFile(res$... | /scratch/gouwar.j/cran-all/cranData/ACNE/inst/testScripts/system/chipTypes/Mapping50K_Hind240,Xba240/test20100517,50K,doACNE.R |
Binom_Sim <-
function(size,p,N) {
q <- 1-p
x <- numeric(N)
for(i in 1:N){
temp <- runif(1)
j <- 0; cc <- p/(1-p); prob <- (1-p)^size; F <- prob
while(temp >= F){
prob <- cc*(size-j)*prob/(j+1); F <- F+prob; j <- j+1
}
x[i] <- j
}
return(x)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/Binom_Sim.R |
Ehrenfest <-
function(n) {
States <- c(0, seq(1,2*n))
TPM <- matrix(0,nrow=length(States),ncol=length(States),dimnames=
list(seq(0,2*n),seq(0,2*n)))
tran_prob <- function(i,n) {
tranRow <- rep(0,2*n+1)
if(i==0) tranRow[2] <- 1
if(i==2*n) tranRow[(2*n+1)-1] <- 1
if(i!=0 & i!=2*n) ... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/Ehrenfest.R |
Geom_Sim <-
function(p,n){
q <- 1-p
x <- numeric(n)
for(i in 1:n){
temp <- runif(1)
temp <- 1-temp
j <- 0
while(((temp>q^j) & (temp <= q^{j-1}))==FALSE)j <- j+1
x[i] <- j
}
return(x)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/Geom_Sim.R |
LRNormal2Mean <-
function(x,y,alpha){
xbar <- mean(x); ybar <- mean(y)
nx <- length(x); ny <- length(y)
Sx <- var(x); Sy <- var(y)
Sp <- ((nx-1)*Sx+(ny-1)*Sy)/(nx+ny-2)
tcalc <- abs(xbar-ybar)/sqrt(Sp*(1/nx+1/ny))
conclusion <- ifelse(tcalc>qt(df=nx+ny-2,p=alpha/2),
"Reject Hypothesis... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/LRNormal2Mean.R |
LRNormalMean_KV <-
function(x,mu0,alpha,sigma) {
ifelse(abs(sqrt(length(x))*(mean(x)-mu0)/sigma)>qnorm(1-alpha/2),"Reject Hypothesis H","Fail to Reject Hypothesis H")
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/LRNormalMean_KV.R |
LRNormalMean_UV <-
function(x,mu0,alpha){
S <- sd(x); n <- length(x)
ifelse(abs(sqrt(length(x))*(mean(x)-mu0)/S)>qt(n-1,1-alpha/2),"Reject Hypothesis H","Fail to Reject Hypothesis H")
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/LRNormalMean_UV.R |
LRNormalVariance_UM <-
function(x,sigma0,alpha){
S <- var(x); n <- length(x)
chidata <- ((n-1)*S)/(sigma0^2)
ifelse((chidata<qchisq(df=n-1,p=alpha/2)|| (chidata>qchisq(df=n-1,p=1-alpha/2))),"Reject Hypothesis H","Fail to Reject Hypothesis H")
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/LRNormalVariance_UM.R |
MPNormal <-
function(mu0, mu1, sigma, n,alpha) {
if(mu0<mu1) k <- qnorm(alpha,lower.tail = FALSE)*sigma/sqrt(n) + mu0
if(mu0>mu1) k <- mu0 - qnorm(alpha,lower.tail = FALSE)*sigma/sqrt(n)
return(k)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/MPNormal.R |
MPPoisson <-
function(Hlambda, Klambda, alpha,n) {
Hlambda <- n*Hlambda
Klambda <- n*Klambda
nn <- n*Hlambda
if(Hlambda<Klambda) {
k <- min(which((1-ppois(0:nn,lambda=Hlambda))<alpha))-1
gamma <- (alpha-1+ppois(k,lambda=Hlambda))/dpois(k,lambda=Hlambda)
return(list=c(k,gamma))
}
else {
k ... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/MPPoisson.R |
MPbinomial <-
function(Hp, Kp, alpha,n) {
if(Hp<Kp){
k <- min(which((1-pbinom(0:n,size=n,prob=Hp))<alpha))-1
gamma <- (alpha-1+pbinom(k,size=n,prob=Hp))/dbinom(k,size=n,prob=Hp)
return(list=c(k,gamma))
}
else {
k <- max(which((pbinom(0:n,size=n,prob=Hp))<alpha))
gamma <- (alpha-pbinom(k-1,siz... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/MPbinomial.R |
Poisson_Sim <-
function(lambda,n) {
x = numeric(n)
for(i in 1:n){
j = 0; p = exp(-lambda); F = p
temp = runif(1)
while((F>temp)==FALSE){
p = lambda*p/(j+1); F = F+p; j=j+1
}
x[i] = j
}
return(x)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/Poisson_Sim.R |
QH_CI <-
function(x,alpha) {
k <- length(x); n <- sum(x)
QH_lcl <- (1/(2*(sum(x)+qchisq(1-alpha/k,k-1))))*{qchisq(1-alpha/k,k-1)+2*x-sqrt( qchisq(1-alpha/k,k-1)*(qchisq(1-alpha/k,k-1)+ 4*x*(sum(x)-x)/sum(x))) }
QH_ucl <- (1/(2*(sum(x)+qchisq(1-alpha/k,k-1))))*{qchisq(1-alpha/k,k-1)+2*x+sqrt( qchisq(1-alpha/k,k-1... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/QH_CI.R |
ST_Ordered <-
function(N,x,p_x){
x <- x[order(p_x,decreasing=TRUE)]
F_x <- cumsum(sort(p_x,decreasing=TRUE))
disc_sim <- numeric(length=N)
for(i in 1:N){
temp <- runif(1)
disc_sim[i] <- x[min(which(F_x>temp))]
}
return(disc_sim)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/ST_Ordered.R |
ST_Unordered <-
function(N,x,p_x) {
F_x <- cumsum(p_x)
disc_sim <- numeric(length=N)
for(i in 1:N){
temp <- runif(1)
disc_sim[i] <- x[min(which(F_x>temp))]
}
return(disc_sim)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/ST_Unordered.R |
TM <-
function(x) {
qs <- quantile(x,c(0.25,0.5,0.75))
return(as.numeric((qs[2]+(qs[1]+qs[3])/2)/2))
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/TM.R |
TMH <-
function(x) {
qh <- fivenum(x,c(0.25,0.5,0.75))
return((qh[2]+(qh[1]+qh[3])/2)/2)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/TMH.R |
UMPExponential <-
function(theta0, n, alpha){
t <- qgamma(1-alpha, shape=n,scale=theta0)
return(t)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/UMPExponential.R |
UMPNormal <-
function(mu0, sigma, n,alpha) {
mu0-qnorm(alpha)*sigma/sqrt(n)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/UMPNormal.R |
UMPUniform <-
function(theta0,n,alpha) return(theta0*(1-alpha)^{1/n})
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/UMPUniform.R |
WilsonCI <-
function(x,n,alpha) {
phat <- x/n
nz2 <- n + dnorm(alpha/2)^2
firstterm <- phat*n/nz2
secondterm <- 0.5*dnorm(alpha/2)/nz2
commonterm <- phat*(1-phat)/n
commonterm <- commonterm * (n^2) * (dnorm(alpha/2)^2) / (nz2^2)
commonterm <- commonterm + (0.25 * (dnorm(alpha/2)^4) )/ (nz2^2)
commonter... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/WilsonCI.R |
kurtcoeff <-
function (x) {
x <- x[!is.na(x)]
n <- length(x)
mx <- mean(x); sx <- sd(x)*sqrt((n-1)/n)
kurt <- mean((x-mx)^4)/sx^4
return(kurt)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/kurtcoeff.R |
lval <-
function (x, na.rm = TRUE)
{
xna <- is.na(x)
if (na.rm)
x <- x[!xna]
else if (any(xna))
return(rep(NA, 5))
x <- sort(x)
n <- length(x)
cpos <- n
depth <- c()
while (cpos > 1) {
cpos <- (floor(cpos) + 1)/2
if (cpos != 1.5)
depth <- c(depth, cpos)
}
lo <- (x[floor(dep... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/lval.R |
msteptpm <-
function(TPM,m){
if(m==1) return(TPM) else {
temp <- TPM
for(i in 1:(m-1)) temp=temp%*%TPM
return(temp)
}
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/msteptpm.R |
pareto_density <-
function(x,scale,shape) {
lpd <- ifelse(x<scale, -Inf, log(shape) + shape*log(scale) - (shape+1)*log(x))
return(exp(lpd))
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/pareto_density.R |
pareto_quantile <-
function(p,scale,shape) scale/(1-p)^{1/shape}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/pareto_quantile.R |
powertestplot <-
function(mu0,sigma,n,alpha) {
mu0seq <- seq(mu0-3*sigma, mu0+3*sigma,(6*sigma/100))
betamu <- pnorm(sqrt(n)*(mu0-mu0seq)/sigma-qnorm(1-alpha))
plot(mu0seq,betamu,"l",xlab=expression(mu),ylab="Power of UMP Test",main=expression(paste("H:",mu >= mu[0]," vs K:",mu<mu[0])))
abline(h=alpha)
ablin... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/powertestplot.R |
resistant_line <-
function(x,y,iterations) {
three_medians <- function(x,y) {
n <- length(x)
k <- n %% 3
dix <- sort(x,index.return=TRUE)$ix
x <- x[dix]; y <- y[dix]
if(k==0) {
t <- n/3
xleft <- x[1:t]; xmid <- x[(t+1):(2*t)]; xright <- x[(2*t+1):n]
yleft <- y[1:t]; ymid <- y[(... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/resistant_line.R |
siegel.tukey <-
function(x,y) {
m <- length(x);n <- length(y)
N <- m+n
an <- function(N){
TEMP <- NULL
for(i in 1:N){
if(i<=N/2){
if(i%%2==0) TEMP[i] <- 2*i else TEMP[i] <- 2*i-1
}
if(i>N/2){
if(i%%2==0) TEMP[i] <- 2*(N-i)+2 else TEMP[i] <- 2*(N-i)+1
}
}
re... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/siegel.tukey.R |
skewcoeff <-
function(x) {
x <- x[!is.na(x)]
n <- length(x)
mx <- mean(x); sx <- sd(x)*sqrt((n-1)/n)
skew <- mean((x-mx)^3)/sx^3
return(skew)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/skewcoeff.R |
stationdistTPM <-
function(M) {
eigenprob <- eigen(t(M))
temp <- which(round(eigenprob$values,1)==1)
stationdist <- eigenprob$vectors[,temp]
stationdist <- stationdist/sum(stationdist)
return(stationdist)
}
| /scratch/gouwar.j/cran-all/cranData/ACSWR/R/stationdistTPM.R |
vonNeumann <-
function(x,n) {
rx <- NULL
d <- max(2,length(unlist(strsplit(as.character(x),""))));
getNext <- function(x,d) {
temp <- x^2
tbs <- as.numeric(unlist(strsplit(as.character(temp),""))) # to be split
tbs_n <- length(tbs);
diff_n <- 2*d - tbs_n;
dn <- ceiling(d/2)
ifelse(diff_n... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/vonNeumann.R |
ww.test <-
function(x,y) {
runfunction <- function(x,y){
xind <- rep(1,length(x))
yind <- rep(2,length(y))
xy <- c(x,y); xyind <- c(xind,yind);grand <- cbind(xy,xyind)
grand <- grand[rank(grand[,1]),]
num_of_runs <- sum(diff(grand[,2])!=0)+1
# return(num_of_runs)
}
m <- length(x); n <- le... | /scratch/gouwar.j/cran-all/cranData/ACSWR/R/ww.test.R |
DistIdealPatt <-
function(Y,Q,weight){
#-----------------------Basic variables----------------------#
#N:number of examinees
#J:number of items
#K:number of attributes
#M:number of ideal attribute patterns, which is equal to 2^K
N <- dim(Y)[1]
J <- dim(Y)[2]
K <- dim(Q)[2]
M <- 2^K
#---------... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/DistIdealPatt.R |
alpha <- function(K){
GDINA::attributepattern(K)
}
| /scratch/gouwar.j/cran-all/cranData/ACTCD/R/alpha.R |
cd.cluster <-
function(Y, Q, method = c("HACA","Kmeans"), Kmeans.centers = NULL,
Kmeans.itermax = 10,Kmeans.nstart = 1,
HACA.link = c("complete", "ward", "single","average",
"mcquitty", "median", "centroid"),HACA.cut = NULL) {
cluster.method <-... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/cd.cluster.R |
eta <-
function (K,J,Q)
{
M <- 2^K
A <- alpha(K)
tmp <- matrix(NA,M,J)
for (g in 1:M){ #g is latent pattern
for (j in 1:J){ #j is item
tmp[g,j] <- ifelse(all(as.logical(A[g,]^Q[j,])),1,0)
}
}
return(tmp)
}
| /scratch/gouwar.j/cran-all/cranData/ACTCD/R/eta.R |
input.check <-
function(Y, Q, cluster.method="HACA", HACA.link="complete",
label.method="2a",perm=NULL)
{
##################################################
# Check Y and Q #
##################################################
if (!is.matrix(Y)){
Y <- ... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/input.check.R |
labeling <-
function(Y,Q,cd.cluster.object,method = c("2b","2a","1","3"),perm=NULL){
label.method <- match.arg(method)
#distance <- match.arg(distance)
#------------------------Input check-------------------------#
input.check(Y,Q,label.method = label.method,perm=perm)
Y <- as.mat... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/labeling.R |
npar.CDM <-
function(Y, Q, cluster.method = c("HACA","Kmeans"), Kmeans.centers = NULL,
Kmeans.itermax = 10, Kmeans.nstart = 1, HACA.link =
c("complete", "ward", "single","average", "mcquitty",
"median", "centroid"),HACA.cut = NULL,label.method =
c("2b"... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/npar.CDM.R |
print.labeling <-
structure(function(x, ...)
{
output2 <- x$att.dist
cat("-------------------------------------------\n")
cat("labeling for ACTCD\n")
cat(paste(paste("based on", x$label.method, "label method"),"\n"))
cat("-------------------------------------------\n")
cat("The distribution of attrib... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/print.Labeling.R |
print.cd.cluster <-
structure(function(x, ...)
{
output1 <- cbind(c(1:length(x$size)),x$size)
colnames(output1) <- c("clusters #","freq")
cat("-------------------------------------------\n")
cat("Cluster analysis for ACTCD\n")
cat(paste(paste("based on", x$cluster.method, "algorithm"),"\n"))
cat("--------... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/print.cd.cluster.R |
print.npar.CDM <-
structure(function(x, ...)
{
output <- x$att.dist
cat("ACTCD: Asymptotic Classification Theory for Cognitive Diagnosis\n")
cat("-------------------------------------------\n")
cat(paste(paste("Analysis starts at", x$starting.time),"\n"))
cat(paste(paste("Analysis ends at", x$end.time),"\n... | /scratch/gouwar.j/cran-all/cranData/ACTCD/R/print.npar.CDM.R |
#' Construct shift matrix
#'
#' Internal function for creation of sparse shift matrix.
#'
#' @param n Integer specifying dimensions of the shift matrix.
#' @param q Integer specifying the order of the shift matrix. Value `q = 1` (resp. `q = -1`) indicates the upper (resp. lower) shift matrix. Larger (resp. smaller) val... | /scratch/gouwar.j/cran-all/cranData/ACV/R/ShiftMatrix.R |
#' Estimate out-of-sample loss
#'
#' Function `estimateL()` estimates the out-of-sample loss of a given algorithm on specified time-series. By default, it uses the optimal weighting scheme which exploits also the in-sample performance in order to deliver a more precise estimate than the conventional estimator.
#'
#' @p... | /scratch/gouwar.j/cran-all/cranData/ACV/R/estimateL.R |
#' Estimate long-run variance
#'
#' Internal function for estimating the long-run variance.
#'
#' @param x Univariate time-series object.
#' @param bw Bandwidth for long run variance estimation.
#'
#' @return Estimated long run variance (numeric vector of length 1).
#'
#' @export
#' @keywords internal
estimateLongRunV... | /scratch/gouwar.j/cran-all/cranData/ACV/R/estimateLongRunVar.R |
#' Estimate `rho` coefficient
#'
#' Internal function for estimating the rho coefficient.
#'
#' @param Phi Matrix of computed contrasts generated by `tsACV()`.
#' @param rhoLimit Parameter `rhoLimit` limits to the absolute value of the estimated `rho` coefficient. This is useful as estimated values very close to 1 migh... | /scratch/gouwar.j/cran-all/cranData/ACV/R/estimateRho.R |
#' Recover information about `Phi`
#'
#' Internal function which recovers all the necessary parameters using which the `Phi` was constructed and some additional useful variables derived from these parameters.
#'
#' @param Phi Matrix of computed contrasts generated by `tsACV()`.
#'
#' @return List of parameters that wer... | /scratch/gouwar.j/cran-all/cranData/ACV/R/infoPhi.R |
#' Printing method for class `"estimateL"`
#'
#' Internal printing method for `"estimateL"` object generated by `estimateL()`.
#'
#' @param x Object of class `"estimateL"`.
#'
#' @return Does not return a value. It is used to print out the loss estimate along its standard error and confidence interval.
#'
#' @export
#'... | /scratch/gouwar.j/cran-all/cranData/ACV/R/print.estimateL.R |
#' Printing method for class `"testL"`
#'
#' Internal printing method for `"testL"` object generated by `testL()`.
#'
#' @param x Object of class `"testL"`.
#'
#' @return Does not return a value. It is used to print out the test results.
#'
#' @export
#' @keywords internal
print.testL <- function(x, ...) {
cat(x$tes... | /scratch/gouwar.j/cran-all/cranData/ACV/R/print.testL.R |
#' Test equality of out-of-sample losses of two algorithms
#'
#' Function `testL()` tests the null hypothesis of equal predictive ability of `algorithm1` and `algorithm2` on time series `y`. By default, it uses the optimal weighting scheme which exploits also the in-sample performance in order to deliver more power tha... | /scratch/gouwar.j/cran-all/cranData/ACV/R/testL.R |
#' Perform time-series cross-validation
#'
#' Function `tsACV()` computes contrasts between forecasts produced by a given algorithm and the original time-series on which the algorithm is trained.
#' This can then be used to estimate the loss of the algorithm.
#' Unlike the similar `tsCV()` function from the `'forecast'... | /scratch/gouwar.j/cran-all/cranData/ACV/R/tsACV.R |
#' Acute Chronic Workload Ratio
#'
#' @param db a data frame
#' @param ID ID of the subjects
#' @param TL training load
#' @param weeks training weeks
#' @param days training days
#' @param training_dates training dates
#' @param ACWR_method method to calculate ACWR
#'
#' @return a data frame with the acute & chronic ... | /scratch/gouwar.j/cran-all/cranData/ACWR/R/ACWR.R |
#' Exponentially Weighted Moving Average
#'
#' @param TL training load
#'
#' @return {This function returns the following variables:
#' \itemize{
#' \item EWMA_chronic: EWMA - chronic training load.
#' \item EWMA_acute: EWMA - acute training load.
#' \item EWMA_ACWR: EWMA - Acute-Chronic Workload Ratio.
#' }}
#'
#' @e... | /scratch/gouwar.j/cran-all/cranData/ACWR/R/EWMA.R |
#' Rolling Average Coupled
#'
#' @param TL training load
#' @param weeks training weeks
#' @param training_dates training dates
#'
#' @return {This function returns the following variables:
#' \itemize{
#' \item RAC_chronic: RAC - chronic training load.
#' \item RAC_acute: RAC - acute training load.
#' \item RAC_ACWR:... | /scratch/gouwar.j/cran-all/cranData/ACWR/R/RAC.R |
#' Rolling Average Uncoupled
#'
#' @param TL training load
#' @param weeks training weeks
#' @param training_dates training dates
#'
#' @return {This function returns the following variables:
#' \itemize{
#' \item RAU_chronic: RAU - chronic training load.
#' \item RAU_acute: RAU - acute training load.
#' \item RAU_ACW... | /scratch/gouwar.j/cran-all/cranData/ACWR/R/RAU.R |
#' ACWR plots using d3.js
#'
#' @param db a data frame
#' @param TL training load
#' @param ACWR Acute Chronic Workload Ratio
#' @param day training days
#' @param ID ID of the subjects
#' @param colour colour of the bars. By default "#87CEEB" (skyblue)
#' @param xLabel x-axis label. By default "Days"
#' @param y0Labe... | /scratch/gouwar.j/cran-all/cranData/ACWR/R/plot_ACWR.R |
#' @title Training load dataframe
#'
#' @description A dataframe with the training load of 3 subjects.
#'
#' @docType data
#'
#' @usage data("training_load", package = "ACWR")
#'
#' @section Variables:
#' \describe{
#' \item{ID}{ID of the subjects}
#' \item{Week}{training weeks}
#' \item{Day}{training days}
#' ... | /scratch/gouwar.j/cran-all/cranData/ACWR/R/training_load.R |
#' Create Training Blocks
#'
#' @param training_dates training dates
#' @param actual_TL position of the actual training load
#' @param diff_dates difference in days
#'
#'
training_blocks <- function(training_dates,
actual_TL,
diff_dates
){
# Initialize variab... | /scratch/gouwar.j/cran-all/cranData/ACWR/R/utils.R |
# Ugly workaround to make foreach pass CRAN syntax check
#http://r.789695.n4.nabble.com/R-CMD-check-and-foreach-code-td4687660.html
globalVariables(c('fe_cType', 'fe_curGene'))
#' Use parallel missForest to impute missing values.
#' @description This wrapper is helpful because missForest crashes if you have more core... | /scratch/gouwar.j/cran-all/cranData/ADAPTS/R/MakeSigMatrix.R |
#' Hierarchical Deconvolution
#' @description Deconvolve cell types based on clusters detected by an n-pass spillover matrix
#'
#' @param sigMatrix The deconvolution matrix, e.g. LM22 or MGSM27
#' @param geneExpr The source gene expression matrix used to calculate sigMatrix
#' @param toPred The gene expression to ul... | /scratch/gouwar.j/cran-all/cranData/ADAPTS/R/onlyDeconAlgorithms.R |
#' Build a deconvolution seed matrix, add the proportional option
#' @description Use ranger to select features and build a genesInSeed gene matrix
#'
#' @param trainSet Each row is a gene, and each column is an example of a particular cell type, ie from single cell data
#' @param genesInSeed The maximum number of... | /scratch/gouwar.j/cran-all/cranData/ADAPTS/R/runLoops.R |
#' @importFrom foreach %do% %dopar% getDoParWorkers foreach
#' @importFrom stats na.omit t.test var
#' @importFrom utils tail
.onLoad <- function(libname, pkgname){
if (.Platform$OS.type == 'unix') {
doParallel::registerDoParallel(cores = parallel::detectCores())
options(mc.cores=parallel::detectCores())
... | /scratch/gouwar.j/cran-all/cranData/ADAPTS/R/zzz.R |
#' Power calculation for Biomarker-Informed Design with Hierarchical Model
#'
#' Given the Biomarker-Informed design information, returns the overall power and probability of the arm is selected as the winner.
#'
#' @usage
#' BioInfo.Power(uCtl, u0y, u0x, rhou, suy, sux, rho, sy, sx, Zalpha, N1, N, nArms, nSims)
#' @pa... | /scratch/gouwar.j/cran-all/cranData/ADCT/R/BID.R |
#' Power Calculation for Two Coprimary Endpoints.
#'
#' Given the group sequential design information, returns the overall power.
#'
#' @usage
#' CopriEndpt.Power(n, tau, mu1, mu2, rho, alpha1, alpha2, alternative)
#' @param n sample size for the design.
#' @param tau information time for the interim analysis.
#' @para... | /scratch/gouwar.j/cran-all/cranData/ADCT/R/CopriEndpt.R |
### lifetime.mle
## failure.threshold is the percentage
################################################################################
addt.fit=function(formula, data, initial.val=100, proc="All", failure.threshold, time.rti=100000, method="Nelder-Mead", subset, na.action, starts=NULL,fail.thres.vec=c(70,80), semi.co... | /scratch/gouwar.j/cran-all/cranData/ADDT/R/ADDT-package.R |
/scratch/gouwar.j/cran-all/cranData/ADER/R/ADER-internal.R | |
#################################################################
#
# File: ad.test.r
# Purpose: Implements the Anderson Darling GoF test
#
# Created: 20090625
# Author: Carlos J. Gil Bellosta
#
# Modifications:
#
#################################################################
ad.test <- fu... | /scratch/gouwar.j/cran-all/cranData/ADGofTest/R/ad.test.R |
#################################################################
#
# File: ad.test.pvalue.r
# Purpose: Gets the p-value for an Anderson Darling GoF test
#
# Created: 20090625
# Author: Carlos J. Gil Bellosta
#
# Modifications:
#
################################################################... | /scratch/gouwar.j/cran-all/cranData/ADGofTest/R/ad.test.pvalue.R |
#################################################################
#
# File: ad.test.statistic.r
# Purpose: Calculates the statistic for the Anderson Darling GoF test
#
# Created: 20090625
# Author: Carlos J. Gil Bellosta
#
# Modifications:
#
####################################################... | /scratch/gouwar.j/cran-all/cranData/ADGofTest/R/ad.test.statistic.R |
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' @keywords internal
#' @noRd
multipleinversion <- function(A, rho, L, R, lambda2) {
.Call('_ADMM_multipleinversion', PACKAGE = 'ADMM', A, rho, L, R, lambda2)
}
admm_tv <- function(b, xin... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/RcppExports.R |
#' ADMM : Algorithms using Alternating Direction Method of Multipliers
#'
#' An introduction of Alternating Direction Method of Multipliers (ADMM) method has been a breakthrough in
#' solving complex and non-convex optimization problems in a reasonably stable as well as scalable fashion.
#' Our package aims at providin... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm-package.R |
#' Basis Pursuit
#'
#' For an underdetermined system, Basis Pursuit
#' aims to find a sparse solution that solves
#' \deqn{\textrm{min}_x ~ \|x\|_1 \quad \textrm{s.t} \quad Ax=b}
#' which is a relaxed version of strict non-zero support finding problem.
#' The implementation is borrowed from Stephen Boyd's
#' \href{htt... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.bp.R |
#' Elastic Net Regularization
#'
#' Elastic Net regularization is a combination of \eqn{\ell_2} stability and
#' \eqn{\ell_1} sparsity constraint simulatenously solving the following,
#' \deqn{\textrm{min}_x ~ \frac{1}{2}\|Ax-b\|_2^2 + \lambda_1 \|x\|_1 + \lambda_2 \|x\|_2^2}
#' with nonnegative constraints \eqn{\lambd... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.enet.R |
#' Generalized LASSO
#'
#' Generalized LASSO is solving the following equation,
#' \deqn{\textrm{min}_x ~ \frac{1}{2}\|Ax-b\|_2^2 + \lambda \|Dx\|_1}
#' where the choice of regularization matrix \eqn{D} leads to different problem formulations.
#'
#' @param A an \eqn{(m\times n)} regressor matrix
#' @param b a length-\e... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.genlasso.R |
#' Least Absolute Deviations
#'
#' Least Absolute Deviations (LAD) is an alternative to traditional Least Sqaures by using cost function
#' \deqn{\textrm{min}_x ~ \|Ax-b\|_1}
#' to use \eqn{\ell_1} norm instead of square loss for robust estimation of coefficient.
#'
#' @param A an \eqn{(m\times n)} regressor matrix
#' ... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.lad.R |
#' Least Absolute Shrinkage and Selection Operator
#'
#' LASSO, or L1-regularized regression, is an optimization problem to solve
#' \deqn{\textrm{min}_x ~ \frac{1}{2}\|Ax-b\|_2^2 + \lambda \|x\|_1}
#' for sparsifying the coefficient vector \eqn{x}.
#' The implementation is borrowed from Stephen Boyd's
#' \href{https:/... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.lasso.R |
#' Robust Principal Component Analysis
#'
#' Given a data matrix \eqn{M}, it finds a decomposition
#' \deqn{\textrm{min}~\|L\|_*+\lambda \|S\|_1\quad \textrm{s.t.}\quad L+S=M}
#' where \eqn{\|L\|_*} represents a nuclear norm for a matrix \eqn{L} and
#' \eqn{\|S\|_1 = \sum |S_{i,j}|}, and \eqn{\lambda} a balancing/regul... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.rpca.R |
#' Semidefinite Programming
#'
#' We solve the following standard semidefinite programming (SDP) problem
#' \deqn{\textrm{min}_X ~ \textrm{tr}(CX)}
#' \deqn{\textrm{s.t.} A(X)=b, ~ X \geq 0 }
#' with \eqn{A(X)_i = \textrm{tr}(A_i^\top X) = b_i} for \eqn{i=1,\ldots,m} and \eqn{X \geq 0} stands for positive-definiteness ... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.sdp.R |
#' Sparse PCA
#'
#' @description Sparse Principal Component Analysis aims at finding a sparse vector by solving
#' \deqn{\textrm{max}_x~x^T\Sigma x \quad \textrm{s.t.} \quad \|x\|_2\le 1,~\|x\|_0\le K}
#' where \eqn{\|x\|_0} is the number of non-zero elements in a vector \eqn{x}. A convex relaxation
#' of this problem ... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.spca.R |
#' Total Variation Minimization
#'
#' 1-dimensional total variation minimization - also known as
#' signal denoising - is to solve the following
#' \deqn{\textrm{min}_x ~ \frac{1}{2}\|x-b\|_2^2 + \lambda \sum_i |x_{i+1}-x_i|}
#' for a given signal \eqn{b}.
#' The implementation is borrowed from Stephen Boyd's
#' \href{... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/admm.tv.R |
# CHECKERS ----------------------------------------------------------------
#' @keywords internal
#' @noRd
check_data_matrix <- function(A){
cond1 = (is.matrix(A)) # matrix
cond2 = (!(any(is.infinite(A))||any(is.na(A))))
if (cond1&&cond2){
return(TRUE)
} else {
return(FALSE)
}
}
#' @keywords interna... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/auxiliary.R |
.pkgenv <- new.env(parent = emptyenv())
.onAttach <- function(...){
## Retrieve Year Information
date <- date()
x <- regexpr("[0-9]{4}", date)
this.year <- substr(date, x[1], x[1] + attr(x, "match.length") - 1)
# Retrieve Current Version
this.version = utils::packageVersion("ADMM")
## Print on Screen
... | /scratch/gouwar.j/cran-all/cranData/ADMM/R/zzz.R |
## Matt Galloway
#' @title Penalized precision matrix estimation via ADMM
#'
#' @description Penalized precision matrix estimation using the ADMM algorithm.
#' Consider the case where \eqn{X_{1}, ..., X_{n}} are iid \eqn{N_{p}(\mu,
#' \Sigma)} and we are tasked with estimating the precision matrix,
#' denoted \eqn{\... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/R/ADMMsigma.R |
## Matt Galloway
#' @title Parallel CV (uses CV_ADMMc)
#' @description Parallel implementation of cross validation.
#'
#' @param X nxp data matrix. Each row corresponds to a single observation and each column contains n observations of a single feature/variable.
#' @param lam positive tuning parameters for elastic ne... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/R/Parallel.R |
## Matt Galloway
#' @title Ridge penalized precision matrix estimation
#'
#' @description Ridge penalized matrix estimation via closed-form solution. If one is only interested in the ridge penalty, this function will be faster and provide a more precise estimate than using \code{ADMMsigma}. \cr
#' Consider the case ... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/R/RIDGEsigma.R |
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' @title K fold (c++)
#' @description creates vector of shuffled indices.
#' @param n number of elements.
#' @param K number of folds.
#' @keywords internal
#'
NULL
#' @title CV ADMM penalize... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/R/RcppExports.R |
#' @useDynLib ADMMsigma
#' @importFrom Rcpp sourceCpp
#' @importFrom grDevices colorRampPalette
#' @importFrom stats cov
#' @importFrom parallel detectCores
#' @importFrom parallel makeCluster
#' @importFrom parallel stopCluster
#' @importFrom doParallel registerDoParallel
#' @importFrom dplyr summarise
#' @importFrom ... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/R/misc.R |
## ----setup, include=FALSE------------------------------------------------
knitr::opts_chunk$set(echo = TRUE)
| /scratch/gouwar.j/cran-all/cranData/ADMMsigma/inst/doc/Details.R |
---
title: "Precision Matrix Estimation via ADMM"
author: "Matt Galloway"
#date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
bibliography: lib.bib
vignette: >
%\VignetteIndexEntry{Precision Matrix Estimation via ADMM}
%\VignetteEngine{knitr::knitr}
%\usepackage[UTF-8]{inputenc}
---
```{r setup, include=FAL... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/inst/doc/Details.Rmd |
## ----setup, include=FALSE------------------------------------------------
knitr::opts_chunk$set(echo = TRUE)
## ---- message = FALSE, echo = TRUE, eval = FALSE-------------------------
#
# # oracle precision matrix
# Omega = matrix(0.9, ncol = 100, nrow = 100)
# diag(Omega = 1)
#
# # generate covariance matr... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/inst/doc/Simulations.R |
---
title: "Simulations"
author: "Matt Galloway"
#date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Simulations}
%\VignetteEngine{knitr::knitr}
%\usepackage[UTF-8]{inputenc}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
In the simulations below, we... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/inst/doc/Simulations.Rmd |
## ----setup, include=FALSE------------------------------------------------
knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
## ---- message = FALSE, echo = TRUE---------------------------------------
library(ADMMsigma)
# generate data from a sparse matrix
# first compute covariance matrix
S = matrix(0.7, nrow = 5, ... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/inst/doc/Tutorial.R |
---
title: " ADMMsigma Tutorial"
#author: "Matt Galloway"
#date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{ADMMsigma Tutorial}
%\VignetteEngine{knitr::knitr}
%\usepackage[UTF-8]{inputenc}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
```... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/inst/doc/Tutorial.Rmd |
---
title: "Precision Matrix Estimation via ADMM"
author: "Matt Galloway"
#date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
bibliography: lib.bib
vignette: >
%\VignetteIndexEntry{Precision Matrix Estimation via ADMM}
%\VignetteEngine{knitr::knitr}
%\usepackage[UTF-8]{inputenc}
---
```{r setup, include=FAL... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/vignettes/Details.Rmd |
---
title: "Simulations"
author: "Matt Galloway"
#date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Simulations}
%\VignetteEngine{knitr::knitr}
%\usepackage[UTF-8]{inputenc}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
In the simulations below, we... | /scratch/gouwar.j/cran-all/cranData/ADMMsigma/vignettes/Simulations.Rmd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.