Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205301

Parametric Survival Analysis - Stata vs. R

$
0
0

I am trying to set up a survival analysis in R for which I have a data set with economic data and the code for Stata. The goal of the analysis is to see which impact covariates have on the survival of economic growth spells.

I am having problems recreating the set up since it seems the stset in Stata does some kind of mutation on the data and I can't seem to replicate it in R.

This is the stata code, I will provide a link to the dataset at the end of the topic.

stset year, id(spell_ids_10) fail(acc_stop_10) origin(acc_startpl4_10==1) # setting up survival data

streg gini_net redist_baseline income_pc_10_0 , d(w) notime # regression

How would I go about setting that up in R? I am especially having trouble with the time and id. Stata takes as an input a year while in R it seems I have to put in amount in days, correct? The second point I am struggling with is to set up my Surv data as panel data, since my subjects (in this case countries) may enter growth spells more than one time in my time frame. Stata takes ID as an input but I don't seem to be able to do it in R.

It seems very easy to set this up in Stata and very complicated in R. Thanks a lot for considering my problem!

growth spells data


Viewing all articles
Browse latest Browse all 205301

Trending Articles