content
stringlengths
0
14.9M
filename
stringlengths
44
136
#' A3 Results for Arbitrary Model #' #' This function calculates the A3 results for an arbitrary model construction algorithm (e.g. Linear Regressions, Support Vector Machines or Random Forests). For linear regression models, you may use the \code{\link{a3.lm}} convenience function. #' #' @param formula the regression...
/scratch/gouwar.j/cran-all/cranData/A3/R/A3.R
#' Boston Housing Prices #' #' A dataset containing the prices of houses in the Boston region and a number of features. #' The dataset and the following description is based on that provided by UCI Machine Learning Repository (\url{http://archive.ics.uci.edu/ml/datasets/Housing}). #' #' \itemize{ #' \item CRIME: Pe...
/scratch/gouwar.j/cran-all/cranData/A3/R/A3.data.R
############################# # bootstrapped bias score computation #' @title Compute bootstrapped approach-bias scores #' @description Compute bootstrapped approach-bias scores with confidence intervals. #' @param ds a longformat data.frame #' @param subjvar Quoted name of the participant identifier column #' @param p...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/aat_bootstrap.R
#' @title Compute simple AAT scores #' @description Compute simple AAT scores, with optional outlier exclusion and error trial recoding. #' @param ds a long-format data.frame #' @param subjvar column name of subject variable #' @param pullvar column name of pull/push indicator variable, must be numeric or logical (whe...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/aat_compute.R
#' Compute stimulus-specific bias scores #' Computes mean single-difference scores (push - pull) for each stimulus. #' #' @param ds the \code{data.frame} to use #' @param subjvar Name of the subject-identifying variable #' @param stimvar Name of the stimulus-identifying variable #' @param pullvar Name of the movement...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/aat_covreliability.R
#' Simulate AAT datasets and predict parameters #' #' \code{aat_simulate()} generates approach-avoidance task datasets. #' #' @param npps Number of participants #' @param nstims Number of stimuli #' @param stimreps Number of repetitions of each stimulus within each group #' (i.e. within approach target, avoid target, a...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/aat_simulate.R
# splithalf engine #### #multicore splithalf #' @title Compute the bootstrapped split-half reliability for approach-avoidance task data #' @description Compute bootstrapped split-half reliability for approach-avoidance task data. #' @param ds a longformat data.frame #' @param subjvar Quoted name of the participant ide...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/aat_splithalf.R
subtraction.matrix<-function(avec,bvec){ na<-length(avec) nb<-length(bvec) out<-matrix(NA,nrow=na,ncol=nb) for(i in seq_len(na)){ out[i,]<-avec[i]-bvec } return(out) } meanpercentile<-function(sample,population){ sample %>% sapply(function(x) mean(x<population,na.rm=T)) %>% mean(na.rm=T) } #' Compu...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/aat_stimulus_rest.R
# Score computation algorithms #### #' @title AAT score computation algorithms #' @name Algorithms #' @description AAT score computation algorithms #' @param ds A long-format data.frame #' @param subjvar Column name of the participant identifier variable #' @param pullvar Column name of the movement variable (0: avoi...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/algorithms.R
#' @name correlation-tools #' @title Correlation tools #' @description Helper functions to compute important statistics from correlation coefficients. #' @param r,r1,r2 a correlation value #' @param z a Z-score #' @param n,n1,n2 sample sizes #' @param alpha the significance level to use #' @seealso \link{cormean}, \lin...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/cortools.R
#' AAT examining approach bias for erotic stimuli #' #' AAT #' #' @docType data #' #' @usage erotica #' #' @format An object of class \code{"data.frame"} #' #' @keywords datasets #' #' @references Kahveci, S., Van Bockstaele, B.D., & Wiers, R.W. (in preparation). #' Pulling for Pleasure? Erotic Approach-Bias Associated...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/data.R
balancedrandombinary<-function(n){ keys<-rep(c(0,1),floor(n/2)) if(n%%2){ keys<-c(keys,NA) } keys[sample.int(length(keys))] } splitsweep<-function(currsplitset){ h<-tapply(seq_len(nrow(currsplitset)),currsplitset,function(x){ cbind(x,balancedrandombinary(length(x))) },simplify=F) h<-do.call(rbind...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/datasplitter.R
serr<-function(x,na.rm=T){sqrt(var(x,na.rm=na.rm)/sum(!is.na(x)))} FlanaganRulonBilateral<-function(x1,x2){ key<-!is.na(x1) & !is.na(x2) x1<-x1[key] x2<-x2[key] fr<-(1-var(x1-x2)/var(x1+x2)) return(fr/max(1, 1-fr)) } RajuBilateral<-function(x1,x2,prop){ covar<-cov(x1,x2) sumvar<-var(x1)+var(x2)+2*abs(co...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/helpers.R
# Outlier removing algorithms #### #' @title Pre-processing rules #' @description These are pre-processing rules that can be used in \link{aat_splithalf}, \link{aat_bootstrap}, and \link{aat_compute}. #' #' \itemize{ #' \item The following rules are to be used for the \code{trialdropfunc} argument. #' The way you hand...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/outlierhandlers.R
#' Compute psychological experiment reliability #' @description This function can be used to compute an exact reliability score for a psychological task whose results involve a difference score. #' The resulting intraclass correlation coefficient is equivalent to the average all possible split-half reliability scores....
/scratch/gouwar.j/cran-all/cranData/AATtools/R/q_reliability.R
# utils #### #' @name splitrel #' @title Split Half-Based Reliability Coefficients #' @seealso \link{covrel} NULL #' @describeIn splitrel Perform a Spearman-Brown correction on the provided correlation score. #' #' @param corr To-be-corrected correlation coefficient #' @param ntests An integer indicating how many tim...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/relcorrections.R
#' @import dplyr #' @import magrittr #' @import doParallel #' @import foreach #' @importFrom magrittr %>% %<>% %$% #' @importFrom dplyr group_by ungroup mutate summarise sample_n n filter select #' @importFrom parallel detectCores makeCluster stopCluster #' @importFrom foreach getDoParRegistered registerDoSEQ #' @impor...
/scratch/gouwar.j/cran-all/cranData/AATtools/R/zzz.R
#' Shiny App to Demonstrate Analysis of Variance #' #' @name shiny_anova #' @aliases shiny_anova #' @description An interactive Shiny app to demonstrate Analysis of Variance. #' @usage shiny_anova() #' #' @details The interactive Shiny app demonstrates the principles of Analysis of Variance. #' The true parameter v...
/scratch/gouwar.j/cran-all/cranData/ABACUS/R/shiny_anova.R
#' Shiny App to Explore Properties of the Normal Distribution #' #' @name shiny_dnorm #' @aliases shiny_dnorm #' @description An interactive Shiny app to demonstrate properties of the Normal distribution. #' @usage shiny_dnorm() #' #' @details The interactive Shiny app demonstrates the properties of Normal distribution...
/scratch/gouwar.j/cran-all/cranData/ABACUS/R/shiny_dnorm.R
#' Shiny App to Explore Properties of Normal and Student's t Distributions #' #' @name shiny_dnorm_dt #' @aliases shiny_dnorm_dt #' @description An interactive Shiny app to demonstrate Normal and Student's t distributions. #' @usage shiny_dnorm_dt() #' #' @details The interactive Shiny app demonstrates the properties o...
/scratch/gouwar.j/cran-all/cranData/ABACUS/R/shiny_dnorm_dt.R
#' Shiny App to Demonstrate One-Sample Student's t-Test #' #' @name shiny_onesampt #' @aliases shiny_onesampt #' @description An interactive Shiny app to demonstrate one-sample Student's t-test. #' @usage shiny_onesampt() #' #' @details The interactive Shiny app demonstrates the principles of the hypothesis testing of ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/R/shiny_onesampt.R
#' Shiny App to Demonstrate One-Sample Z-Test #' #' @name shiny_onesampz #' @aliases shiny_onesampz #' @description An interactive Shiny app to demonstrate one-sample Z-test. #' @usage shiny_onesampz() #' #' @details The interactive Shiny app demonstrates the principles of the hypothesis testing of means #' in a on...
/scratch/gouwar.j/cran-all/cranData/ABACUS/R/shiny_onesampz.R
#' Shiny App to Explore Properties of Sampling Distributions #' #' @name shiny_sampling #' @aliases shiny_sampling #' @description An interactive Shiny app to demonstrate properties of the sampling distributions. #' @usage shiny_sampling() #' #' @details The interactive Shiny app demonstrates the properties of the samp...
/scratch/gouwar.j/cran-all/cranData/ABACUS/R/shiny_sampling.R
#' Shiny App to Demonstrate Two-Sample Independent (Unpaired) Student's t-Test #' #' @name shiny_twosampt #' @aliases shiny_twosampt #' @description An interactive Shiny app to demonstrate two-sample independent (unpaired) Student's t-test. #' @usage shiny_twosampt() #' #' @details The interactive Shiny app demonstrate...
/scratch/gouwar.j/cran-all/cranData/ABACUS/R/shiny_twosampt.R
# Shiny global functions for ANOVA library(shiny) library(ggplot2) #_________________________________________________________________________________________ # Function to fit Model fn_InputData <- function(pmean1, pmean2, pmean3, psd, n1, n2, n3, p, p_tail){ ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_anova/global.R
# Shiny server for ANOVA #_________________________________________________________________________________________ shinyServer(function(input, output) { #_________________________________________________________________________________________ # eventReactive function # Reactive inputVal_eventReactive <- event...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_anova/server.R
# Shiny ui for ANOVA library(shiny) library(ggplot2) source('global.R') # Define UI for the application shinyUI(pageWithSidebar( # Application title headerPanel(title = div(img(src='abacus.png', align = 'left'), "Hypothesis Testing: One-way Analysis of Variance"), wind...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_anova/ui.R
# Shiny global function for Normal distribution library(shiny) library(ggplot2) #_________________________________________________________________________________________ # Function to fit Model fn_InputData <- function(pmean, psd, n, bins, type, p, p_tail, cs_xscale){ xrs <- rnorm(n...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_dnorm/global.R
# Shiny server for Normal distribution #_________________________________________________________________________________________ shinyServer(function(input, output) { #_________________________________________________________________________________________ # Reactive inputVal_eventReactive <- eventReactive(in...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_dnorm/server.R
# Shiny ui for Normal distribution source('global.R') # Define UI for the application shinyUI(pageWithSidebar( headerPanel(title = div(img(src='abacus.png', align = 'left'), "Normal Distribution"), windowTitle = "Normal Distribution"), sidebarPanel( tags$hr(style...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_dnorm/ui.R
# Shiny global function for Normal distribution library(shiny) library(ggplot2) #_________________________________________________________________________________________ # Function to fit Model fn_InputData <- function(pmean, psd, df1, p, p_tail){ sstat <- data.frame(pmean = pmean, psd = psd) xmin <- -5 ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_dnorm_dt/global.R
# Shiny server for Normal distribution #_________________________________________________________________________________________ shinyServer(function(input, output) { #_________________________________________________________________________________________ # Reactive inputVal_reactive <- reactive({ pmean ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_dnorm_dt/server.R
# Shiny ui for Normal & t distributions source('global.R') # Define UI for the application shinyUI(pageWithSidebar( headerPanel(title = div(img(src='abacus.png', align = 'left'), "Properties of Standard Normal and Student's t Distributions"), windowTitle = "Properties of S...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_dnorm_dt/ui.R
# Shiny global function for One-sample t-test library(shiny) library(ggplot2) #_________________________________________________________________________________________ # Function to fit Model fn_InputData <- function(pmean, hpmean, psd, n, p, p_tail){ xrs <- rnorm(n = n, mean = pmean,...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_onesampt/global.R
# Shiny server for One-sample t-test #_________________________________________________________________________________________ shinyServer(function(input, output) { #_________________________________________________________________________________________ # eventReactive---- inputVal_eventReactive <- eventReac...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_onesampt/server.R
# Shiny ui for One-sample t-test shinyUI(pageWithSidebar( headerPanel(title = div(img(src='abacus.png', align = 'left'), "Hypothesis Testing: One Sample, Student's t-Test"), windowTitle = "Hypothesis Testing: One Sample, Student's t-Test"), sidebarPanel( tags$hr...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_onesampt/ui.R
# Shiny global function for One-sample z-test library(shiny) library(ggplot2) #_________________________________________________________________________________________ # Function to fit Model fn_InputData <- function(pmean, hpmean, psd, n, p, p_tail){ xrs <- rnorm(n = n, mean = pmean, ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_onesampz/global.R
# Shiny server for One-sample z-test #_________________________________________________________________________________________ shinyServer(function(input, output) { #_________________________________________________________________________________________ # eventReactive---- inputVal_eventReactive <- eventReact...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_onesampz/server.R
# Shiny ui for One-sample z-test # Define UI for the application shinyUI(pageWithSidebar( headerPanel(title = div(img(src='abacus.png', align = 'left'), "Hypothesis Testing: One Sample, Z Test"), windowTitle = "Hypothesis Testing: One Sample, Z Test"), sidebarPanel( ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_onesampz/ui.R
# Global code for Sampling library(shiny) library(ggplot2) #_________________________________________________________________________________________ # Function to fit Model fn_InputData <- function(pmean, psd, n, k){ pop <- rnorm(n = 1e05, mean = pmean, sd = psd) xrs <- replicate(k, sample(pop, n, replace ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_sampling/global.R
# # Shiny server: Sampling #_________________________________________________________________________________________ shinyServer(function(input, output) { #_________________________________________________________________________________________ # eventReactive---- inputVal_eventReactive <- eventReactive(input$c...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_sampling/server.R
# Shiny ui: Sampling shinyUI(pageWithSidebar( headerPanel(title = div(img(src='abacus.png', align = 'left'), "Sampling Distribution"), windowTitle = "Sampling Distribution"), sidebarPanel( tags$hr(style="border-color: purple;"), tags$p(style="color:blue", tags...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_sampling/ui.R
# Hypothesis Testing of Means: Two Samples, Unknown Equal Variance # Global code for Two-sample t-test library(shiny) library(ggplot2) #_________________________________________________________________________________________ # Function to fit Model fn_InputData <- function(pmean1, pmean2, ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_twosampt/global.R
# Hypothesis Testing of Means: Two Samples, Unknown Equal Variance # Shiny server for Two-sample t-test shinyServer(function(input, output) { inputVal_eventReactive <- eventReactive(input$cmdUpdate, { iseed <- input$numRN + (as.integer(input$cmdUpdate) - 1) ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_twosampt/server.R
# Hypothesis Testing of Means: Two Samples, Unknown Equal Variance # Shiny ui for Two-sample t-test # Define UI for the application shinyUI(pageWithSidebar( headerPanel(title = div(img(src='abacus.png', align = 'left'), "Hypothesis Testing: Two Samples, Student's t-Test"), ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/app_twosampt/ui.R
--- title: "Using ABACUS" subtitle: "ABACUS: Apps Based Activities for Communicating and Understanding Statistics" author: "Mintu Nath" date: "`r Sys.Date()`" vignette: > %\VignetteIndexEntry{ABACUS Introduction} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} output: knitr:::html_vignette: toc...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/doc/ABACUS.Rmd
--- title: "ABACUS Activities" subtitle: "ABACUS: Apps Based Activities for Communicating and Understanding Statistics" author: "Mintu Nath" date: "`r Sys.Date()`" vignette: > %\VignetteIndexEntry{ABACUS Activities} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} output: knitr:::html_vignette: ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/inst/doc/ABACUS_activities.Rmd
--- title: "Using ABACUS" subtitle: "ABACUS: Apps Based Activities for Communicating and Understanding Statistics" author: "Mintu Nath" date: "`r Sys.Date()`" vignette: > %\VignetteIndexEntry{ABACUS Introduction} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} output: knitr:::html_vignette: toc...
/scratch/gouwar.j/cran-all/cranData/ABACUS/vignettes/ABACUS.Rmd
--- title: "ABACUS Activities" subtitle: "ABACUS: Apps Based Activities for Communicating and Understanding Statistics" author: "Mintu Nath" date: "`r Sys.Date()`" vignette: > %\VignetteIndexEntry{ABACUS Activities} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} output: knitr:::html_vignette: ...
/scratch/gouwar.j/cran-all/cranData/ABACUS/vignettes/ABACUS_activities.Rmd
#' Identifying genes for which multiple CpG sites show significant methylation difference #' #' @description #' This function calculates the number of significantly different CpG sites between cases and controls for each gene and produces a frequency table with genes that have more than one CpG site. #' #' @param x...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/CpG_hits.R
utils::globalVariables(c('annotation_file', 'test_data', 'nonspecific_probes')) #' Annotating the filtered probes #' #' @description #' This function annotates each filtered probe with gene name, chromosome number, probe location, distance from transcription start site (TSS), and relation to CpG islands. The annotatio...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/annotate_data.R
#' Applying delta beta analysis to calculate the difference between cases and controls #' #' @description #' This function calculates the delta beta value for the filtered probes. It calculates the difference in mean DNA methylation between cases and controls for each probe. Also, it selects probes with DNA methylatio...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/delta_beta_data.R
#' Filtering DNA methylation 450k non_specific probes #' #' @description #' This function filters the reported nonspecific probes, and also filters probes that interrogate SNPs of minor allele frequency (MAF) > 0.1. A list of nonspecific probes was obtained from Chen et al (2013) supplementary files. #' @param x The ...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/filter_data.R
#' Overlapping Student's t-test and delta beta results #' #' @description #' This function overlaps the results from both Student’s t-test and delta beta analyses to identify probes (CpG sites) that are highly and significantly different between cases and controls. #' #' @param x Results from t-test or delta beta ana...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/overlap_data.R
utils::globalVariables('barplot') #' Plotting highly different and significant probes annotated by their corresponding gene names #' #' @description #' This function plots the potential candidate genes for which multiple CpG sites show significant difference. #' @param x Results from the overlap_data function #' @imp...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/plot_candidate_genes.R
#' Overview description of the DNA methylation pattern for cases and controls #' #' @description #' This function produces four distribution plots that summarise the DNA methylation patterns for cases (top left) and controls (top right). The top two histograms show the pattern of mean DNA methylation levels for cases...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/plot_data.R
#' Plotting and exporting methylation profile for candidate genes #' #' @description #' This function explores the DNA methylation profile for any gene. The function generates four plots: the top plots show the difference in DNA methylation between cases and controls (a bar chart of the delta beta values for all pro...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/plot_gene.R
#' An automated analysis applying all ABC.RAP functions in one script #' #' @description #' This function processes the ABC.RAP workflow automatically #' #' @param x The normalised beta values in a data matrix format, where conditions are arranged in columns and cg probes are arranged in rows. #' @param cases_column...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/process.ABC.RAP.R
#' applying t-test analysis #' #' @description #' This function applies "two.sided", unequal variance Student's t-test analysis for each probe comparing cases and controls. A cutoff for p-values can be entered to minimise multiple testing bias to filter insignificant p-values. #' #' @param x The filtered 450k probes...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/R/ttest_data.R
## ----read.csv, echo=TRUE------------------------------------------------- library(ABC.RAP) data("test_data") data("nonspecific_probes") data("annotation_file") ## ----filter, echo=TRUE--------------------------------------------------- test_data_filtered <- filter_data(test_data) ## ----annotation, echo=TRUE-------...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/inst/doc/ABC.RAP.R
--- title: "Array Based CpG Region Analysis Package (ABC.RAP)" author: "Abdulmonem A. Alsaleh, Robert J. Weeks, Ian M. Morison. Department of Pathology, Dunedin School of Medicine, University of Otago, Dunedin, New Zealand" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Array...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/inst/doc/ABC.RAP.Rmd
--- title: "Array Based CpG Region Analysis Package (ABC.RAP)" author: "Abdulmonem A. Alsaleh, Robert J. Weeks, Ian M. Morison. Department of Pathology, Dunedin School of Medicine, University of Otago, Dunedin, New Zealand" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Array...
/scratch/gouwar.j/cran-all/cranData/ABC.RAP/vignettes/ABC.RAP.Rmd
ABCRemoveSmallYields=function(Data,CumSumSmallestPercentage=0.5){ # res = ABCRemoveSmallYields(Data,CumSumSmallestPercentage) # Data cleanning for ABC analysis # the smallest data up to a cumulated sum of less than CumSumSmallestPercentage percent # the total sum (yield) is removed # negative data values and NaN are t...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/ABCRemoveSmallYields.R
ABCanalysis=function(Data,ABCcurvedata,PlotIt=FALSE){ # abcres = ABCanalysis(Data=ABCcleanData(Data)$CleanedData) # divide the Data in 3 classes A, B,C # A==Data(Aind) : mit wenig aufwand viel ertrag! # B==Data(Bind) : Aufwand und ertrag halten sich die Waage # C==Data(Cind) : viel Aufwand, wenig Ertrag # # Grenzziehun...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/ABCanalysis.R
ABCanalysis4curve <- function(p, ABC, PlotIt){ # V = ABCanalysis4curve(p,ABC,PlotIt) # calculate points A B C bei gegebener ABC kurve # # INPUT # [p,ABC] sind die Werte der ABC curve # # OPTIONAL # PlotIt ein plot der ABC Kurve mit errechneten Punkten # # OUTPUT # ...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/ABCanalysis4curve.R
ABCanalysisPlot=function(Data,LineType=0,LineWidth=3,ShowUniform=TRUE,title='ABC analysis',limits=TRUE,MarkPoints=TRUE,ABCcurvedata,ResetPlotDefaults=TRUE){ # res= ABCanalysisPlot(Data=ABCcleanData(Data)$CleanedData,style='2') # display ABC Curve : cumulative percentage of largest Data (Effort) vs cumlative percentage ...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/ABCanalysisPlot.R
ABCcleanData=function(Data){ # V= ABCcleanData(Data) # Data cleanning for ABC analysis # only the first column of Data is used # Data <0 are set to zero, NA in Data are set to zero # if RemoveSmallYields ==TRUE => the smallest data up to a cumulated sum of less than # 0.5# of the total sum (yield) is removed # # INPU...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/ABCcleanData.R
ABCcurve=function(Data,p){ # res = ABCcurve(Data,GiniSteigung) # ABC Curve : cumulative fraction of largest Data in population vs fraction of population # # INPUT # Data(1:n) data vector,only positive data will be used # # OPTIONAL # # p x-werte fuer Spline Interpolation: wenn vorgegeben dann...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/ABCcurve.R
ABCplot=function(Data,LineType=0,LineWidth=3,ShowUniform=TRUE,title,ABCcurvedata,defaultAxes=TRUE){ # res= ABCplot(Data) # display ABC Curve : cumulative percentage of largest Data (Effort) vs cumlative percentage of sum of largest Data (Yield) # # INPUT # Data(1:n) oder [Haeufigkeit(1:n),Data(1:n)] or # ...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/ABCplot.R
Gini4ABC <- function(p, ABC){ # Gini = Gini4ABC(p,ABC) # Gini index for an ABC curve # # INPUT # p,ABC x/y coorninates of ABC curve ABC(p), p(end) == 1 or 100; # # OUTPUT # Gini gini index i.e. the integral over ABC(p) / 0.5 *100 # given in percent i.e in [0..100] ...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/Gini4ABC.R
GiniIndex= function(Data,p){ #[Gini,p,ABC,CleanedData] = GiniIndex(Data,p) # Gini = GiniIndex(Data) # calculation of the Gini-Index # calculation of the Gini-Index from Data # uses ABCcurve and Gini4ABC # # INPUT # Data(1:n) data set, it is cleaned using CleanedData = ABCcleanData(Data) # ...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/GiniIndex.R
calculatedABCanalysis=function(Data){ # Vlist= calculatedABCanalysis(Data) # Vlist$Aind # Vlist$Bind # Vlist$Cind # Vlist$ABlimit # Vlist$BClimit # Berechnung der ABC analyse ohne plots und sonstige extras # berechnet ueber ABCanalysis # # INPUT # Data[1:n] data set, it is cleaned using CleanedData = ABCclea...
/scratch/gouwar.j/cran-all/cranData/ABCanalysis/R/calculatedABCanalysis.R
#' An implementation of the Artificial Bee Colony (ABC) Algorithm #' #' This is an implementation of Karaboga (2005) ABC optimization algorithm. It #' was developed upon the basic version programmed in \code{C} and distributed #' at the algorithm's official website (see the references). #' #' Please consider that t...
/scratch/gouwar.j/cran-all/cranData/ABCoptim/R/ABCoptim-package.R
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 abc_cpp_ <- function(par, fn, lb, ub, FoodNumber = 20L, limit = 100L, maxCycle = 1000L, criter = 50L) { .Call(`_ABCoptim_abc_cpp_`, par, fn, lb, ub, FoodNumber, limit, maxCycle, criter) }
/scratch/gouwar.j/cran-all/cranData/ABCoptim/R/RcppExports.R
#' Artificial Bee Colony Optimization #' #' Implements Karaboga (2005) Artificial Bee Colony (ABC) Optimization algorithm. #' #' @param par Initial values for the parameters to be optimized over #' @param fn A function to be minimized, with first argument of the vector of #' parameters over which minimization is to t...
/scratch/gouwar.j/cran-all/cranData/ABCoptim/R/abc_optim.R
################################################################################ # Some examples of ABC algorithm # Author: George G. Vega ################################################################################ pause <- function() { invisible(readline("\nPress <return> to continue: ")) } pause() ## 2D Ro...
/scratch/gouwar.j/cran-all/cranData/ABCoptim/demo/ABCoptim.R
ABC_P2_gamma <- function(n,ObsMean, S_Lo, S_Hi, R_Lo, R_Hi, delta,iter){ posterior<-c() discard<-c() gamma<-c() Shape<-c() Rate<-c() i<-1 j<-1 k<-1 l<-1 m<-1 while(i <= iter){ dispersion<-runif(1,R_Lo,R_Hi) mean<-runif(1,S_Lo,S_Hi) gamma<-round(rgamma(n, shape=mean, rate=dispersion)) P2<-runif(1...
/scratch/gouwar.j/cran-all/cranData/ABCp2/R/ABC_P2_gamma.R
ABC_P2_norm <- function(n,ObsMean,M_Lo,M_Hi,SD_Lo,SD_Hi,delta,iter){ posterior<-c() discard<-c() Norm<-c() Avg<-c() Std<-c() i<-1 j<-1 k<-1 l<-1 m<-1 while(i <= iter){ avg<-runif(1,M_Lo,M_Hi) std<-runif(1,SD_Lo,SD_Hi) while(j<=n){ norm<-round(rnorm(1, mean=avg, sd=std)) if(norm>0){ Norm[j]<-no...
/scratch/gouwar.j/cran-all/cranData/ABCp2/R/ABC_P2_norm.R
ABC_P2_pois <- function(n,ObsMean, L_Lo, L_Hi,delta,iter){ posterior<-c() discard<-c() pois<-c() Lambda<-c() i<-1 j<-1 k<-1 l<-1 while(i <= iter){ lambda<-runif(1,L_Lo,L_Hi) pois<-round(rgamma(n, lambda)) P2<-runif(1,0,1) sire2<-rbinom(n,pois,P2) meanP2<-mean(sire2) if(abs(meanP2 - ObsMean)...
/scratch/gouwar.j/cran-all/cranData/ABCp2/R/ABC_P2_pois.R
library(MASS) fit_dist_gamma <- function(dist){ l<-length(dist) j<-1 data_gamma<-c() fit_gamma<-fitdistr(dist, "gamma") while (j<=l){ gamma<-round(rgamma(1, fit_gamma$estimate[1], rate=fit_gamma$estimate[2])) if(gamma>0){ data_gamma[j]<-gamma j<-j+1 } } chi_gamma<-chisq.test(dist, data_gamma) list(data_gamma = data_...
/scratch/gouwar.j/cran-all/cranData/ABCp2/R/fit_dist_gamma.R
library(MASS) fit_dist_norm <- function(dist){ l<-length(dist) j<-1 data_norm<-c() fit_norm<-fitdistr(dist, "normal") while (j<=l){ norm<-round(rnorm(1, mean=fit_norm$estimate[1], sd=fit_norm$estimate[2])) if(norm>0){ data_norm[j]<-norm j<-j+1 } } chi_norm<-chisq.test(dist,data_norm) list(data_norm = data_norm, fit_...
/scratch/gouwar.j/cran-all/cranData/ABCp2/R/fit_dist_norm.R
library(MASS) fit_dist_pois <- function(dist){ l<-length(dist) fit_pois<-fitdistr(dist, "poisson") data_pois<-rpois(l, fit_pois$estimate) chi_pois<-chisq.test(dist,data_pois) list(data_pois = data_pois, fit_pois = fit_pois, chi_pois = chi_pois) }
/scratch/gouwar.j/cran-all/cranData/ABCp2/R/fit_dist_pois.R
#' ABHgenotypeR: A package for easy visualization and manipulating of ABH genotypes. #' #' The ABHgenotypeR packages is meant as a companion packages in between the TASSEL #' GBS pipeline and R/qtl. It allows easy visualization of ABH-encoded genotypes #' in a .csv format as ouptut by the TASSEL ABHGenosPlugin which is...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/ABHgenotypeR.R
#' Correct short miscalled stretches based on flanking alleles. #' #' @param inputGenos A genotypes list object. #' @param maxHapLength The maximum length of stretches flanked #' by non-heterzygous sites that are changed. If set to 1 #' (default) only AXA or BXB will be corrected. If set to 2, both AXA and AXYA #' ...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/correctStretches.R
#' Correct undercalled heterozygous sites based on flanking alleles. #' #' @param inputGenos A genotypes list object. #' @param maxHapLength The maximum length of not heterozygous stretches flanked #' by heterzygous sites that are changed to heterozygous. If set to 1 #' (default) only HAH or HBH will be corrected. ...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/correctUndercalledHets.R
#' Impute missing genotypes based on flanking alleles #' #' @param inputGenos A genotypes list object. #' #' @return A genotype object in which missing data is imputed based on flanking #' alleles. Any number of N is replaced by either A, B or N if the alleles which flank the N match #' #' @examples \dontrun{imputedG...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/imputeByFlanks.R
#' Plot the parental allele frequencies along the chromosomes. #' #' @param genos The output of readABHgenotypes #' #' @return A plot of parental allele frequencies along the chromosomes. If the #' output is assigned a name a ggplot2 object is returned for further #' manipulation. #' #' @examples \dontrun{plotAlle...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/plotAlleleFreq.R
#' Compare to genotype matrices #' #' @param genos_1 Output of readABHgenotypes #' @param genos_2 Output of readABHgenotypes. Note that both genos object need to #' have identical numbers of marker x individuals. #' @param markerToPlot A character vector of marker names which appear in the #' plot. Defaults to all. #...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/plotCompareGenos.R
#' Plot graphical genotypes. #' #' @param genos The output of readABHgenotypes #' @param markerToPlot A character vector of marker names which appear in the #' plot. Defaults to all. #' @param individualsToPlot A character vector of individual names which appear #' in the plot. Defaults to all. #' @param chromToPlo...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/plotGenos.R
#' Plot the marker density along the chromosomes. #' #' @param genos The output of readABHgenotypes #' #' @return A plot of marker densities along the chromosomes. If the output is #' assigned a name a ggplot2 object is returned for further manipulation. #' #' @examples \dontrun{plotMarkerDensity(genotypes)} #' \dont...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/plotMarkerDensity.R
#' Read in the output of the genosToABH plugin. #' #' @param pathToABH The path and filename of the input file. #' @param nameA Name of the parent represented by "A" in the input file. #' @param nameB Name of the parent represented by "B" in the input file. #' @param readPos Should the function attempt read the physica...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/readABHgenotypes.R
#' Report the total and relative number of each allele in a genotype object. #' #' @param genos1 A genotypes list object. #' #' @return Console output of the total an relative number of each allele. #' #' @examples \dontrun{reportGenos(preImputation)} #' @export reportGenos <- function(genos1) { cat(paste("The abso...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/reportGenos.R
#' Export a genotype list to a .csv file. #' #' @param genos The output of readABHgenotypes or one of the impuation/error #' correction functions. #' @param outfile The path and filename of the output file. #' #' @return A file which can be used in R/qtl or elsewhere. #' #' @examples \dontrun{writeABHgenotypes(genoty...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/R/writeABHgenotypes.R
## ---- echo = FALSE------------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(ggplot2) library(reshape2) ## ------------------------------------------------------------------------ library(ABHgenotypeR) ## ----readInChunk------------------------------------...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/inst/doc/ABHgenotypeR-vignette.R
--- title: "ABHGenotypeR" author: "Tomoyuki Furuta and Stefan Reuscher" date: "`r Sys.Date()`" output: rmarkdown::html_vignette: fig_caption: yes vignette: > %\VignetteIndexEntry{Using ABHGenotypeR} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, echo = FALSE} knitr::opts_chunk$set(...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/inst/doc/ABHgenotypeR-vignette.Rmd
--- title: "ABHGenotypeR" author: "Tomoyuki Furuta and Stefan Reuscher" date: "`r Sys.Date()`" output: rmarkdown::html_vignette: fig_caption: yes vignette: > %\VignetteIndexEntry{Using ABHGenotypeR} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, echo = FALSE} knitr::opts_chunk$set(...
/scratch/gouwar.j/cran-all/cranData/ABHgenotypeR/vignettes/ABHgenotypeR-vignette.Rmd
#' Agent Based Model Simulation Framework #' #' This package provides a framework to simulate agent based models that are #' based on states and events. #' #' ## Agent #' The concept of this framework is agent, which is an object of the [Agent] #' class. An agent maintains its own state, which is a named R list storing...
/scratch/gouwar.j/cran-all/cranData/ABM/R/ABM-package.R
#' R6 class that represent an agent #' #' The key task of an agent is to maintain events, and handle them in the #' chronological order. Agents also maintain their states, which is a list of #' values. The events, when handled, operate on the state of the agent (or other #' agents). #' #' During the simulation the agen...
/scratch/gouwar.j/cran-all/cranData/ABM/R/Agent.R
#' An R6 class that implements a contact pattern in R #' #' The main task of the class is to return the contacts of a given agent. Each #' object of this class is associated to a population. A population may have #' multiple contacts attached, e.g., a random mixing contact pattern and a #' network contact pattern. #' #...
/scratch/gouwar.j/cran-all/cranData/ABM/R/Contact.R
#' Create a logger of the Counter class #' #' When state changes occur, it is passed to each logger, which then #' change its value. At the specified time points in a run, the #' values of the logger are reported and recorded in a data.frame object, #' where the columns represent variables, and rows represent the #' ...
/scratch/gouwar.j/cran-all/cranData/ABM/R/Counter.R