This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| subdistn <- function(survData){ | |
| ## substitute in later times to change risk sets | |
| ## time representation appropriate for subdistribution hazards | |
| ## | |
| ## Accounts for administrative censoring | |
| ## note that within a specific organism subset the maximum time | |
| ## may be from a patient infected by a different organism | |
| ## default entries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tvCox <- function(survData, covariates, type){ | |
| ## | |
| ## time-dependent hazard array representation | |
| ## can specify which time to use: cause specific or subdistributions | |
| ## | |
| ## survData: survival data subset of total.data with indicators | |
| ## covariates: e.g. c("age", "agegr", "cath", "surgical", "gender") | |
| ## type: type of hazard functions to use | |
| ## "" - Cause-specific | |
| ## "death" - subdistribution time-to-death |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##################################### | |
| # | |
| # Cox regression aggregated functions | |
| # | |
| # Nathan Green | |
| # 11-2012 | |
| # | |
| ##################################### | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################ | |
| ###GUM2011AllPositivity##### | |
| ############################ | |
| summary(dat$totalPositivity2011GUM) | |
| hist(dat$totalPositivity2011GUM) | |
| modpos<-glm(totalPositivity2011GUM~ratioWhite2011+ratioBlack2011+ratioAsian2011+ | |
| conception.rate.per.1000women.Under18+MarriedCivilCohabitCouples2011+SingleParents2011+ | |
| ratioNoQual_2011+ratioMales25to34_2011+RatioFemales16to24_2011, | |
| family=binomial,data=dat,weights=sum.NtestsGUM2011All) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| charlson2 <- function (Patient, icd) | |
| { | |
| ## | |
| ## | |
| ## | |
| ## foo <- charlson2(Patient=survData$Spell, icd=survData$Prim.Diag.Code) | |
| d <- cbind.data.frame(Patient, icd) | |
| nobs <- nrow(d) | |
| d$code <- rep(NA, nobs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library("R2wd") | |
| require(R2wd) | |
| wdGet(T) # If no word file is open, it will start a new one - can set if to have the file visiable or not | |
| wdNewDoc("H:\\This.doc") # this creates a new file with "this.doc" name | |
| wdApplyTemplate("H:\\This.dot") # this applies a template |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##e.g. data from kmi in LOS_toy_example.R | |
| ##non-infected only | |
| #data <- data[-173,] | |
| ## (death) count at each event time | |
| nDx <- table(data$exit) | |
| ## event times | |
| times <- as.numeric(names(table(data$exit))) |
NewerOlder