update
This commit is contained in:
parent
8629a52530
commit
613cdc34f4
2 changed files with 786 additions and 281 deletions
24
report.Rmd
24
report.Rmd
|
|
@ -546,23 +546,20 @@ recode.age <- function(dat, ages) {
|
||||||
dat.age.rec <- dat[!is.na(dat$age.rec), ]
|
dat.age.rec <- dat[!is.na(dat$age.rec), ]
|
||||||
class.age <- function(age) {
|
class.age <- function(age) {
|
||||||
if (age < 2) {
|
if (age < 2) {
|
||||||
return("0,1")
|
return("0-1")
|
||||||
} else if (age < 6) {
|
} else if (age < 6) {
|
||||||
return("2,3,4,5")
|
return("2-5")
|
||||||
} else if (age < 11) {
|
} else if (age < 11) {
|
||||||
return("6,7,8,9,10")
|
return("6-10")
|
||||||
} else if (age < 19) {
|
} else if (age < 19) {
|
||||||
return("11-18")
|
return("11-18")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
```{r}
|
|
||||||
dat.age.rec$age.group <- sapply(dat.age.rec$age.rec, class.age) |>
|
dat.age.rec$age.group <- sapply(dat.age.rec$age.rec, class.age) |>
|
||||||
factor(levels = c(
|
factor(levels = c(
|
||||||
"0,1",
|
"0-1",
|
||||||
"2,3,4,5",
|
"2-5",
|
||||||
"6,7,8,9,10",
|
"6-10",
|
||||||
"11-18"
|
"11-18"
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
@ -574,9 +571,6 @@ cox.age.rec <- coxph(Surv(follow.up, death) ~ age.group, data = dat.age.rec)
|
||||||
emmeans(cox.age.rec, pairwise ~ age.group, type = "response")
|
emmeans(cox.age.rec, pairwise ~ age.group, type = "response")
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
|
||||||
cox.age.rec |> ggsurvfit()
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# Exercise 7
|
# Exercise 7
|
||||||
|
|
@ -705,6 +699,7 @@ H1: PH-assumption doesn't hold
|
||||||
# different cox model!!
|
# different cox model!!
|
||||||
cox.final <- coxph(Surv(follow.up, death) ~ tx.type + age.rec + hla.match + age.donor, data = dat)
|
cox.final <- coxph(Surv(follow.up, death) ~ tx.type + age.rec + hla.match + age.donor, data = dat)
|
||||||
cox.zph(cox.final)
|
cox.zph(cox.final)
|
||||||
|
cox.final
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -715,6 +710,11 @@ A non-random pattern or slope in a plot of scaled residuals against time indicat
|
||||||
plot(cox.zph(cox.final))
|
plot(cox.zph(cox.final))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```{r, fig.width=10, fig.height=10}
|
||||||
|
plot(cox.zph(cox.final))
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
|
|
|
||||||
1027
slides.Rmd
1027
slides.Rmd
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue