rms: Interfaces for rms package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

Interfaces to rms functions that can be used in a pipeline implemented by magrittr.

Usage

1
2
3
4
5
6
7
8

Arguments

data

data frame, tibble, list, ...

...

Other arguments passed to the corresponding interfaced function.

Details

Interfaces call their corresponding interfaced function.

Value

Object returned by interfaced function.

Author(s)

Roberto Bertolusso

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
## Not run: 
library(intubate)
library(magrittr)
library(rms)

## ntbt_bj: Buckley-James Multiple Regression Model
set.seed(1)
ftime  <- 10*rexp(200)
stroke <- ifelse(ftime > 10, 0, 1)
ftime  <- pmin(ftime, 10)
units(ftime) <- "Month"
age <- rnorm(200, 70, 10)
hospital <- factor(sample(c('a','b'),200,TRUE))
dd <- datadist(age, hospital)
options(datadist = "dd")
data_bj <- data.frame(ftime, stroke, age, hospital)

## Original function to interface
bj(Surv(ftime, stroke) ~ rcs(age,5) + hospital, data_bj, x = TRUE, y = TRUE)

## The interface puts data as first parameter
f <- ntbt_bj(data_bj, Surv(ftime, stroke) ~ rcs(age,5) + hospital, x = TRUE, y = TRUE)
anova(f)

## so it can be used easily in a pipeline.
data_bj %>%
  ntbt_bj(Surv(ftime, stroke) ~ rcs(age,5) + hospital, x = TRUE, y = TRUE)


## ntbt_cph: Cox Proportional Hazards Model and Extensions
n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
sex <- factor(sample(c('Male','Female'), n, 
              rep=TRUE, prob=c(.6, .4)))
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='Female'))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
dd <- datadist(age, sex)
options(datadist='dd')
S <- Surv(dt,e)

data_cph <- data.frame(S, age, sex)

## Original function to interface
cph(S ~ rcs(age,4) + sex, data_cph, x = TRUE, y = TRUE)

## The interface puts data as first parameter
ntbt_cph(data_cph, S ~ rcs(age,4) + sex, x = TRUE, y = TRUE)

## so it can be used easily in a pipeline.
data_cph %>%
  ntbt_cph(S ~ rcs(age,4) + sex, x = TRUE, y = TRUE)


## ntbt_Glm
## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
data_Glm <- data.frame(counts, outcome, treatment)

## Original function to interface
Glm(counts ~ outcome + treatment, family = poisson(), data = data_Glm)

## The interface puts data as first parameter
ntbt_Glm(data_Glm, counts ~ outcome + treatment, family = poisson())

## so it can be used easily in a pipeline.
data_Glm %>%
  ntbt_Glm(counts ~ outcome + treatment, family = poisson())


## ntbt_lrm: Logistic Regression Model
n <- 1000    # define sample size
set.seed(17) # so can reproduce the results
age            <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol    <- rnorm(n, 200, 25)
sex            <- factor(sample(c('female','male'), n,TRUE))
label(age)            <- 'Age'      # label is in Hmisc
label(cholesterol)    <- 'Total Cholesterol'
label(blood.pressure) <- 'Systolic Blood Pressure'
label(sex)            <- 'Sex'
units(cholesterol)    <- 'mg/dl'   # uses units.default in Hmisc
units(blood.pressure) <- 'mmHg'

#To use prop. odds model, avoid using a huge number of intercepts by
#grouping cholesterol into 40-tiles
ch <- cut2(cholesterol, g=40, levels.mean=TRUE) # use mean values in intervals
data_lrm <- data.frame(ch, age)

## Original function to interface
lrm(ch ~ age, data_lrm)

## The interface puts data as first parameter
ntbt_lrm(data_lrm, ch ~ age)

## so it can be used easily in a pipeline.
data_lrm %>%
  ntbt_lrm(ch ~ age)


## ntbt_npsurv: Nonparametric Survival Estimates for Censored Data
tdata <- data.frame(time   = c(1,1,1,2,2,2,3,3,3,4,4,4),
                    status = rep(c(1,0,2),4),
                    n      = c(12,3,2,6,2,4,2,0,2,3,3,5))
## Original function to interface
f <- npsurv(Surv(time, time, status, type = 'interval') ~ 1, data = tdata, weights = n)
plot(f, fun = 'event', xmax = 20, mark.time = FALSE, col = 2:3)

## The interface puts data as first parameter
f <- ntbt_npsurv(tdata, Surv(time, time, status, type = 'interval') ~ 1, weights = n)
plot(f, fun = 'event', xmax = 20, mark.time = FALSE, col = 2:3)

## so it can be used easily in a pipeline.
tdata %>%
  ntbt_npsurv(Surv(time, time, status, type = 'interval') ~ 1, weights = n) %>%
  plot(fun = 'event', xmax = 20, mark.time = FALSE, col = 2:3)


## ntbt_ols: Linear Model Estimation Using Ordinary Least Squares
set.seed(1)
x1 <- runif(200)
x2 <- sample(0:3, 200, TRUE)
distance <- (x1 + x2/3 + rnorm(200))^2
d <- datadist(x1, x2)
options(datadist="d")   # No d -> no summary, plot without giving all details
data_ols <- data.frame(distance, x1, x2)

## Original function to interface
ols(sqrt(distance) ~ rcs(x1, 4) + scored(x2), data_ols, x = TRUE)
 
## The interface puts data as first parameter
ntbt_ols(data_ols, sqrt(distance) ~ rcs(x1, 4) + scored(x2), x = TRUE)

## so it can be used easily in a pipeline.
data_ols %>%
  ntbt_ols(sqrt(distance) ~ rcs(x1, 4) + scored(x2), x = TRUE)


## ntbt_orm: Ordinal Regression Model
set.seed(1)
n <- 300
x1 <- c(rep(0,150), rep(1,150))
y <- rnorm(n) + 3 * x1
data_orm <- data.frame(y, x1)

## Original function to interface
orm(y ~ x1, data_orm)

## The interface puts data as first parameter
ntbt_orm(data_orm, y ~ x1)

## so it can be used easily in a pipeline.
data_orm %>%
  ntbt_orm(y ~ x1)


## ntbt_psm: Parametric Survival Model
n <- 400
set.seed(1)
age <- rnorm(n, 50, 12)
sex <- factor(sample(c('Female','Male'),n,TRUE))
dd <- datadist(age,sex)
options(datadist='dd')
# Population hazard function:
h <- .02*exp(.06*(age-50)+.8*(sex=='Female'))
d.time <- -log(runif(n))/h
cens <- 15*runif(n)
death <- ifelse(d.time <= cens,1,0)
d.time <- pmin(d.time, cens)

data_psm <- data.frame(d.time, death, sex, age)

## Original function to interface
psm(Surv(d.time, death) ~ sex * pol(age, 2), data_psm, dist = 'lognormal')
# Log-normal model is a bad fit for proportional hazards data

## The interface puts data as first parameter
ntbt_psm(data_psm, Surv(d.time, death) ~ sex * pol(age, 2), dist = 'lognormal')

## so it can be used easily in a pipeline.
data_psm %>%
  ntbt_psm(Surv(d.time, death) ~ sex * pol(age, 2), dist = 'lognormal')

## End(Not run)

Example output

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, units

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

Buckley-James Censored Data Regression
 
 bj(formula = Surv(ftime, stroke) ~ rcs(age, 5) + hospital, data = data_bj, 
     x = TRUE, y = TRUE)
 
                                   Discrimination    
                                      Indexes        
 Obs    200    Regression d.f.5    g        0.325    
 Events 120    sigma0.8967         gr       1.384    
               d.f.    114                           
 
            Coef    S.E.   Wald Z Pr(>|Z|)
 Intercept  -1.0590 1.9965 -0.53  0.5958  
 age         0.0554 0.0359  1.55  0.1222  
 age'       -0.4562 0.1811 -2.52  0.0117  
 age''       4.6885 1.6826  2.79  0.0053  
 age'''     -6.6733 2.4011 -2.78  0.0054  
 hospital=b  0.2024 0.1695  1.19  0.2325  
 
                Wald Statistics          Response: Surv(ftime, stroke) 

 Factor     Chi-Square d.f. P     
 age         9.13      4    0.0580
  Nonlinear  9.10      3    0.0279
 hospital    1.43      1    0.2325
 TOTAL      11.53      5    0.0418
Buckley-James Censored Data Regression
 
 bj(formula = Surv(ftime, stroke) ~ rcs(age, 5) + hospital, x = TRUE, 
     y = TRUE)
 
                                   Discrimination    
                                      Indexes        
 Obs    200    Regression d.f.5    g        0.325    
 Events 120    sigma0.8967         gr       1.384    
               d.f.    114                           
 
            Coef    S.E.   Wald Z Pr(>|Z|)
 Intercept  -1.0590 1.9965 -0.53  0.5958  
 age         0.0554 0.0359  1.55  0.1222  
 age'       -0.4562 0.1811 -2.52  0.0117  
 age''       4.6885 1.6826  2.79  0.0053  
 age'''     -6.6733 2.4011 -2.78  0.0054  
 hospital=b  0.2024 0.1695  1.19  0.2325  
 
Cox Proportional Hazards Model
 
 cph(formula = S ~ rcs(age, 4) + sex, data = data_cph, x = TRUE, 
     y = TRUE)
 
                      Model Tests       Discrimination    
                                           Indexes        
 Obs       1000    LR chi2     78.28    R2       0.083    
 Events     183    d.f.            4    Dxy      0.378    
 Center -0.2861    Pr(> chi2) 0.0000    g        0.762    
                   Score chi2  83.86    gr       2.143    
                   Pr(> chi2) 0.0000                      
 
          Coef    S.E.   Wald Z Pr(>|Z|)
 age      -0.0173 0.0286 -0.61  0.5443  
 age'      0.2040 0.0767  2.66  0.0079  
 age''    -0.7500 0.2679 -2.80  0.0051  
 sex=Male -0.6445 0.1488 -4.33  <0.0001 
 
Cox Proportional Hazards Model
 
 cph(formula = S ~ rcs(age, 4) + sex, x = TRUE, y = TRUE)
 
                      Model Tests       Discrimination    
                                           Indexes        
 Obs       1000    LR chi2     78.28    R2       0.083    
 Events     183    d.f.            4    Dxy      0.378    
 Center -0.2861    Pr(> chi2) 0.0000    g        0.762    
                   Score chi2  83.86    gr       2.143    
                   Pr(> chi2) 0.0000                      
 
          Coef    S.E.   Wald Z Pr(>|Z|)
 age      -0.0173 0.0286 -0.61  0.5443  
 age'      0.2040 0.0767  2.66  0.0079  
 age''    -0.7500 0.2679 -2.80  0.0051  
 sex=Male -0.6445 0.1488 -4.33  <0.0001 
 
Cox Proportional Hazards Model
 
 cph(formula = S ~ rcs(age, 4) + sex, x = TRUE, y = TRUE)
 
                      Model Tests       Discrimination    
                                           Indexes        
 Obs       1000    LR chi2     78.28    R2       0.083    
 Events     183    d.f.            4    Dxy      0.378    
 Center -0.2861    Pr(> chi2) 0.0000    g        0.762    
                   Score chi2  83.86    gr       2.143    
                   Pr(> chi2) 0.0000                      
 
          Coef    S.E.   Wald Z Pr(>|Z|)
 age      -0.0173 0.0286 -0.61  0.5443  
 age'      0.2040 0.0767  2.66  0.0079  
 age''    -0.7500 0.2679 -2.80  0.0051  
 sex=Male -0.6445 0.1488 -4.33  <0.0001 
 
General Linear Model
 
 Glm(formula = counts ~ outcome + treatment, family = poisson(), 
     data = data_Glm)
 
                   Model Likelihood     
                      Ratio Test        
 Obs       9       LR chi2      5.45    
 Residual d.f.4    d.f.            4    
 g 0.2271276       Pr(> chi2) 0.2440    
 
             Coef    S.E.   Wald Z Pr(>|Z|)
 Intercept    3.0445 0.1709 17.81  <0.0001 
 outcome=2   -0.4543 0.2022 -2.25  0.0246  
 outcome=3   -0.2930 0.1927 -1.52  0.1285  
 treatment=2  0.0000 0.2000  0.00  1.0000  
 treatment=3  0.0000 0.2000  0.00  1.0000  
 
General Linear Model
 
 Glm(formula = counts ~ outcome + treatment, family = poisson(), 
     data = data_Glm)
 
                   Model Likelihood     
                      Ratio Test        
 Obs       9       LR chi2      5.45    
 Residual d.f.4    d.f.            4    
 g 0.2271276       Pr(> chi2) 0.2440    
 
             Coef    S.E.   Wald Z Pr(>|Z|)
 Intercept    3.0445 0.1709 17.81  <0.0001 
 outcome=2   -0.4543 0.2022 -2.25  0.0246  
 outcome=3   -0.2930 0.1927 -1.52  0.1285  
 treatment=2  0.0000 0.2000  0.00  1.0000  
 treatment=3  0.0000 0.2000  0.00  1.0000  
 
General Linear Model
 
 Glm(formula = counts ~ outcome + treatment, family = poisson(), 
     data = .)
 
                   Model Likelihood     
                      Ratio Test        
 Obs       9       LR chi2      5.45    
 Residual d.f.4    d.f.            4    
 g 0.2271276       Pr(> chi2) 0.2440    
 
             Coef    S.E.   Wald Z Pr(>|Z|)
 Intercept    3.0445 0.1709 17.81  <0.0001 
 outcome=2   -0.4543 0.2022 -2.25  0.0246  
 outcome=3   -0.2930 0.1927 -1.52  0.1285  
 treatment=2  0.0000 0.2000  0.00  1.0000  
 treatment=3  0.0000 0.2000  0.00  1.0000  
 
Logistic Regression Model
 
 lrm(formula = ch ~ age, data = data_lrm)
 
 
 Frequencies of Responses
 
 143.16 155.16 162.68 166.81 170.68 173.56 176.95 179.04 181.17 182.83 184.91 
     25     25     25     25     25     25     25     25     25     25     25 
 186.74 188.48 190.09 191.54 193.23 195.04 196.62 198.16 199.93 201.07 202.78 
     25     25     25     25     25     25     25     25     25     25     25 
 204.92 206.49 208.08 209.53 211.16 212.71 214.12 215.80 217.42 219.50 221.76 
     25     25     25     25     25     25     25     25     25     25     25 
 224.28 227.32 230.02 233.76 238.77 245.69 255.30 
     25     25     25     25     25     25     25 
 
                      Model Likelihood     Discrimination    Rank Discrim.    
                         Ratio Test           Indexes           Indexes       
 Obs          1000    LR chi2      0.19    R2       0.000    C       0.511    
 max |deriv| 6e-13    d.f.            1    g        0.027    Dxy     0.021    
                      Pr(> chi2) 0.6651    gr       1.027    gamma   0.021    
                                           gp       0.007    tau-a   0.021    
                                           Brier    0.250                     
 
           Coef    S.E.   Wald Z Pr(>|Z|)
 y>=155.16  3.7816 0.3398  11.13 <0.0001 
 y>=162.68  3.0626 0.3093   9.90 <0.0001 
 y>=166.81  2.6304 0.2983   8.82 <0.0001 
 y>=170.68  2.3153 0.2927   7.91 <0.0001 
 y>=173.56  2.0640 0.2894   7.13 <0.0001 
 y>=176.95  1.8528 0.2872   6.45 <0.0001 
 y>=179.04  1.6688 0.2857   5.84 <0.0001 
 y>=181.17  1.5045 0.2845   5.29 <0.0001 
 y>=182.83  1.3550 0.2835   4.78 <0.0001 
 y>=184.91  1.2168 0.2827   4.30 <0.0001 
 y>=186.74  1.0875 0.2821   3.86 0.0001  
 y>=188.48  0.9654 0.2814   3.43 0.0006  
 y>=190.09  0.8488 0.2808   3.02 0.0025  
 y>=191.54  0.7369 0.2803   2.63 0.0086  
 y>=193.23  0.6286 0.2799   2.25 0.0247  
 y>=195.04  0.5232 0.2797   1.87 0.0614  
 y>=196.62  0.4200 0.2795   1.50 0.1329  
 y>=198.16  0.3184 0.2793   1.14 0.2543  
 y>=199.93  0.2177 0.2791   0.78 0.4353  
 y>=201.07  0.1176 0.2789   0.42 0.6734  
 y>=202.78  0.0175 0.2788   0.06 0.9501  
 y>=204.92 -0.0832 0.2788  -0.30 0.7655  
 y>=206.49 -0.1848 0.2789  -0.66 0.5075  
 y>=208.08 -0.2880 0.2790  -1.03 0.3020  
 y>=209.53 -0.3933 0.2792  -1.41 0.1589  
 y>=211.16 -0.5015 0.2794  -1.79 0.0727  
 y>=212.71 -0.6134 0.2797  -2.19 0.0283  
 y>=214.12 -0.7298 0.2801  -2.61 0.0092  
 y>=215.80 -0.8519 0.2806  -3.04 0.0024  
 y>=217.42 -0.9811 0.2811  -3.49 0.0005  
 y>=219.50 -1.1192 0.2818  -3.97 <0.0001 
 y>=221.76 -1.2688 0.2827  -4.49 <0.0001 
 y>=224.28 -1.4331 0.2839  -5.05 <0.0001 
 y>=227.32 -1.6171 0.2855  -5.67 <0.0001 
 y>=230.02 -1.8284 0.2876  -6.36 <0.0001 
 y>=233.76 -2.0798 0.2909  -7.15 <0.0001 
 y>=238.77 -2.3950 0.2964  -8.08 <0.0001 
 y>=245.69 -2.8271 0.3073  -9.20 <0.0001 
 y>=255.30 -3.5462 0.3383 -10.48 <0.0001 
 age       -0.0023 0.0054  -0.43 0.6651  
 
Logistic Regression Model
 
 lrm(formula = ch ~ age)
 
 
 Frequencies of Responses
 
 143.16 155.16 162.68 166.81 170.68 173.56 176.95 179.04 181.17 182.83 184.91 
     25     25     25     25     25     25     25     25     25     25     25 
 186.74 188.48 190.09 191.54 193.23 195.04 196.62 198.16 199.93 201.07 202.78 
     25     25     25     25     25     25     25     25     25     25     25 
 204.92 206.49 208.08 209.53 211.16 212.71 214.12 215.80 217.42 219.50 221.76 
     25     25     25     25     25     25     25     25     25     25     25 
 224.28 227.32 230.02 233.76 238.77 245.69 255.30 
     25     25     25     25     25     25     25 
 
                      Model Likelihood     Discrimination    Rank Discrim.    
                         Ratio Test           Indexes           Indexes       
 Obs          1000    LR chi2      0.19    R2       0.000    C       0.511    
 max |deriv| 6e-13    d.f.            1    g        0.027    Dxy     0.021    
                      Pr(> chi2) 0.6651    gr       1.027    gamma   0.021    
                                           gp       0.007    tau-a   0.021    
                                           Brier    0.250                     
 
           Coef    S.E.   Wald Z Pr(>|Z|)
 y>=155.16  3.7816 0.3398  11.13 <0.0001 
 y>=162.68  3.0626 0.3093   9.90 <0.0001 
 y>=166.81  2.6304 0.2983   8.82 <0.0001 
 y>=170.68  2.3153 0.2927   7.91 <0.0001 
 y>=173.56  2.0640 0.2894   7.13 <0.0001 
 y>=176.95  1.8528 0.2872   6.45 <0.0001 
 y>=179.04  1.6688 0.2857   5.84 <0.0001 
 y>=181.17  1.5045 0.2845   5.29 <0.0001 
 y>=182.83  1.3550 0.2835   4.78 <0.0001 
 y>=184.91  1.2168 0.2827   4.30 <0.0001 
 y>=186.74  1.0875 0.2821   3.86 0.0001  
 y>=188.48  0.9654 0.2814   3.43 0.0006  
 y>=190.09  0.8488 0.2808   3.02 0.0025  
 y>=191.54  0.7369 0.2803   2.63 0.0086  
 y>=193.23  0.6286 0.2799   2.25 0.0247  
 y>=195.04  0.5232 0.2797   1.87 0.0614  
 y>=196.62  0.4200 0.2795   1.50 0.1329  
 y>=198.16  0.3184 0.2793   1.14 0.2543  
 y>=199.93  0.2177 0.2791   0.78 0.4353  
 y>=201.07  0.1176 0.2789   0.42 0.6734  
 y>=202.78  0.0175 0.2788   0.06 0.9501  
 y>=204.92 -0.0832 0.2788  -0.30 0.7655  
 y>=206.49 -0.1848 0.2789  -0.66 0.5075  
 y>=208.08 -0.2880 0.2790  -1.03 0.3020  
 y>=209.53 -0.3933 0.2792  -1.41 0.1589  
 y>=211.16 -0.5015 0.2794  -1.79 0.0727  
 y>=212.71 -0.6134 0.2797  -2.19 0.0283  
 y>=214.12 -0.7298 0.2801  -2.61 0.0092  
 y>=215.80 -0.8519 0.2806  -3.04 0.0024  
 y>=217.42 -0.9811 0.2811  -3.49 0.0005  
 y>=219.50 -1.1192 0.2818  -3.97 <0.0001 
 y>=221.76 -1.2688 0.2827  -4.49 <0.0001 
 y>=224.28 -1.4331 0.2839  -5.05 <0.0001 
 y>=227.32 -1.6171 0.2855  -5.67 <0.0001 
 y>=230.02 -1.8284 0.2876  -6.36 <0.0001 
 y>=233.76 -2.0798 0.2909  -7.15 <0.0001 
 y>=238.77 -2.3950 0.2964  -8.08 <0.0001 
 y>=245.69 -2.8271 0.3073  -9.20 <0.0001 
 y>=255.30 -3.5462 0.3383 -10.48 <0.0001 
 age       -0.0023 0.0054  -0.43 0.6651  
 
Logistic Regression Model
 
 lrm(formula = ch ~ age)
 
 
 Frequencies of Responses
 
 143.16 155.16 162.68 166.81 170.68 173.56 176.95 179.04 181.17 182.83 184.91 
     25     25     25     25     25     25     25     25     25     25     25 
 186.74 188.48 190.09 191.54 193.23 195.04 196.62 198.16 199.93 201.07 202.78 
     25     25     25     25     25     25     25     25     25     25     25 
 204.92 206.49 208.08 209.53 211.16 212.71 214.12 215.80 217.42 219.50 221.76 
     25     25     25     25     25     25     25     25     25     25     25 
 224.28 227.32 230.02 233.76 238.77 245.69 255.30 
     25     25     25     25     25     25     25 
 
                      Model Likelihood     Discrimination    Rank Discrim.    
                         Ratio Test           Indexes           Indexes       
 Obs          1000    LR chi2      0.19    R2       0.000    C       0.511    
 max |deriv| 6e-13    d.f.            1    g        0.027    Dxy     0.021    
                      Pr(> chi2) 0.6651    gr       1.027    gamma   0.021    
                                           gp       0.007    tau-a   0.021    
                                           Brier    0.250                     
 
           Coef    S.E.   Wald Z Pr(>|Z|)
 y>=155.16  3.7816 0.3398  11.13 <0.0001 
 y>=162.68  3.0626 0.3093   9.90 <0.0001 
 y>=166.81  2.6304 0.2983   8.82 <0.0001 
 y>=170.68  2.3153 0.2927   7.91 <0.0001 
 y>=173.56  2.0640 0.2894   7.13 <0.0001 
 y>=176.95  1.8528 0.2872   6.45 <0.0001 
 y>=179.04  1.6688 0.2857   5.84 <0.0001 
 y>=181.17  1.5045 0.2845   5.29 <0.0001 
 y>=182.83  1.3550 0.2835   4.78 <0.0001 
 y>=184.91  1.2168 0.2827   4.30 <0.0001 
 y>=186.74  1.0875 0.2821   3.86 0.0001  
 y>=188.48  0.9654 0.2814   3.43 0.0006  
 y>=190.09  0.8488 0.2808   3.02 0.0025  
 y>=191.54  0.7369 0.2803   2.63 0.0086  
 y>=193.23  0.6286 0.2799   2.25 0.0247  
 y>=195.04  0.5232 0.2797   1.87 0.0614  
 y>=196.62  0.4200 0.2795   1.50 0.1329  
 y>=198.16  0.3184 0.2793   1.14 0.2543  
 y>=199.93  0.2177 0.2791   0.78 0.4353  
 y>=201.07  0.1176 0.2789   0.42 0.6734  
 y>=202.78  0.0175 0.2788   0.06 0.9501  
 y>=204.92 -0.0832 0.2788  -0.30 0.7655  
 y>=206.49 -0.1848 0.2789  -0.66 0.5075  
 y>=208.08 -0.2880 0.2790  -1.03 0.3020  
 y>=209.53 -0.3933 0.2792  -1.41 0.1589  
 y>=211.16 -0.5015 0.2794  -1.79 0.0727  
 y>=212.71 -0.6134 0.2797  -2.19 0.0283  
 y>=214.12 -0.7298 0.2801  -2.61 0.0092  
 y>=215.80 -0.8519 0.2806  -3.04 0.0024  
 y>=217.42 -0.9811 0.2811  -3.49 0.0005  
 y>=219.50 -1.1192 0.2818  -3.97 <0.0001 
 y>=221.76 -1.2688 0.2827  -4.49 <0.0001 
 y>=224.28 -1.4331 0.2839  -5.05 <0.0001 
 y>=227.32 -1.6171 0.2855  -5.67 <0.0001 
 y>=230.02 -1.8284 0.2876  -6.36 <0.0001 
 y>=233.76 -2.0798 0.2909  -7.15 <0.0001 
 y>=238.77 -2.3950 0.2964  -8.08 <0.0001 
 y>=245.69 -2.8271 0.3073  -9.20 <0.0001 
 y>=255.30 -3.5462 0.3383 -10.48 <0.0001 
 age       -0.0023 0.0054  -0.43 0.6651  
 
Linear Regression Model
 
 ols(formula = sqrt(distance) ~ rcs(x1, 4) + scored(x2), data = data_ols, 
     x = TRUE)
 
                Model Likelihood     Discrimination    
                   Ratio Test           Indexes        
 Obs     200    LR chi2     44.91    R2       0.201    
 sigma0.7894    d.f.            6    R2 adj   0.176    
 d.f.    193    Pr(> chi2) 0.0000    g        0.449    
 
 Residuals
 
     Min      1Q  Median      3Q     Max 
 -1.4630 -0.5879 -0.1007  0.5238  2.1320 
 
 
           Coef    S.E.   t     Pr(>|t|)
 Intercept  0.5050 0.2418  2.09 0.0380  
 x1         1.0738 0.9831  1.09 0.2761  
 x1'       -0.5649 2.7791 -0.20 0.8391  
 x1''       1.0240 9.0616  0.11 0.9101  
 x2         0.0637 0.1461  0.44 0.6631  
 x2=2       0.6089 0.2624  2.32 0.0214  
 x2=3       0.3897 0.3860  1.01 0.3139  
 
Linear Regression Model
 
 ols(formula = sqrt(distance) ~ rcs(x1, 4) + scored(x2), x = TRUE)
 
                Model Likelihood     Discrimination    
                   Ratio Test           Indexes        
 Obs     200    LR chi2     44.91    R2       0.201    
 sigma0.7894    d.f.            6    R2 adj   0.176    
 d.f.    193    Pr(> chi2) 0.0000    g        0.449    
 
 Residuals
 
     Min      1Q  Median      3Q     Max 
 -1.4630 -0.5879 -0.1007  0.5238  2.1320 
 
 
           Coef    S.E.   t     Pr(>|t|)
 Intercept  0.5050 0.2418  2.09 0.0380  
 x1         1.0738 0.9831  1.09 0.2761  
 x1'       -0.5649 2.7791 -0.20 0.8391  
 x1''       1.0240 9.0616  0.11 0.9101  
 x2         0.0637 0.1461  0.44 0.6631  
 x2=2       0.6089 0.2624  2.32 0.0214  
 x2=3       0.3897 0.3860  1.01 0.3139  
 
Linear Regression Model
 
 ols(formula = sqrt(distance) ~ rcs(x1, 4) + scored(x2), x = TRUE)
 
                Model Likelihood     Discrimination    
                   Ratio Test           Indexes        
 Obs     200    LR chi2     44.91    R2       0.201    
 sigma0.7894    d.f.            6    R2 adj   0.176    
 d.f.    193    Pr(> chi2) 0.0000    g        0.449    
 
 Residuals
 
     Min      1Q  Median      3Q     Max 
 -1.4630 -0.5879 -0.1007  0.5238  2.1320 
 
 
           Coef    S.E.   t     Pr(>|t|)
 Intercept  0.5050 0.2418  2.09 0.0380  
 x1         1.0738 0.9831  1.09 0.2761  
 x1'       -0.5649 2.7791 -0.20 0.8391  
 x1''       1.0240 9.0616  0.11 0.9101  
 x2         0.0637 0.1461  0.44 0.6631  
 x2=2       0.6089 0.2624  2.32 0.0214  
 x2=3       0.3897 0.3860  1.01 0.3139  
 
Logistic (Proportional Odds) Ordinal Regression Model
 
 orm(formula = y ~ x1, data = data_orm)
 
                         Model Likelihood           Discrimination          Rank Discrim.    
                            Ratio Test                  Indexes                Indexes       
 Obs             300    LR chi2     322.59    R2                   0.659    rho     0.841    
 Distinct Y      300    d.f.             1    g                    2.811                     
 Median Y    1.51254    Pr(> chi2) <0.0001    gr                  16.630                     
 max |deriv|   9e-06    Score chi2  271.61    |Pr(Y>=median)-0.5|  0.442                     
                        Pr(> chi2) <0.0001                                                   
 
    Coef   S.E.   Wald Z Pr(>|Z|)
 x1 5.6036 0.4369 12.83  <0.0001 
 
Logistic (Proportional Odds) Ordinal Regression Model
 
 orm(formula = y ~ x1)
 
                         Model Likelihood           Discrimination          Rank Discrim.    
                            Ratio Test                  Indexes                Indexes       
 Obs             300    LR chi2     322.59    R2                   0.659    rho     0.841    
 Distinct Y      300    d.f.             1    g                    2.811                     
 Median Y    1.51254    Pr(> chi2) <0.0001    gr                  16.630                     
 max |deriv|   9e-06    Score chi2  271.61    |Pr(Y>=median)-0.5|  0.442                     
                        Pr(> chi2) <0.0001                                                   
 
    Coef   S.E.   Wald Z Pr(>|Z|)
 x1 5.6036 0.4369 12.83  <0.0001 
 
Logistic (Proportional Odds) Ordinal Regression Model
 
 orm(formula = y ~ x1)
 
                         Model Likelihood           Discrimination          Rank Discrim.    
                            Ratio Test                  Indexes                Indexes       
 Obs             300    LR chi2     322.59    R2                   0.659    rho     0.841    
 Distinct Y      300    d.f.             1    g                    2.811                     
 Median Y    1.51254    Pr(> chi2) <0.0001    gr                  16.630                     
 max |deriv|   9e-06    Score chi2  271.61    |Pr(Y>=median)-0.5|  0.442                     
                        Pr(> chi2) <0.0001                                                   
 
    Coef   S.E.   Wald Z Pr(>|Z|)
 x1 5.6036 0.4369 12.83  <0.0001 
 
Parametric Survival Model: Log Normal Distribution
 
 psm(formula = Surv(d.time, death) ~ sex * pol(age, 2), data = data_psm, 
     dist = "lognormal")
 
                    Model Likelihood     Discrimination    
                       Ratio Test           Indexes        
 Obs        400    LR chi2      56.39    R2       0.154    
 Events      89    d.f.             5    Dxy      0.463    
 sigma 1.640564    Pr(> chi2) <0.0001    g        0.964    
                                         gr       2.622    
 
                  Coef    S.E.   Wald Z Pr(>|Z|)
 (Intercept)       9.0492 2.5313  3.57  0.0004  
 sex=Male         -5.4095 3.9482 -1.37  0.1706  
 age              -0.1815 0.0935 -1.94  0.0521  
 age^2             0.0011 0.0009  1.27  0.2029  
 sex=Male * age    0.2144 0.1518  1.41  0.1580  
 sex=Male * age^2 -0.0016 0.0014 -1.12  0.2640  
 Log(scale)        0.4950 0.0811  6.10  <0.0001 
 
Parametric Survival Model: Log Normal Distribution
 
 psm(formula = Surv(d.time, death) ~ sex * pol(age, 2), dist = "lognormal")
 
                    Model Likelihood     Discrimination    
                       Ratio Test           Indexes        
 Obs        400    LR chi2      56.39    R2       0.154    
 Events      89    d.f.             5    Dxy      0.463    
 sigma 1.640564    Pr(> chi2) <0.0001    g        0.964    
                                         gr       2.622    
 
                  Coef    S.E.   Wald Z Pr(>|Z|)
 (Intercept)       9.0492 2.5313  3.57  0.0004  
 sex=Male         -5.4095 3.9482 -1.37  0.1706  
 age              -0.1815 0.0935 -1.94  0.0521  
 age^2             0.0011 0.0009  1.27  0.2029  
 sex=Male * age    0.2144 0.1518  1.41  0.1580  
 sex=Male * age^2 -0.0016 0.0014 -1.12  0.2640  
 Log(scale)        0.4950 0.0811  6.10  <0.0001 
 
Parametric Survival Model: Log Normal Distribution
 
 psm(formula = Surv(d.time, death) ~ sex * pol(age, 2), dist = "lognormal")
 
                    Model Likelihood     Discrimination    
                       Ratio Test           Indexes        
 Obs        400    LR chi2      56.39    R2       0.154    
 Events      89    d.f.             5    Dxy      0.463    
 sigma 1.640564    Pr(> chi2) <0.0001    g        0.964    
                                         gr       2.622    
 
                  Coef    S.E.   Wald Z Pr(>|Z|)
 (Intercept)       9.0492 2.5313  3.57  0.0004  
 sex=Male         -5.4095 3.9482 -1.37  0.1706  
 age              -0.1815 0.0935 -1.94  0.0521  
 age^2             0.0011 0.0009  1.27  0.2029  
 sex=Male * age    0.2144 0.1518  1.41  0.1580  
 sex=Male * age^2 -0.0016 0.0014 -1.12  0.2640  
 Log(scale)        0.4950 0.0811  6.10  <0.0001 
 

intubate documentation built on May 2, 2019, 2:46 p.m.