I provide you with a small example in which the response variable takes discrete values. There are no covariates, and no different categories (just one, treatment group)

The idea is to observe if one treatment is performing effect through a scale (response variable). All participants are in the treatment group.

Does it make sense to create a treatment variable with one level and time? Or just time alone?

#running 2 models with and without categorical

model1 <- lme(value ~ time, random = ~ time| id, 
              na.action = na.omit)
model2 <- lme(value ~ time + categorical, random = ~ time| id, 
              na.action = na.omit)

Running model2 seems not to work because it has only one level. In my mind, model1 seems to be correct but I was waiting for some advice

ex_fib <- structure(list(ID = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
    4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 
    9L, 9L, 10L, 10L, 10L), Time = c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 
    3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 
    1L, 2L, 3L, 1L, 2L, 3L), Categorical = c("A", "A", "A", "A", "A", 
    "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", 
    "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A"), 
    Value = c(10L, 12L, 14L, 5L, 6L, 8L, 15L, 16L, 18L, 7L, 9L, 11L, 
    13L, 14L, 16L, 12L, 15L, 18L, 6L, 7L, 9L, 11L, 12L, 13L, 8L, 10L, 
    11L, 9L, 12L, 14L)), class = "data.frame", 
    row.names = c(NA, -30L))
  • 5
    $\begingroup$ You can't model the effect of variable that does not vary, so model 2 doesn't make much sense. You can't model the effect of your treatment, if all participants had the treatment. What would you be comparing it to? However, I don't understand what you are trying to do, i.e. I can't parse this sentence: "The idea is observing if one treatment is performing effect through an scale (response variable). " $\endgroup$
    – Axeman
    Apr 18, 2023 at 17:34
  • $\begingroup$ I want to see if across time is there any substantial change in itching through the scale (response variable, a dicrete quantitative). model1 with time accounting for all the repeated measures is going to tell me if there is significant change along time? $\endgroup$ Apr 18, 2023 at 17:50
  • $\begingroup$ I don't know what "itching through the scale" means, but if you want to test for a linear relationship between time and value, while accounting for repeated measures, then model 1 looks right to me. $\endgroup$
    – Axeman
    Apr 18, 2023 at 18:07
  • $\begingroup$ It is an scale with discrete values (1 to 25). The patients undergo a treatment, so we want to measure if across all measures of the itching using this scale there has been an improvement. $\endgroup$ Apr 18, 2023 at 18:25
  • $\begingroup$ time is not present in ex_fib. $\endgroup$
    – utobi
    Apr 18, 2023 at 19:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.