Page 1 of 1

accounting for 2 levels of panel data

Posted: 18 Mar 2022, 05:57
by sarah.hill.phmr
hi,

I am trying to estimate a main-effects model with panel data but I have 2 levels of panel data and I am unsure how to account for this.

1) each respondent answered 7 choice questions within a survey - these are related by the surveyID
2) each respondent answered 2 surveys at different time points - these are related by the personID

I have the ID for my overall model set at the personID level so that all responses from the same person are considered panel data. However, I also expect there may be heterogeneity between the same person's responses over the two surveys completed at different time points but I am unsure how to capture this additional layer of heterogeneity. Or should I have the ID for the model set at the surveyID level instead and account for the repeated measures another way?

My choices are unlabelled and my main effects utility functions are as follows:

V[["alt1"]] = asc1 + b_mo * MO_A + b_sc * SC_A + b_ua * UA_A + b_pd * PD_A + b_ad * AD_A
V[["alt2"]] = b_mo * MO_B + b_sc * SC_B + b_ua * UA_B + b_pd * PD_B + b_ad * AD_B

MO, SC, UA, PD and AD all refer to the 5 dimensions of the EQ5D5l questionnaire.

Any guidance would be greatly appreciated :)

Sarah

Re: accounting for 2 levels of panel data

Posted: 18 Mar 2022, 16:46
by dpalma
Hi Sarah,

There are different ways to account for the multiple levels of heterogenity. What I would recommend is keeping personID as the model main ID, while accounting for the difference in the two surveys through a scale parameter. Example MNL_RP_SP from the examples webpage shows how to estimate scale differences when using two data sources (in your case, the two surveys).

For reference, the relevant parts of your model script should look as below. I am assuming responses from survey 1 and survey 2 are in different rows in the data. If mu_2 is bigger than 1, it means that the second survey has lower noise than the first one. If mu_2 is smaller than 1 it means that the second survey has more noise than the first one. The estimated value of the scale factors (mu_1, mu_2 ) should always be positive.

Best wishes
David

Code: Select all

apollo_control = list(
  ...
  indivID         = "personID"
)

apollo_beta = c(asc1 = 0, 
                b_mo = 0, 
                b_sc = 0, 
                b_uo = 0, 
                b_pd = 0, 
                b_ad = 0, 
                mu_1 = 1, 
                mu_2 = 1)

apollo_fixed = c("mu_1")

...

apollo_probabilities=function(apollo_beta, apollo_inputs, 
                              functionality="estimate"){
  
  ### Initialise
  apollo_attach(apollo_beta, apollo_inputs)
  on.exit(apollo_detach(apollo_beta, apollo_inputs))
  P = list()
  
  ### List of utilities (before applying scales)
  V = list()
  V[["alt1"]] = asc1 + b_mo*MO_A + b_sc*SC_A + b_ua*UA_A + b_pd*PD_A + b_ad*AD_A
  V[["alt2"]] =        b_mo*MO_B + b_sc*SC_B + b_ua*UA_B + b_pd*PD_B + b_ad*AD_B
  
  ### Compute probabilities for the first survey
  mnl_settings_1 = list(
    alternatives  = c(alt1=1, alt2=2),  
    choiceVar     = choice, 
    utilities     = list(alt1 = mu_1*V[["alt1"]],
                         alt2 = mu_1*V[["alt2"]]),
    rows          = (surveyID==1)
  )
  P[["survey1"]] = apollo_mnl(mnl_settings_1, functionality)
  
  ### Compute probabilities for the second survey
  mnl_settings_2 = list(
    alternatives  = c(alt1=1, alt2=2),  
    choiceVar     = choice, 
    utilities     = list(alt1 = mu_2*V[["alt1"]],
                         alt2 = mu_2*V[["alt2"]]),
    rows          = (surveyID==2)
  )
  P[["survey2"]] = apollo_mnl(mnl_settings_2, functionality)
  
  ### Prepare probs and return
  P = apollo_combineModels(P, apollo_inputs, functionality)
  P = apollo_panelProd(P, apollo_inputs, functionality)
  P = apollo_prepareProb(P, apollo_inputs, functionality)
  return(P)
}

Re: accounting for 2 levels of panel data

Posted: 23 Mar 2022, 13:18
by sarah.hill.phmr
Thanks David, that's really useful!

Just to be sure I am intpreting this correctly, by more "noise" do you mean that responses to survey 2 (mu_2 is <1) produce less reliable estimates than responses to survey 1?

Thanks,
Sarah

Re: accounting for 2 levels of panel data

Posted: 24 Mar 2022, 06:25
by stephanehess
Sarah

I wouldn't call the estimates less reliable. What it means is that from the perspective of the model, the choices are less deterministic

Stephane