Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • strsmix (split population survival models): Factor-variable operators not allowed?

    Dear StataList users,

    I am trying to run a model of farmers' time to adoption of an innovation using Stata v.15.1. For this, I have considered using a split-population (cure) duration model through the Stata command STRSMIX. The problem is that I am being prevented to run the model due to getting the following message:

    factor-variable and time-series operators not allowed
    r(101);
    The model does have various independent variables that come in categories. These include access to irrigation (1/0); location - for 2 provinces (1/0); education level (study) (3/2/1); off-farm income (1/0); subsistence farming (1/0); and belonging to a certain social group (4/3/2/1).

    My syntax looks as follows:


    stset t_end, failure(event==1)

    strsmix animalintensity cultivatedland i.irrigation ownrentratio i.locationdum machineindex experiencen fsworkage i.estudios3 lifequality i.offfarmincome i.subsistfarmer i.socclass4, dist(weibull) link(loglog) bhazard(rate0)
    I wonder what could be the problem here, or if instead I should resort to model commands such as CUREREGR, which does allow me to use factor-variables, but is apparently limited when it comes to making predictions.

    Many thanks, Jesus P.

  • #2
    The problem is that -strsmix- is a user written command, and the user who have written it has written it like this that it does not understand factor variable notation.

    Just generate the dummy variables that you need in the regression manually, and put them in as normal dummy regressors.

    Comment


    • #3
      Thanks very much for your suggestion Joro. I've indeed manually transformed my factor-variables into normal dummy regressors, using the instructions provided in https://stats.idre.ucla.edu/stata/we...al-predictors/.

      My strsmix regression is now stuck now from a pop up error "could not calculate numerical derivatives missing values encountered r(430); - I attribute this to my use of the "identity" link, which nevertheless works while using the "linear" link in the cureregr command. But that is perhaps a question for another thread.

      Thanks for your help, as it indeed provided the solution to my question.

      Jesus

      Comment

      Working...
      X