content stringlengths 0 14.9M | filename stringlengths 44 136 |
|---|---|
#' R6 class to create and represent an event
#'
#' @examples
#' # This handler prints increases a counter in the state of the
#' # Simulation object, and schedule another event every 0.1 time unit.
#' handler = function(time, sim, agent) {
#' x = getState(sim)
#' x$counter = x$counter + 1
#' setState(sim, x)
#'... | /scratch/gouwar.j/cran-all/cranData/ABM/R/Event.R |
#' R6 class that represents a population
#'
#' A population is a collection of agents. There are two important tasks
#' for a population:
#' 1. to manage the agents in it
#' 2. to define the contact patterns of the agents
#'
#' The contact patterns are defined by objects of the Contact class that
#' are associa... | /scratch/gouwar.j/cran-all/cranData/ABM/R/Population.R |
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
newAgent <- function(state, death_time = NA_real_) {
.Call(`_ABM_newAgent`, state, death_time)
}
getID <- function(agent) {
.Call(`_ABM_getID`, agent)
}
getState <- function(agent) {
... | /scratch/gouwar.j/cran-all/cranData/ABM/R/RcppExports.R |
#' R6 class Create and represent a Simulation object
#'
#' The [Simulation] class inherits the [Population] class. So a simulation
#' manages agents and their contact. Thus, the class also inherits the
#' [Agent] class. So a simulation can have its own state, and events attached
#' (scheduled) to it. In addition, it... | /scratch/gouwar.j/cran-all/cranData/ABM/R/Simulation.R |
#' Creates an exponentially distributed waiting time
#'
#' @name newExpWaitingTime
#'
#' @param rate the rate of the exponential distribution
#'
#' @return an external pointer
#'
#' @details This function creates an C++ object of type ExpWaitingTime.
#' It can be passed to addTransition or Simulation$addTransition... | /scratch/gouwar.j/cran-all/cranData/ABM/R/Transition.R |
#' A function for calculating the Abnormal Blood Profile Score
#'
#' The \code{ABPS} function computes the Abnormal Blood Profile Score
#' from seven haematological markers. Higher values of this composite
#' score are associated with a higher likelihood of blood doping.
#'
#' @param haemdata a vector or data frame con... | /scratch/gouwar.j/cran-all/cranData/ABPS/R/ABPS.R |
#' function OFFscore
#'
#' The \code{OFFscore} function computes the value of the OFF-hr
#' score (or OFF score), a combination of the haemoglobin level and
#' the percentage of reticulocytes, used for detecting blood doping.
#'
#' @param haemdata a vector or data frame containing (at least) the 2
#' haematologic... | /scratch/gouwar.j/cran-all/cranData/ABPS/R/OFFscore.R |
#' Blood samples from an athlete convicted of doping.
#'
#' A dataset containing the result of the analysis of 13 blood samples,
#' taken over a period of 5 years, of a female athlete who was convicted
#' of doping on the basis of the Athlete Biological Passport.
#'
#' @format A data frame with 13 rows and 11 variables... | /scratch/gouwar.j/cran-all/cranData/ABPS/R/data.R |
#'@title Data Preparation
#' @description Data preparation for ABCoxPH
#' @param data Raw data sets
#' @param t_int No of days to be considered as single time interval (Default value: 90)
#' @param max_lac Maximum no of lactation to be considered for data preparation (Default value: Max Lactation)
#' @import stats read... | /scratch/gouwar.j/cran-all/cranData/ABSurvTDC/R/ABSurvTDC.R |
#' This is the workhorse function of the ACA. It detects significant change-points in serial data.
#' @param namefi - a character string specifying the data file to be loaded
#' @param xleg - character. The x-label of the plot
#' @param yleg - character. The y-label of the plot
#' @param titl - character. The title o... | /scratch/gouwar.j/cran-all/cranData/ACA/R/SDScan.R |
#' Dataset amorese.data.txt
#'
#' This data set is a small simulated time series to test the \code{ACA}
#' package.
#'
#' @name amorese.data.txt
#'
#' @format This data set contains 2 columns. The first column is an index,
#' from 1 to 410. The second column are the values of a synthetic
#' combination of normal di... | /scratch/gouwar.j/cran-all/cranData/ACA/R/extdata_amorese.R |
#' Dataset soccer.data.txt
#'
#' This data set is a small time series to test the \code{ACA} package.
#'
#' @name soccer.data.txt
#'
#' @format This data set contains 2 columns. The first column is the
#' football season year. The second column is the average goals-per-game
#' in each season. Data are derived from a... | /scratch/gouwar.j/cran-all/cranData/ACA/R/extdata_soccer.R |
acdFit <- function(durations = NULL, model = "ACD", dist = "exponential",
order = NULL, startPara = NULL, dailyRestart = 0, optimFnc = "optim",
method = "Nelder-Mead", output = TRUE, bootstrapErrors = FALSE,
forceErrExpec = TRUE, fixedParamPos = NULL, bp = NU... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/acdFit.R |
coef.acdFit <- function(object, returnCoef = "all", ...){
returnCoef <- match.arg(returnCoef, c("all", "distribution", "model"))
switch(returnCoef,
all = c(object$mPara, object$dPara),
distribution = object$dPara,
model = object$mPara)
}
re... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/acdFitClassMethods.R |
acf_acd <- function(fitModel = NULL, conf_level = 0.95, max = 50, min = 1){
lag <- acf <- NULL
if("acdFit" %in% class(fitModel)){
dur <- fitModel$durations$durations
adjDur <- fitModel$durations$adjDur
resi <- fitModel$residuals
} else if("data.frame" %in% class(fitModel)){
dur <- fitModel$du... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/acf_acd.R |
computeDurations <- function(transactions, open = "10:00:00", close = "18:25:00", rm0dur = TRUE, type = "trade", priceDiff = .1, cumVol = 10000){
open <- as.POSIXlt(strptime(open, "%H:%M:%S"))
open <- open$h * 3600 + open$min * 60 + open$sec
close <- as.POSIXlt(strptime(close, "%H:%M:%S"))
close <- close$... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/computeDurations.R |
dburr <- function(x, theta = 1, kappa = 1.2, sig2 = .3, forceExpectation = F){
if(forceExpectation) theta <- ((gamma(1+1/kappa)*gamma(1/sig2 - 1/kappa))/(sig2^(1+1/kappa)*gamma(1/sig2+1)))^(kappa)
retrunValue <- theta * kappa * x^(kappa - 1)
retrunValue <- retrunValue / (1+ sig2 * theta * x^kappa)^(1/sig2 + 1)... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/distributions.R |
diurnalAdj <- function(dur, method = "cubicSpline", nodes = c(seq(600, 1105, 60), 1105), aggregation = "all", span = "cv", spar = 0, Q = 4, returnSplineFnc = FALSE){
durations <- spline.x <- spline.y <- day <- x <- y <- time <- NULL
if(!("POSIXlt" %in% class(dur$time))) dur$time <- as.POSIXlt(dur$time)
#... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/diurnalAdj.R |
.getLLcall <- function(param, dur, exogenousVar = NULL, model, order, mean = mean(dur), distCode = 1,
newDay = c(0), returnMu = TRUE, breakPoints = NULL, forceErrExpec = 1,
fixedParam = NULL, fixedParamPos = NULL, trace = 0){
#combines the param and fixedParam into t... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/getLL.R |
ACDmGlobalEnv <- new.env()
assign("ACDmOptimTrace", NULL, envir = ACDmGlobalEnv)
.getDistCode<- function(dist){
if(dist == "exponential"){
.getDistCode <- 1
} else if(dist == "weibull"){
.getDistCode <- 2
} else if(dist == "burr"){
.getDistCode <- 3
} else if(dist == "gengamma"){
.getDistCod... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/internals.R |
plotDescTrans <- function(trans, windowunit = "hours", window = 1){
volume <- price <- n <- transactions <- time <- NULL
windowunit <- match.arg(windowunit, c("secs", "mins", "hours", "days"))
if(!("POSIXlt" %in% class(trans$time))) trans$time <- as.POSIXlt(trans$time)
timeInterval <- switch(windowunit... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/plotDescTrans.R |
plotHazard <- function(fitModel, breaks = 20, implied = TRUE, xstop = NULL){
hazard <- residual <- errorTerm <- NULL
if("acdFit" %in% class(fitModel)){
e <- stats::quantile(fitModel$residuals, seq(0, 1 - 1/breaks, 1/breaks))
h <- (1/breaks)/(1-1:(breaks-1)/breaks+1/(2*breaks))*(1/(e[2:breaks]-e[1:... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/plotHazard.R |
plotHistAcd <- function(durations, windowunit = "mins", window = 1){
time <- NULL
if(!("POSIXlt" %in% class(durations$time))) durations$time <- as.POSIXlt(durations$time)
windowunit <- match.arg(windowunit, c("secs", "mins", "hours", "days"))
timefactor <- switch(windowunit,
secs... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/plotHistAcd.R |
plotLL <- function(fitModel, parameter1 = 1, parameter2 = NULL, param1sequence, param2sequence, startpoint = NULL,
returnOutput = FALSE){
logLikelihood <- NULL
parameters <- parameter1
if(length(parameter2) != 0) parameters <- c(parameters, parameter2)
#checks if the parameters were cor... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/plotLL.R |
plotRollMeanAcd <- function(durations, window = 500){
rollingMeans <- group <- NULL
dur <- durations$durations
time <- durations$time[(window):length(dur)]
if(!("POSIXlt" %in% class(time))) time <- as.POSIXlt(time)
df <- data.frame(time = time, rollingMeans = zoo::rollmean(dur,window), group = time... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/plotRollMeanAcd.R |
plotScatterAcd <- function(fitModel, x = "muHats", y = "residuals", xlag = 0, ylag = 0,
colour = NULL, xlim = NULL, ylim = NULL, alpha = 1/10,
smoothMethod = "auto"){
x <- match.arg(x, c("muHats", "residuals", "durations", "adjDur", "dayTime", "time", "index"... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/plotScatterAcd.R |
qqplotAcd <- function(fitModel, xlim = NULL, ylim = NULL){
residuals <- NULL
df <- data.frame(residuals = fitModel$residuals)
if(fitModel$distribution == "exponential"){
g <- ggplot(df, aes(sample=residuals)) + stat_qq(distribution = stats::qexp, geom="point")
if(length(xlim) != 0) g <- g + xlim(x... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/qqplotAcd.R |
resiDensityAcd <- function(fitModel, xlim = NULL, binwidth = .1, density = FALSE){
..density.. <- dexp <- dweibull <- residuals <- NULL
df <- data.frame(residuals = fitModel$residuals)
#sets the PDF function for the assumed distribution:
distFnc <- switch(fitModel$distribution,
"... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/resiDensityAcd.R |
sim_ACD <- function(N = 1000,
model = "ACD",
dist = "exponential",
param = NULL,
order = NULL,
Nburn = 50,
startX = c(1),
startMu = c(1),
errors = NULL,
... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/sim_ACD.R |
standardizeResi <- function(fitModel, transformation = "probIntegral"){
if(!("acdFit" %in% class(fitModel))) stop("fitModel is not of class 'acdFit'")
transformation <- match.arg(transformation, c("probIntegral", "cox-snell"))
if(fitModel$distribution == "exponential"){
returnValue <- stats::p... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/standardizeResi.R |
testRmACD <- function(fitModel, pStar = 2, robust = TRUE){
if(fitModel$model != "ACD" || fitModel$distribution != "exponential") stop("this test only works if the model estimated is a standard ACD model.")
#initiates variables:
p <- fitModel$order[1]
q <- fitModel$order[2]
if(length(fitModel$durations$ad... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/testRmACD.R |
testSTACD<-function(fitModel, K = 2, robust = TRUE){
if(fitModel$model != "ACD" || fitModel$distribution != "exponential") stop("this test only works if the model estimated is a standard ACD model.")
#initiates variables:
p <- fitModel$order[1]
q <- fitModel$order[2]
if(length(fitModel$durations$adjDu... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/testSTACD.R |
testTVACD <- function(fitModel, K = 2, type = "total", robust = TRUE){
if(fitModel$model != "ACD" || fitModel$distribution != "exponential") stop("this test only works if the model estimated is a standard ACD model.")
if(length(fitModel$durations$time) == 0) stop("this test requires 'fitModel' to have been estima... | /scratch/gouwar.j/cran-all/cranData/ACDm/R/testTVACD.R |
#' @title Analysis of Correlated High-Dimensional Expression (ACE) Data
#' @description A function for estimating factor models, giving factor-adjusted statistics.
#'
#' @param Z The observed data matrix with the variables in rows and samples in columns. It is a \eqn{p}-by-\eqn{n_1} matrix.
#' @param X (Optional) The o... | /scratch/gouwar.j/cran-all/cranData/ACE.CoCo/R/ACE.R |
#' @title Coleccion de notas.
#' @description Contiene colecciones de notas de distintos
#' portales noticiosos (una muestra corta).
#' Una segunda coleccion es de notas del periodico bahiense La Nueva.
#' Tambien tiene resumenes estadisticos de las bases completas
#' para el desarrollo de los ejemplos de las funciones... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_bases.R |
#' @title Limpieza de texto.
#' @description Funcion que limpia y normaliza las notas/textos.
#' @param x vector de textos al que se le aplica la
#' funcion de limpieza de texto.
#' @param rm_hashtag remueve los hashtags.
#' @param rm_emoji remueve los emojis.
#' @param rm_punt remueve la puntuacion.
#' @param rm_num r... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_clean.R |
#' @title Frecuencia, menciones e intensidad.
#' @description Funcion que usa las funciones acep_frec, acep_men y acep_int y
#' devuelve una tabla con tres columnas nuevas: numero de palabras,
#' numero de menciones del diccionario, indice de intensidad.
#' @param db data frame con los textos a procesar.
#' @param t co... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_db.R |
#' @title Deteccion de menciones de palabras.
#' @description Funcion que detecta de menciones de palabras que
#' refieren a conflictos en cada una de las notas/textos.
#' @param x vector de textos al que se le aplica la funcion de
#' deteccion de menciones de palabras del diccionario.
#' @param y vector de palabras de... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_detect.R |
#' @title Coleccion de diccionarios.
#' @description Coleccion de diccionarios que reune diccionarios
#' de diferentes origenes. El diccionario dicc_confl_acep fueron construidos
#' en el marco del Observatorio de Conflictividad de la UNMdP.
#' Los diccionarios dicc_confl_gp y dicc_viol_gp fueron extraidos de
#' Albrie... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_diccionarios.R |
#' @title Frecuencia de palabras totales.
#' @description Funcion que cuenta la frecuencia de palabras totales
#' en cada una de las notas/textos.
#' @param x vector de textos al que se le aplica la funcion de conteo
#' de la frecuencia de palabras.
#' @keywords indicadores
#' @export acep_frec
#' @return Si todas las ... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_frec.R |
#' @title Indice de intensidad.
#' @description Funcion que elabora un indice de intensidad en
#' base a la relacion entre palabras totales y palabras del diccionario
#' presentes en el texto.
#' @param pc vector numerico con la frecuencia de palabras conflictivas
#' presentes en cada texto.
#' @param pt vector de pala... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_int.R |
#' @title Carga bases de datos creadas por el Observatorio.
#' @description Funcion para cargar bases de datos disponibles online.
#' Por ahora estan disponibles las siguientes bases: Revista Puerto 'rp_mdp';
#' La Nueva 'ln_bb', La Capital 'lc_mdp', Ecos Diarios 'ed_neco',
#' La Nacion 'ln_arg'
#' @param tag etiqueta ... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_load_base.R |
#' @title Frecuencia de menciones de palabras.
#' @description Funcion que cuenta la frecuencia de menciones de
#' palabras que refieren a conflictos en cada una de las notas/textos.
#' @param x vector de textos al que se le aplica la funcion de conteo
#' de la frecuencia de menciones de palabras del diccionario.
#' @p... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_men.R |
#' @title Resumen visual de la serie temporal de los indices de conflictividad.
#' @description Funcion que devuelve un panel visual de cuatro graficos
#' de barras con variables proxy de los indices de conflictividad agrupados
#' por segmento de tiempo.
#' @param datos data frame con datos procesados.
#' @param tagx o... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_plot_rst.R |
#' @title Grafico de barras de la serie temporal de indices de conflictividad.
#' @description Funcion que devuelve un grafico de barras con la serie
#' temporal de indices de conflictividad por dia, mes o anio.
#' @param x vector de valores del eje x (por ejemplo, fechas).
#' @param y vector de valores numericos del e... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_plot_st.R |
#' @title Cadenas de caracteres para limpiar y normalizar textos.
#' @description Cadenas de caracteres y expresiones regulares
#' para limpiar y normalizar textos.
#' @format Son cadenas de caracteres.
#'\describe{
#' \item{stopwords}{es un string de palabras vacias.}
#' \item{dias}{es un string de dias.}
#' \item{mes... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_rs.R |
#' @title Serie temporal de indices de conflictividad.
#' @description Funcion que devuelve los indices de conflictividad
#' agrupados por segmento de tiempo: dia, mes, anio.
#' @param datos data frame con los textos a procesar.
#' @param fecha columna de data frame que contiene el
#' vector de fechas en formato date.
... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_rst.R |
#' @title Tokenizador.
#' @description Funcion que tokeniza las notas/textos.
#' @param x vector de textos al que se le aplica la funcion de tokenizacion.
#' @param tolower convierte los textos a minusculas.
#' @keywords tokenizar
#' @examples
#' acep_token("Huelga de obreros del pescado en el puerto")
#' @export
acep... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_token.R |
#' @title Grafico de barras de palabras mas recurrentes en un corpus.
#' @description Funcion que devuelve un grafico de barras con las palabras
#' mas recurrentes en un corpus textual.
#' @param x vector de palabras tokenizadas.
#' @param u numero de corte para el top de palabras mas frecuentes.
#' @param frec paramet... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_token_plot.R |
#' @title Tabla de frecuencia de palabras tokenizadas.
#' @description Funcion que cuenta la frecuencia de palabras tokenizadas.
#' @param x vector de palabras tokenizadas.
#' @param u numero de corte para el top de palabras mas frecuentes.
#' @export acep_token_table
#' @return Si todas las entradas son correctas,
#' ... | /scratch/gouwar.j/cran-all/cranData/ACEP/R/acep_token_table.R |
#' Returns the status of the ACE
#'
#' @param connection connection object returned from connect(url) function
#' @return data frame containing patient IDs and time intervals (optional)
#'
#' @examples
#' \dontrun{ACEsearch.status(ACEsearch.connect('http://localhost:8080'))}
#'
#'
ACEsearch.status <- function(connectio... | /scratch/gouwar.j/cran-all/cranData/ACEsearch/R/api.R |
#' Connects to ACE instance
#'
#' Attempts to connect to ACE instance using URL:PORT
#' @param url url address of a running ACE instance, usually containing port information
#' @return data frame containing connection information used for all other accessory functions
#'
#' @examples
#' \dontrun{ACEsearch.connect("http... | /scratch/gouwar.j/cran-all/cranData/ACEsearch/R/connect.R |
#' Queries ACE and returns a list of patient IDs
#'
#' @param connection connection object returned from connect(url) function
#' @param query ACE query
#' @param output_time equivalent to wrapping the query in OUTPUT() command. Togerther with patient IDs outputs each
#' time interval in patient's ti... | /scratch/gouwar.j/cran-all/cranData/ACEsearch/R/query.R |
#' rmvn
#' @keywords internal
#' @param n Sample Size
#' @param sigma Covariance matrix
#' @return Generates multivariate normal data from a covariance matrix (\code{sigma}) of length \code{n}
#'
rmvn <- function(n,sigma) {
Sh <- with(svd(sigma),
v%*%diag(sqrt(d))%*%t(u))
matrix(stats::rnorm(n... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/R/Internal.R |
#' Power_LS
#' @description The function is designed for calculating the power of heritability estimation from ACE models given the parameter settings. Or calculate one of the parameter settings (N,R,h2,c2) given the rest of known parameters.
#' This power calculator is made based on the Least Squares theory and follow... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/R/Power_LS.R |
#' Sim_Fit
#' @description A function to simulate a set of kin pair data and fit them with ACE models. Can be helpful with checking model performance for a given parameter setting.
#' @param GroupNames A character vector specifying two names of the simulated kin pairs
#' @param GroupSizes A numeric vector specifying tw... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/R/Sim_Fit.R |
#' fit_uniACE
#' @description Use OpenMx to quickly fit a univariate ACE model
#' @import OpenMx
#' @param data_1 A n by 2 \code{data.frame} consisting of the group1 kin pairs
#' @param data_2 A n by 2 \code{data.frame} consisting of the group2 kin pairs
#' @param GroupRel A numeric vector specifying two genetic relate... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/R/fit_uniACE.R |
#' kinsim_double
#' @description The function to generate two groups of univariate kin pair(e.g., both MZ and DZ twins) data using a multivariate norm approach, given the ACE components.
#' \cr
#' \cr
#' Two approaches can be selected: a) simulate two groups of kin pairs using the genetic relatedness directly b) simula... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/R/kinsim_double.R |
#' kinsim_single
#' @description The function to generate one group of univariate kin pair (e.g., only DZ twins) data using a multivariate norm approach, given the ACE components.
#' @param name Assigned name for the simulated group of kin pairs
#' @param Rel Genetic relatedness of the simulated kin pairs
#' @param r_c... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/R/kinsim_single.R |
## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup--------------------------------------------------------------------
library(ACEsimFit)
## ----simulation-----------------------------------------------------------... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/inst/doc/ACEsimFit.R |
---
title: "ACEsimFit"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{ACEsimFit}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(ACEsimFit)
```
## Overview
This pack... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/inst/doc/ACEsimFit.Rmd |
---
title: "ACEsimFit"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{ACEsimFit}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(ACEsimFit)
```
## Overview
This pack... | /scratch/gouwar.j/cran-all/cranData/ACEsimFit/vignettes/ACEsimFit.Rmd |
AtCtEt <-
function(data_m, data_d, mod = c('d','d','d'), knot_a=5, knot_c=5, knot_e=5, loc = c('e','e','e'), boot=FALSE, num_b = 100, init = rep(0,3), robust = 0)
{
pheno_m <- c(t(data_m[,1:2]))
pheno_d <- c(t(data_d[,1:2]))
T_m <- rep(data_m[,3], each=2)
T_d <- rep(data_d[,3], each=2)
mag <- var(pheno_m)
init_max <-... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/AtCtEt.R |
AtCtEt_boot <- function(res, model, data_m, data_d, knot_a, knot_c, knot_e, loc, B=100,alpha=0.05,m=500)
{
spline.main <- sp.spline.estimator(data_m, data_d, model, knot_a, knot_c, knot_e, loc, m)
spline.boots_a <- matrix(NA,m,B)
spline.boots_c <- matrix(NA,m,B)
spline.boots_e <- matrix(NA,m,B)
spline.boots_h <- matrix... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/AtCtEt_boot.R |
loglik_AtCtEt_epsp <-
function(param, pheno_m, pheno_d, B_des_a_m, B_des_a_d, beta_a, D_a, B_des_c_m, B_des_c_d, beta_c, D_c, B_des_e_m, B_des_e_d, beta_e, D_e)
{
var_b_a <- param[1]
var_b_c <- param[2]
var_b_e <- param[3]
nll <- .Call('loglik_AtCtEt_epsp_c', var_b_a, var_b_c, var_b_e, pheno_m, pheno_d, B_des_a_m, B_d... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/AtCtEt_epsp.R |
loglik_AtCtEt_esp <-
function(param, pheno_m, pheno_d, B_des_a_m, B_des_a_d, B_des_c_m, B_des_c_d, B_des_e_m, B_des_e_d)
{
beta_a <- param[1:ncol(B_des_a_m)]
beta_c <- param[(1+ncol(B_des_a_m)):(ncol(B_des_c_m)+ncol(B_des_a_m))]
beta_e <- param[(1+ncol(B_des_a_m)+ncol(B_des_c_m)):(ncol(B_des_e_m)+ncol(B_des_c_m)+ncol(... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/AtCtEt_esp.R |
AtCtEtp <-
function(data_m, data_d, knot_a=8, knot_c=8, knot_e=8, eps = 0.1, mod=c('d','d','d'), robust=0)
{
if((is.vector(mod)==FALSE) | (length(mod)!=3) )
{stop('The \'mod\' argument must be a vector of length 3.')}
if(!(mod[1] %in% c('d','c','l')))
{stop('The \'mod\' argument for the A component must be \'d\'(dyna... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/AtCtEtp.R |
AtCtEtp_2 <-
function(data_m, data_d, knot_a=8, knot_c=8, knot_e=8, eps = 0.1, mod=c('d','d','d'), robust=2)
{
if((is.vector(mod)==FALSE) | (length(mod)!=3) )
{stop('The model parameter must be a vector of length 3.')}
if(!(mod[1] %in% c('d','c','l')))
{stop('The \'mod\' parameter for the A component must be \'d\'(dy... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/AtCtEtp_2.R |
AtDtEt <-
function(data_m, data_d, mod = c('d','d','d'), knot_a=5, knot_d=5, knot_e=5, loc = c('e','e','e'), boot=FALSE, num_b = 100, init = rep(0,3), robust = 0)
{
pheno_m <- c(t(data_m[,1:2]))
pheno_d <- c(t(data_d[,1:2]))
T_m <- rep(data_m[,3], each=2)
T_d <- rep(data_d[,3], each=2)
... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/AtDtEt.R |
acetp_mcmc <- function(acetp, iter_num = 10000, sd = 0.1, burnin =1000)
{
if(!(class(acetp) %in% c('AtCtEp_model','AtEtp_model','AtCtEtp_model')))
{
stop('The first parameter must be an acetp object.')
}
if(burnin >= iter_num)
{
stop('The number of burnins must be smaller than the number of MCMC iterations.... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/acetp_mcmc.R |
mcmc_epsp <-
function(pheno_m, pheno_d, B_des_a_m, B_des_a_d, B_des_c_m, B_des_c_d, var, var_b_a, var_b_c, D_a, D_c, iter=10000, burn=500, sd=0.1)
{
num_m <- length(pheno_m)
num_d <- length(pheno_d)
num_a <- ncol(B_des_a_m)
num_c <- ncol(B_des_c_m)
B_a_m <- t(B_des_a_m)
B_a_d <- t(B_des_a_d)
B_c_m <- t(B_des_c_m)
B_c... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/mcmc_epsp.R |
plot_AtCtEt <- function(AtCtEt, boot=FALSE, xlab, ylab, main, col, legend)
{
# if(class(AtCtEt)!='AtCtEt_model')
if(!is(AtCtEt,'AtCtEt_model'))
{
stop('The first parameter must be an object obtained from the AtCtEt function.')
}
if(boot==TRUE)
{
if(is.null(AtCtEt$boot)==TRUE)
{
stop('Please first run th... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/plot_AtCtEt.R |
plot_AtCtEt_h <- function(AtCtEt, boot=FALSE, xlab, ylab, main, col)
{
# if((class(AtCtEt)!='AtCtEt_model')&(class(AtCtEt)!='AtCtEtp_mc_model'))
if(!(class(AtCtEt)%in%c('AtCtEt_model','AtCtEtp_mc_model')))
{
stop('The first parameter must be an object obtained from the AtCtEt or acetp_mcmc function.')
}
# if((... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/plot_AtCtEt_h.R |
plot_AtCtEtp <- function(AtCtEtp_mcmc, xlab, ylab, main, col, legend)
{
#if(class(AtCtEtp_mcmc)!='AtCtEtp_mc_model')
if(!is(AtCtEtp_mcmc,'AtCtEtp_mc_model'))
{
stop('The first parameter must be an object obtained from the acetp_mcmc function.')
}
model_cur <- AtCtEtp_mcmc
#pheno_m <- c(t(data_m[,1:2]))
#ph... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/plot_AtCtEtp.R |
plot_acet <- function(acet, boot = FALSE, heri = FALSE, xlab, ylab, main, col, legend = TRUE)
{
if(!(class(acet) %in% c('AtCtEt_model', 'AtDtEt_model', 'AtCtEp_mc_model','AtEtp_mc_model','AtCtEtp_mc_model')))
{
stop('The first argument must be an AtCtEt_model, AtDtEt_model, or AtCtEtp_mc_model object.')
}
if(... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/plot_acet.R |
test_acetp <-
function(acetp, comp, sim = 100, robust = 0, pe = TRUE, verbose = TRUE)
{
if(!(class(acetp) %in% c('AtCtEtp_model')))
{
stop('The first parameter must be an acetp object.')
}
if(!(comp %in% c('a','c','e')))
{
stop('The variable \'comp\' must be \'a\',\'c\' or \'e\' to specify which component to ... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/test_acetp.R |
test_acetp_2 <-
function(acetp, comp)
{
# re <- acetp_mcmc_2(acetp,iter_num=iter_num, sd = 0.05, burnin=1000)
order <- 3
penal_a <- 2
penal_c <- 2
penal_e <- 2
if(acetp$mod[1]=='c')
{penal_a <- 1}
if(acetp$mod[2]=='c')
{penal_c <- 1}
if(acetp$mod[3]=='c')
{penal... | /scratch/gouwar.j/cran-all/cranData/ACEt/R/test_acetp_2.R |
## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----eval=FALSE---------------------------------------------------------------
# install.packages("ACEt")
## ----eval=FALSE--------------------------------------------------... | /scratch/gouwar.j/cran-all/cranData/ACEt/inst/doc/acet-vignette.R |
---
title: 'ACEt: An R package for estimating dynamic heritability and twin model comparison'
author: "Liang He"
date: '`r Sys.Date()`'
output:
html_document:
toc: yes
fig_caption: yes
md_document:
toc: yes
bibliography: bibliography.bib
vignette: |
%\VignetteIndexEntry{User guide for ACEt}
%\Vig... | /scratch/gouwar.j/cran-all/cranData/ACEt/inst/doc/acet-vignette.Rmd |
---
title: 'ACEt: An R package for estimating dynamic heritability and twin model comparison'
author: "Liang He"
date: '`r Sys.Date()`'
output:
html_document:
toc: yes
fig_caption: yes
md_document:
toc: yes
bibliography: bibliography.bib
vignette: |
%\VignetteIndexEntry{User guide for ACEt}
%\Vig... | /scratch/gouwar.j/cran-all/cranData/ACEt/vignettes/acet-vignette.Rmd |
## covr: skip=all
## Look for existing generic functions also in imported namespaces.
## This will affect whether setGenericS3() creates a generic function
## or not.
options("R.methodsS3:checkImports:setGenericS3"=TRUE)
| /scratch/gouwar.j/cran-all/cranData/ACNE/R/000.R |
###########################################################################/**
# @RdocDocumentation "Non-documented objects"
#
# % Other missing docs
# @eval "t <- readLines('../incl/999.missingdocs.txt'); t <- trim(unlist(strsplit(t, split=' '))); t <- t[nchar(t) > 0]; t2 <- gsub('\\[', '\\\\[', t); t <- unique(t); t ... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/999.NonDocumentedObjects.R |
#########################################################################/**
# @RdocPackage ACNE
#
# \description{
# @eval "getDescription(ACNE)"
# }
#
# \section{Installation and updates}{
# This package requires the \pkg{aroma.affymetrix} package.
# To install this package, do:
# \code{install.packages("ACNE"... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/999.package.R |
###########################################################################/**
# @RdocClass NmfPlm
#
# @title "The NmfPlm class"
#
# \description{
# @classhierarchy
#
# This class represents the NMF model of [REF].
# }
#
# @synopsis
#
# \arguments{
# \item{...}{Arguments passed to @see "aroma.affymetrix::ProbeLevel... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/NmfPlm.R |
###########################################################################/**
# @RdocClass NmfSnpPlm
#
# @title "The NmfSnpPlm class"
#
# \description{
# @classhierarchy
# }
#
# @synopsis
#
# \arguments{
# \item{...}{Arguments passed to @see "NmfPlm".}
# \item{mergeStrands}{If @TRUE, the sense and the anti-sense... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/NmfSnpPlm.R |
###########################################################################/**
# @set "class=SnpNmfFit"
# @RdocMethod plot
#
# @title "Generates a multi-panel plot summarizing the NMF SNP fit"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{lim, cnLim, epsLim}{The plot ranges for the probe... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/SnpNmfFit.plot.R |
###########################################################################/**
# @RdocFunction WHInit
#
# @title "Initialization of the W and H matrices"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{V}{An KxI @matrix where I is the number of arrays and
# K is the number of probes whe... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/WHInit.R |
###########################################################################/**
# @RdocDefault doACNE
# @alias doACNE.AffymetrixCelSet
#
# @title "(ACNE)"
#
# \description{
# @get "title" based on [1].
# The algorithm is processed in bounded memory, meaning virtually
# any number of arrays can be analyzed on also ver... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/doACNE.R |
###########################################################################/**
# @RdocFunction fitSnpNmf
#
# @title "Non-negative matrix factorization (NMF) of a matrix containing SNP probe signals"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{V}{An KxI @matrix where I is the number of ... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/fitSnpNmf.R |
###########################################################################/**
# @RdocFunction fitSnpNmfArray
#
# @title "Allele-specific copy number estimation using non-negative matrix factorization (NMF)"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{Y}{An Lx2xI @array where L is numb... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/fitSnpNmfArray.R |
miqr.solve <- function(a, b) {
x <- tryCatch({
qr.solve(a, b);
}, error = function(e) {
e;
}, finally = "");
if (!is.matrix(x)) {
x <- ginv(a) %*% b;
}
x;
} # miqr.solve()
| /scratch/gouwar.j/cran-all/cranData/ACNE/R/miqr.solve.R |
plotFreqB <- function(pos, freqB, pch=176, ylim=c(0,1), xlab="Position (Mb)", ylab=expression(beta == theta[B]/(theta[A]+theta[B]))) {
xlim <- range(pos, na.rm=TRUE);
scale <- 0.04*diff(xlim);
xlim[1] <- xlim[1] - 3*scale;
xlim[2] <- xlim[2] + 1*scale;
x0 <- xlim[1];
# Plot raw data
plot(pos, freqB, pch=... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/plotFreqB.R |
###########################################################################/**
# @RdocFunction pseudoinverse
#
# @title "Calculates the pseudo inverse of a matrix"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{X}{A @numeric @matrix.}
# \item{...}{Not used.}
# }
#
# \value{
# Returns a... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/pseudoinverse.R |
###########################################################################/**
# @RdocFunction removeOutliers
#
# @title "Removes outliers in matrix containing SNP signals"
#
# \description{
# @get "title" by identifying outlier elements. The values of the
# elements that are outliers are substituted by correspond... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/removeOutliers.R |
###########################################################################/**
# @RdocFunction robustHInit
#
# @title "Robust initialization of the H (copy number) matrix"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{V}{An KxI @matrix where I is the number of arrays and K is the
# n... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/robustHInit.R |
###########################################################################/**
# @RdocFunction robustWInit
#
# @title "Robust initialization of the W (affinity) matrix"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{V}{An KxI @matrix where I is the number of arrays and K is the
# numb... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/robustWInit.R |
###########################################################################/**
# @RdocFunction snpArrayToMatrix
# @alias snpMatrixToArray
#
# @title "Reshapes SNP data in matrix form to array form and vice versa"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{Y}{A 2LxI @matrix or a Lx2xI ... | /scratch/gouwar.j/cran-all/cranData/ACNE/R/snpArrayToMatrix.R |
## covr: skip=all
.onLoad <- function(libname, pkgname) {
ns <- getNamespace(pkgname)
pkg <- Package(pkgname)
assign(pkgname, pkg, envir=ns)
}
.onAttach <- function(libname, pkgname) {
pkg <- get(pkgname, envir=getNamespace(pkgname))
startupMessage(pkg)
}
| /scratch/gouwar.j/cran-all/cranData/ACNE/R/zzz.R |
##########################################################################
# Data set:
# GSE8605/
# Mapping10K_Xba142/
# GSM226867.CEL, ..., GSM226876.CEL [10 files]
# URL: http://www.ncbi.nlm.nih.gov/projects/geo/query/acc.cgi?acc=GSE8605
##########################################################################
... | /scratch/gouwar.j/cran-all/cranData/ACNE/inst/testScripts/system/chipTypes/Mapping10K_Xba142/test20090128,10K,NMF.R |
##########################################################################
# Data set:
# GSE8605/
# Mapping10K_Xba142/
# GSM226867.CEL, ..., GSM226876.CEL [10 files]
# URL: http://www.ncbi.nlm.nih.gov/projects/geo/query/acc.cgi?acc=GSE8605
##########################################################################
... | /scratch/gouwar.j/cran-all/cranData/ACNE/inst/testScripts/system/chipTypes/Mapping10K_Xba142/test20100517,10K,doACNE.R |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.