27.11.2012 Views

Demography and epidemiology: Practical use of the Lexis diagram ...

Demography and epidemiology: Practical use of the Lexis diagram ...

Demography and epidemiology: Practical use of the Lexis diagram ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

26 Renal-ex.R<br />

Loading required package: splines<br />

> library( splines )<br />

> library( Epi )<br />

><br />

> load( file="c:/Bendix/Steno/PHov/nefro/data/ESRD.Rdata" )<br />

> names( tot )[grep("diag",names(tot))] str( tot )<br />

`data.frame': 154 obs. <strong>of</strong> 11 variables:<br />

$ ptnr : num 17 26 26 27 33 33 42 42 46 47 ...<br />

$ sex : num 1 2 2 2 1 1 2 2 2 1 ...<br />

$ hba1c : num 10.46 10.60 10.60 8.00 9.64 ...<br />

$ ddate : num 1994 1987 1987 1985 1993 ...<br />

$ entry : num 1996 1990 1990 1988 1995 ...<br />

$ exit : num 1997 1990 1996 1993 1996 ...<br />

$ fail : int 1 0 1 1 0 0 0 0 1 1 ...<br />

$ birth : num 1968 1959 1959 1962 1951 ...<br />

$ rem : num 0 0 1 0 0 1 0 1 0 0 ...<br />

$ event : num 2 1 1 3 0 0 0 0 2 1 ...<br />

$ eventdat: num 1997 1996 1996 1993 2004 ...<br />

> tot[1:10,]<br />

ptnr sex hba1c ddate entry exit fail birth rem event eventdat<br />

1 17 1 10.46 1993.513 1996.013 1997.094 1 1967.944 0 2 1997.094<br />

2 26 2 10.60 1987.035 1989.535 1989.814 0 1959.306 0 1 1996.136<br />

3 26 2 10.60 1987.035 1989.814 1996.136 1 1959.306 1 1 1996.136<br />

4 27 2 8.00 1985.346 1987.846 1993.239 1 1962.014 0 3 1993.239<br />

5 33 1 9.64 1992.743 1995.243 1995.717 0 1950.747 0 0 2003.993<br />

6 33 1 9.64 1992.743 1995.717 2003.993 0 1950.747 1 0 2003.993<br />

7 42 2 NA 1985.384 1987.884 1996.650 0 1961.296 0 0 2003.955<br />

8 42 2 NA 1985.384 1996.650 2003.955 0 1961.296 1 0 2003.955<br />

9 46 2 NA 1980.919 1983.419 1991.484 1 1952.374 0 2 1991.484<br />

10 47 1 9.30 1984.404 1986.904 1993.650 1 1956.064 0 1 1993.650<br />

> # There is a bug in <strong>the</strong> coding <strong>of</strong> date <strong>of</strong> birth<br />

> tot$birth 2000 )<br />

><br />

> # Fit <strong>the</strong> Cox-models as reported in <strong>the</strong> paper<br />

> # Date <strong>of</strong> birth as explanatory variable<br />

> mb summary( mb )<br />

Call:<br />

coxph(formula = Surv(entry - ddate, exit - ddate, fail) ~ sex +<br />

I((birth - 1955)/10) + rem, data = tot)<br />

n= 154<br />

coef exp(coef) se(coef) z p<br />

sex -0.0432 0.958 0.275 -0.157 0.8800<br />

I((birth - 1955)/10) -0.3776 0.686 0.130 -2.908 0.0036<br />

rem -1.2593 0.284 0.385 -3.275 0.0011<br />

exp(coef) exp(-coef) lower .95 upper .95<br />

sex 0.958 1.04 0.559 1.642<br />

I((birth - 1955)/10) 0.686 1.46 0.531 0.884<br />

rem 0.284 3.52 0.134 0.603<br />

Rsquare= 0.146 (max possible= 0.984 )<br />

Likelihood ratio test= 24.4 on 3 df, p=2.10e-05<br />

Wald test = 20.4 on 3 df, p=0.000138<br />

Score (logrank) test = 22.2 on 3 df, p=5.89e-05<br />

><br />

> # Age at entry as explanatory variable<br />

> ma summary( ma )<br />

Call:<br />

coxph(formula = Surv(entry - ddate, exit - ddate, fail) ~ sex +<br />

I((ddate - birth - 50)/10) + rem, data = tot)<br />

n= 154<br />

sex<br />

I((ddate - birth - 50)/10)<br />

rem<br />

coef exp(coef) se(coef) z p<br />

-0.0553 0.946 0.275 -0.201 0.84000<br />

0.5219 1.685 0.137 3.822 0.00013<br />

-1.2624 0.283 0.385 -3.280 0.00100<br />

exp(coef) exp(-coef) lower .95 upper .95<br />

sex 0.946 1.057 0.552 1.622<br />

I((ddate - birth - 50)/10) 1.685 0.593 1.290 2.202<br />

rem 0.283 3.534 0.133 0.602<br />

Rsquare= 0.179 (max possible= 0.984 )<br />

Likelihood ratio test= 30.3 on 3 df, p=1.19e-06<br />

Wald test = 27.1 on 3 df, p=5.68e-06<br />

Score (logrank) test = 29.4 on 3 df, p=1.84e-06<br />

>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!