Summary(addicts) # id clinic status survt Keep the id column and work with what we have.įor more information on the variables, the summary() and str() functions can be used. We have 238 rows but the last id number is 266. It may seem that the id column is redundant at first but if you look at the output from tail(addicts) you see that a few id numbers were skipped. # 6 6 1 1 714 0 55 tail(addicts) # id clinic status survt prison dose Head(addicts) # id clinic status survt prison dose The head() and tail() functions are used here to preview the data. It is usually a good idea to preview the data to have an idea of what the data looks like and the type of information you are dealing with. I then convert this into a ame and save it to the variable addicts. The read_data() function is needed to read the. # Import data and turn it into a data frame Library(haven) #For importing STATA files. # Survival Analysis - A Self Learning Text (3rd Edition) If the haven package is not installed into R, you can install haven by typing in: To fix this, the haven package in R is used to deal with the. The only slight issue is that the file is a. I propose that you can load this addicts dataset online under the link of. In the bookSurvival Analysis - A Self Learning Text (3rd Edition), the addicts dataset is loaded from the C:\ drive in your computer. 1 for yes, 0 for noĭOSE - Patient’s maximum methadone does (mg/day, continuous variable) PRISON - An indicator whether the patient had a prison record. STATUS - 1 for patient dropped out of the clinic or censored o otherwiseĬLINIC - Methadone Treatment Clinic Number 1 or 2 SURVT - The time in days until the patient dropped out of the clinic or was censored (missing information). In the addicts dataset, the variables are defined as: ![]() The patient’s survival time (in days) is the amount of time the patient spent at the clinic before dropping out. A 1991 Australian study by Caplehorn et al. compared two methadone clinics for heroin addicts. This information is from the Survival Analysis - A Self Learning Text (3rd Edition, 2012). dta file or a STATA file so the haven package in R is needed to deal with this file type. This addicts dataset can be downloaded from the website.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |