1
1
# Part of the rstanarm package for estimating model parameters
2
2
# Copyright (C) 2017 Trustees of Columbia University
3
- #
3
+ #
4
4
# This program is free software; you can redistribute it and/or
5
5
# modify it under the terms of the GNU General Public License
6
6
# as published by the Free Software Foundation; either version 3
7
7
# of the License, or (at your option) any later version.
8
- #
8
+ #
9
9
# This program is distributed in the hope that it will be useful,
10
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
12
# GNU General Public License for more details.
13
- #
13
+ #
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -34,7 +34,7 @@ SW(fit <- stan_clogit(case ~ spontaneous + induced, strata = stratum, prior = NU
34
34
chains = CHAINS , iter = ITER , refresh = 0 ))
35
35
36
36
test_that(" stan_clogit is similar to survival::clogit" , {
37
- expect_equal(c(spontaneous = 1.985876 , induced = 1.409012 ), coef(fit ), tol = threshold )
37
+ expect_equal(c(spontaneous = 1.985876 , induced = 1.409012 ), coef(fit ), tol = 0.1 )
38
38
})
39
39
40
40
test_that(" stan_clogit runs for infert example" , {
@@ -45,13 +45,13 @@ test_that("stan_clogit works when y is a factor", {
45
45
d <- infert [order(infert $ stratum ), ]
46
46
d $ case <- factor (d $ case , labels = c(" A" , " B" ))
47
47
SW(fit_factor <- stan_clogit(case ~ spontaneous + induced , strata = stratum , prior = NULL ,
48
- data = infert [order(infert $ stratum ), ],
48
+ data = infert [order(infert $ stratum ), ],
49
49
chains = CHAINS , iter = ITER , refresh = 0 ))
50
50
expect_equal(coef(fit_factor ), coef(fit ), tolerance = threshold )
51
51
})
52
52
53
53
test_that(" stan_clogit throws error if data are not sorted" , {
54
- expect_error(update(fit , data = infert ),
54
+ expect_error(update(fit , data = infert ),
55
55
regexp = " Data must be sorted" )
56
56
})
57
57
0 commit comments