R Under development (unstable) (2025-02-03 r87683 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(Umpire) > # set seed to ensure reproducibility > suppressWarnings( RNGversion("3.5.3") ) > set.seed(463889) > # set up the parameters for the test > nGenes <- 20 > mu <- rnorm(nGenes, 6, 1) > sigma <- 1/rgamma(nGenes, rate=14, shape=6) > # create an object that generates independent normal data > ind <- IndependentNormal(mu, sigma) > nrow(ind) [1] 20 > summary(ind) An IndependentNormal object, representing a vector of length 20 of independent normal random variables. > # verify that the mean is correct > if(any(mu - ind@mu)) { + print('means do not match') + } else { + print('means verified') + } [1] "means verified" Warning message: In any(mu - ind@mu) : coercing argument of type 'double' to logical > # verify that the standard deviation is correct > if(any(sigma - ind@sigma)) { + print('standard deviations do not match') + } else { + print('sd verified') + } [1] "sd verified" Warning message: In any(sigma - ind@sigma) : coercing argument of type 'double' to logical > # generate some random variables > x <- rand(ind, 3) > print(dim(x)) [1] 20 3 > print(summary(x)) V1 V2 V3 Min. : 0.1635 Min. :1.138 Min. : 2.187 1st Qu.: 3.6633 1st Qu.:4.731 1st Qu.: 4.639 Median : 4.9929 Median :6.153 Median : 6.352 Mean : 5.3085 Mean :6.103 Mean : 6.024 3rd Qu.: 6.8657 3rd Qu.:7.965 3rd Qu.: 7.160 Max. :13.8127 Max. :9.416 Max. :10.175 > print(paste("'ind' should be valid:", validObject(ind))) [1] "'ind' should be valid: TRUE" > # break the validiity of the object > ind@sigma <- 1:3 > try( + print(paste("'ind' should not be valid:", validObject(ind, test=TRUE))) + ) [1] "'ind' should not be valid: lengths of sigma and mu differ" > # cleanup > rm(nGenes, mu, sigma, ind, x) > > > > proc.time() user system elapsed 0.68 0.25 0.90