+ Reply to Thread
Results 1 to 1 of 1

Thread: Mixed factor and numeric model

  1. #1
    Points: 944, Level: 16
    Level completed: 44%, Points required for next Level: 56

    Thanked 0 Times in 0 Posts

    Mixed factor and numeric model


    I have a predictive model with three predictive variables: two factors, Status and StatusNew; and a numeric one, Weekband. I'm trying to use these three to predict the value of a fourth column, Value.

    The model is the attached .txt file in csv format
    transition.map.incomplete <- read.csv('./transition.map.test.txt')
    I've tried using glm with lots of different formulae and families, e.g.
    model <- glm(Value ~ I((Weekband)^2) / (Status * StatusNew), 
                 family = Gamma)
    but they all do a poor job of modelling the actual transitions (see attached image):
    transition.map.model <- transition.map.incomplete
    transition.map.model$model <- predict(model, transition.map.incomplete, type="response")
    transition.map.model %>%
      filter(Weekband <= 52) %>%
      ggplot() +
      aes(x=Weekband) +
      geom_point(aes(y=Value), colour="blue") +
      geom_line(aes(y=model), colour="red") +
      facet_wrap(~ interaction(Status, StatusNew, sep="->"), ncol=7)
    I'm sure there's a way I can build a model without having to consider each transition A->B, A->C,...,D->E,...,G-H,H->A,...,etc. separately.

    Any help would be greatly appreciated.

    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	modelling.jpg‎
Views:	27
Size:	23.3 KB
ID:	6755  
    Attached Files

+ Reply to Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Advertise on Talk Stats