R Under development (unstable) (2023-08-08 r84908 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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. > cat("# weights test\n") # weights test > library("qgcomp") > # are results at a given seed numerically stable across versions? > set.seed(50) > N=100 > dat <- data.frame(time=(tmg <- pmin(.1,rweibull(N, 10, 0.1))), + d=1.0*(tmg<0.1), x1=runif(N), x2=runif(N), z=runif(N)) > dat$wt = runif(N)*40 > dat$wt = dat$wt/mean(dat$wt) > dat$wt2 = 1 > expnms=paste0("x", 1:2) > > > > ##### binomial > set.seed(123123) > f0 = d ~ x1 + x2 > obj0a <- qgcomp.noboot(f0, expnms = expnms, data = dat, family=binomial()) > obj0b <- qgcomp.noboot(f0, expnms = expnms, data = dat, weight=wt2, family=binomial()) > obj0c <- qgcomp.noboot(f0, expnms = expnms, data = dat, weight=wt, family=binomial()) Warning message: In eval(family$initialize) : non-integer #successes in a binomial glm! > > stopifnot(all.equal( + coef(obj0a), + coef(obj0b), + check.names=FALSE, tolerance = 1e-4)) > > ##### survival > #set.seed(123123) > #f1 = survival::Surv(tmg, d) ~ x1 + x2 > #obj1a <- qgcomp(f1, expnms = expnms, data = dat) > #obj1b <- qgcomp.cox.boot(f1, expnms = expnms, B=2, data = dat) > # > #stopifnot(all.equal( > # coef(obj1a), > # c(0.02461938), > # check.names=FALSE, tolerance = 1e-4)) > #stopifnot(all.equal( > # coef(obj1b), > # c(0.02654175), > # check.names=FALSE, tolerance = 1e-4)) > # > # > ###### zi > #set.seed(123123) > #f2 = d ~ x1 + x2 | x1+x2 > #obj2a <- qgcomp(f2, expnms = expnms, data = dat, family=poisson()) > #obj2b <- qgcomp.zi.boot(f2, expnms = expnms, data = dat, dist="poisson", B = 2) > # > #stopifnot(all.equal( > # coef(obj2a), > # list(count=c( -0.42823824,-0.05519007 ), > # zero=c(9.057221, -40.356026)), > # check.names=FALSE, tolerance = 1e-4)) > #stopifnot(all.equal( > # coef(obj2b), > # list(count=c( -0.43554489,-0.05279048 ), > # zero=c(7.369426 , -18.411273)), > # check.names=FALSE, tolerance = 1e-4)) > # > > proc.time() user system elapsed 2.31 0.42 2.71