R/tpchreg.R
tpchreg.RdProportional hazards regression with piecewise constant hazards and tabular data.
tpchreg(formula, data, time, weights, last, subset, na.action, contrasts = NULL, start.coef = NULL, control = list(epsilon = 1.e-8, maxit = 200, trace = FALSE))
| formula | a formula with 'oe(count, exposure) ~ x1 + ...' |
|---|---|
| data | a data frame with occurrence/exposure data plus covariates. |
| time | the time variable, a factor character vector indicating time intervals, or numeric, indicating the start of intervals. |
| weights | Case weights. |
| last | If |
| subset | subset of data, not implemented yet. |
| na.action | Not implemented yet. |
| contrasts | Not implemented yet. |
| start.coef | For the moment equal to zero, not used. |
| control | list of control parameters for the optimization. |
The interpretation of cuts is different from that in link{hpch}.
This is intentional.
oe.
sw <- swepop sw$deaths <- swedeaths$deaths fit <- tpchreg(oe(deaths, pop) ~ strata(sex) + I(year - 1990), time = age, last = 101, data = sw) summary(fit)#> Covariate Mean Coef Rel.Risk S.E. LR p #> I(year - 1990) 4.489 -0.016 0.984 0.000 0.0000 #> #> Events 4729403 #> Total time at risk 457210264 #> Max. log. likelihood -18975534 #> LR test statistic 247379.01 #> Degrees of freedom 1 #> Overall p-value 0 #> #> Restricted mean survival in (0, 101] : #> women men #> 80.63921 75.59998 #>