R Under development (unstable) (2024-03-07 r86063 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > > ## regression test for testing regression > > library(survey) Loading required package: grid Loading required package: Matrix Loading required package: survival Attaching package: 'survey' The following object is masked from 'package:graphics': dotchart > data(api) > > dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) > > > f<-function(){ + form<-acs.46~stype + svyglm(formula=form, design = dstrat) + } > > g<-function(form){ + svyglm(formula=form, design = dstrat) + } > f() Stratified Independent Sampling design svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat, fpc = ~fpc) Call: svyglm(formula = form, design = dstrat) Coefficients: (Intercept) stypeH stypeM 28.7449 0.7551 0.4022 Degrees of Freedom: 133 Total (i.e. Null); 129 Residual (66 observations deleted due to missingness) Null Deviance: 1838 Residual Deviance: 1835 AIC: 719.8 > g(acs.46~stype) Stratified Independent Sampling design svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat, fpc = ~fpc) Call: svyglm(formula = form, design = dstrat) Coefficients: (Intercept) stypeH stypeM 28.7449 0.7551 0.4022 Degrees of Freedom: 133 Total (i.e. Null); 129 Residual (66 observations deleted due to missingness) Null Deviance: 1838 Residual Deviance: 1835 AIC: 719.8 > > f<-function(){ + form<-Surv(acs.46)~stype + svycoxph(formula=form, design = dstrat) + } > > g<-function(form){ + svycoxph(formula=form, design = dstrat) + } > > f() Call: svycoxph(formula = form, design = dstrat) coef exp(coef) se(coef) robust se z p stypeH -0.6766 0.5083 1.0208 0.6652 -1.017 0.309 stypeM -0.2509 0.7781 0.2308 0.2089 -1.201 0.230 Likelihood ratio test= on 2 df, p= n= 134, number of events= 134 (66 observations deleted due to missingness) > g(Surv(acs.46)~stype) Call: svycoxph(formula = form, design = dstrat) coef exp(coef) se(coef) robust se z p stypeH -0.6766 0.5083 1.0208 0.6652 -1.017 0.309 stypeM -0.2509 0.7781 0.2308 0.2089 -1.201 0.230 Likelihood ratio test= on 2 df, p= n= 134, number of events= 134 (66 observations deleted due to missingness) > > ## check coxph for a single predictor > svycoxph(Surv(acs.46)~api00,design=dstrat) Call: svycoxph(formula = Surv(acs.46) ~ api00, design = dstrat) coef exp(coef) se(coef) robust se z p api00 6.060e-06 1.000e+00 6.244e-04 7.492e-04 0.008 0.994 Likelihood ratio test= on 1 df, p= n= 134, number of events= 134 (66 observations deleted due to missingness) > > proc.time() user system elapsed 1.14 0.07 1.21