This problem makes use of the BrainCancer
dataset in he ISLR2
package.
survfit()
function in the survival
package. Store the model in the variable fit.km1
.
fit.cox
. Summarize the main findings and answer the questions
below.
sexMale
and ki
diagnosisLG glioma
and diagnosisHG glioma
diagnosisHG glioma
and ki
diagnosisLG glioma
and ki
ki
, adjusting for the other predictors (!!!).
ki
and replace the value 40 by the value 60 (i.e. 40 becomes 60). Store the adjusted column ki
back in the BrainCancer dataframe. (Hint: you can use the function unique()
to
check the unique values of ki
).ki
from low to high and order the columns as follows: ki
, sex
, diagnosis
, loc
, gtv
, stereo
.
Store the dataframe in modeldata
. You can use this function to get the mode of a factor:
mode <- function(col) {
return(names(which.max(table(col))))
}
fit.km2
.Assume that:
ISLR2
library has been loaded.survival
library has been loaded.BrainCancer
dataset has been loaded and attached.