Advertisement
Radeen10-_

adeeba

May 16th, 2025
1,833
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 37.18 KB | None | 0 0
  1. rm(list = ls())
  2.  
  3. library(apollo)
  4. library(tidyverse)
  5. library(dplyr)
  6. library(psych)
  7. library(utils)
  8. library(fastDummies)
  9. library(cutoff)
  10. library(lavaan)
  11. library(semPlot)
  12. library(StatMatch)
  13. library(semTools)
  14. library(SciViews)
  15. library(readxl)
  16.  
  17. # ─────────────────────────────────────────────────────────────────────────────
  18. # 1.  Data wrangling  ---------------------------------------------------------
  19. # ─────────────────────────────────────────────────────────────────────────────
  20. data <- read_excel("D:/adeeba/Dataset_long.xlsx")
  21.  
  22. data <- data %>%
  23.   mutate(across(c(2, 4, 62, 63, 76, 79, 81, 83, 85, 88, 90, 182:186, 188,
  24.                   222, 223), as.factor)) %>%
  25.   dummy_cols(
  26.     select_columns = c("marry_stat", "education", "student", "emp_stat",
  27.                        "emp_arrange", "license", "hh_living_stat", "hh_years",
  28.                        "personal_income", "family_income"),
  29.     remove_selected_columns = TRUE
  30.   ) %>%
  31.   mutate(
  32.     edu_below_uni            = education_1 + education_2,
  33.     student                  = student_3 + student_2,
  34.     employed                 = emp_stat_3 + emp_stat_4,
  35.     hybrid_worker            = emp_arrange_3 + emp_arrange_4 + emp_arrange_5,
  36.     living_with_family       = hh_living_stat_3 + hh_living_stat_4 + hh_living_stat_5,
  37.     hh_years_above_5         = hh_years_4 + hh_years_5,
  38.     personal_income_above_25k= personal_income_3 + personal_income_4 +
  39.       personal_income_5 + personal_income_6 +
  40.       personal_income_7 + personal_income_8,
  41.     personal_income_above_50k= personal_income_4 + personal_income_5 +
  42.       personal_income_6 + personal_income_7 +
  43.       personal_income_8,
  44.     family_income_above_50k  = family_income_4 + family_income_5 +
  45.       family_income_6 + family_income_7 +
  46.       family_income_8 + family_income_9 +
  47.       family_income_10 + family_income_11,
  48.     family_income_above_100k = family_income_6 + family_income_7 +
  49.       family_income_8 + family_income_9 +
  50.       family_income_10 + family_income_11
  51.   )
  52.  
  53. database <- data
  54. database$bus.crowd2     <- ifelse(database$bus.crowd == 2, 1, 0)
  55. database$bus.crowd3     <- ifelse(database$bus.crowd == 3, 1, 0)
  56. database$transit.crowd2 <- ifelse(database$transit.crowd == 2, 1, 0)
  57. database$transit.crowd3 <- ifelse(database$transit.crowd == 3, 1, 0)
  58.  
  59. database$best <- case_when(
  60.   database$choice == "privatecar" ~ 1,
  61.   database$choice == "ubercar"    ~ 2,
  62.   database$choice == "cng"        ~ 3,
  63.   database$choice == "bike"       ~ 4,
  64.   database$choice == "rickshaw"   ~ 5,
  65.   database$choice == "bus"        ~ 6,
  66.   database$choice == "transit"    ~ 7
  67. )
  68.  
  69. # remove any previously calculated LV columns that may exist
  70. database <- database[ , !names(database) %in%
  71.                         c("decisionoverload","hassle","knowledge",
  72.                           "socialnorms","attmultimodality")]
  73.  
  74. # ─────────────────────────────────────────────────────────────────────────────
  75. # 2.  Apollo set-up  ----------------------------------------------------------
  76. # ─────────────────────────────────────────────────────────────────────────────
  77. apollo_initialise()
  78.  
  79. apollo_control <- list(
  80.   modelName  = "Congestion Mode Choice Model (ICLV_OL_500_orig spec)",
  81.   modelDescr = "Mixed Logit model with OL",
  82.   indivID    = "id",
  83.   nCores     = 4
  84. )
  85.  
  86. apollo_beta = c(
  87.   ### Alternative Specific Constants (ASC) – base case is PrivateCar
  88.   asc_pc        = 0,
  89.   asc_ubercar   = 0,  # Ride-hailing car
  90.   asc_cng       = 0,  # Ride-hailing cng
  91.   asc_bike      = 0,  # Ride-hailing bike
  92.   asc_rickshaw  = 0,  # Rickshaw
  93.   asc_bus       = 0,  # Bus
  94.   asc_transit   = 0,  # Transit (MRT/BRT)
  95.  
  96.   ### Travel Time Coefficients
  97.   b_attc        = -0.0591,   # Average travel time for PrivateCar
  98.   b_attr        = -0.0321,   # Average travel time for Rickshaw
  99.   b_attb        = -0.0351,   # Average travel time for Bus
  100.   b_attt        = -0.0600,   # Average travel time for Transit
  101.   b_attbike     = -0.0591,   # Average travel time for RH bike
  102.  
  103.   # Means of random parameters
  104.   mu_conttc   = -0.006,  # PrivateCar
  105.   mu_conttr   = -0.008,  # Rickshaw
  106.   mu_conttb   = -0.015,  # Bus
  107.   mu_conttt   = -0.013,  # Transit
  108.   mu_conttbike= -0.008,  # RideHailingBike
  109.  
  110.   mu_uncerc   = -0.006,  # PrivateCar
  111.   mu_uncerr   = -0.010,  # Rickshaw
  112.   mu_uncerb   = -0.015,  # Bus
  113.   mu_uncerbike= -0.006,  # RideHailingBike
  114.  
  115.   # Standard deviations of random parameters
  116.   sigma_conttc   = 0.002,
  117.   sigma_conttr   = 0.002,
  118.   sigma_conttb   = 0.002,
  119.   sigma_conttt   = 0.002,
  120.   sigma_conttbike= 0.002,
  121.  
  122.   sigma_uncerc   = 0.002,
  123.   sigma_uncerr   = 0.002,
  124.   sigma_uncerb   = 0.002,
  125.   sigma_uncerbike= 0.002,
  126.  
  127.   ### Cost
  128.   b_cost        = -0.0107,   # Cost (PrivateCar, Rickshaw, Bus, Transit)
  129.   b_parkfee     = -0.03,     # Parking fee – only for PrivateCar
  130.  
  131.   ### Wait Time and Walk Time
  132.   b_wait        = -0.08,     # Waiting time for Ride-hailing, Rickshaw, Transit, Bus
  133.   b_walk        = -0.07,     # Walking time for Bus and Transit
  134.  
  135.   ### Transfers
  136.   b_transfers   = -0.5,      # Number of transfers (Bus, Transit)
  137.  
  138.   ### Crowding
  139.   b_crowd_2     = -0.4,      # Crowding level 1 (moderately crowded)
  140.   b_crowd_3     = -0.4,      # Crowding level 2 (very crowded)
  141.  
  142.   ### Schedule Reliability
  143.   b_schedule    = 0.4,       # Schedule dummy = 1 if reliable (Bus and Transit)
  144.  
  145.   ### Park-and-Ride
  146.   b_pnr         = 0.3,       # PNR facility dummy – Transit only
  147.  
  148.   ### Grade-Separated Infrastructure
  149.   b_grade       = 0.5,      # Dummy: 1 if MRT (fully grade-separated Transit), Dummy: 0 if BRT
  150.  
  151.  
  152.   # MIMIC parameters
  153.  
  154.   # Decision Overload
  155.   g_age_do                         = 1,
  156.   g_student_do                     = 1,
  157.   g_edu_below_uni_do               = 1,
  158.   g_hh_years_above_5_do            = 1,
  159.   g_personal_income_above_50k_do   = 1,
  160.   g_family_income_above_50k_do     = 1,
  161.   g_license_2_do                   = 1,
  162.   g_dissonant_user_do              = 1,
  163.   g_pv_avail_number_do             = 1,
  164.   g_commuting_mmi_do               = 1,
  165.   g_passes_yes_do                  = 1,
  166.  
  167.   # Hassle
  168.   g_age_hs                         = 1,
  169.   g_student_hs                     = 1,
  170.   g_edu_below_uni_hs               = 1,
  171.   g_hh_years_above_5_hs            = 1,
  172.   g_personal_income_above_50k_hs   = 1,
  173.   g_family_income_above_50k_hs     = 1,
  174.   g_license_2_hs                   = 1,
  175.   g_commuting_mmi_hs               = 1,
  176.   g_marry_stat_1_hs                = 1,
  177.   g_employed_hs                    = 1,
  178.   g_do_hs                          = 1,  # linking latent variable decisionoverload to hassle
  179.  
  180.   # Attitude toward Multimodality
  181.   g_age_att                    = 1,
  182.   g_edu_below_uni_att          = 1,
  183.   g_family_income_above_50k_att= 1,
  184.   g_license_2_att              = 1,
  185.   g_dissonant_user_att         = 1,
  186.   g_marry_stat_1_att           = 1,
  187.   g_gender_att                 = 1,
  188.   g_employed_att               = 1,
  189.   g_pv_access_att              = 1,
  190.   g_disabled_yes_att           = 1,
  191.   g_employed_mm_view           = 1,
  192.  
  193.   # Social Norms
  194.   g_age_sn                     = 1,
  195.   g_student_sn                 = 1,
  196.   g_edu_below_uni_sn           = 1,
  197.   g_hh_years_above_5_sn        = 1,
  198.   g_family_income_above_50k_sn = 1,
  199.   g_license_2_sn               = 1,
  200.   g_dissonant_user_sn          = 1,
  201.   g_commuting_mmi_sn           = 1,
  202.   g_marry_stat_1_sn            = 1,
  203.  
  204.   # Knowledge
  205.   g_age_ka                 = 1,
  206.   g_edu_below_uni_ka       = 1,
  207.   g_hh_years_above_5_ka    = 1,
  208.   g_license_2_ka           = 1,
  209.   g_dissonant_user_ka      = 1,
  210.   g_commuting_mmi_ka       = 1,
  211.   g_gender_ka              = 1,
  212.  
  213.  
  214.   # Measurement equations parameters
  215.   z_do4 = 1, z_do5 = 1,
  216.   z_ka1 = 1, z_ka2 = 1, z_ka3 = 1,
  217.   z_hs1 = 1, z_hs2 = 1, z_hs3 = 1, z_hs4 = 1, z_hs5 = 1, z_hs6 = 1, z_hs7 = 1,
  218.   z_att1= 1, z_att2= 1, z_att3= 1, z_att5= 1, z_att6= 1,
  219.   z_sn1 = 1, z_sn2 = 1, z_sn3 = 1,
  220.  
  221.   # Decision Overload
  222.   tau_do4_1 = -2, tau_do4_2 = -1, tau_do4_3 = 1, tau_do4_4 = 2,
  223.   tau_do5_1 = -2, tau_do5_2 = -1, tau_do5_3 = 1, tau_do5_4 = 2,
  224.  
  225.   # Knowledge Adequacy
  226.   tau_ka1_1 = -2, tau_ka1_2 = -1, tau_ka1_3 = 1, tau_ka1_4 = 2,
  227.   tau_ka2_1 = -2, tau_ka2_2 = -1, tau_ka2_3 = 1, tau_ka2_4 = 2,
  228.   tau_ka3_1 = -2, tau_ka3_2 = -1, tau_ka3_3 = 1, tau_ka3_4 = 2,
  229.  
  230.   # Hassle
  231.   tau_hs1_1 = -2, tau_hs1_2 = -1, tau_hs1_3 = 1, tau_hs1_4 = 2,
  232.   tau_hs2_1 = -2, tau_hs2_2 = -1, tau_hs2_3 = 1, tau_hs2_4 = 2,
  233.   tau_hs3_1 = -2, tau_hs3_2 = -1, tau_hs3_3 = 1, tau_hs3_4 = 2,
  234.   tau_hs4_1 = -2, tau_hs4_2 = -1, tau_hs4_3 = 1, tau_hs4_4 = 2,
  235.   tau_hs5_1 = -2, tau_hs5_2 = -1, tau_hs5_3 = 1, tau_hs5_4 = 2,
  236.   tau_hs6_1 = -2, tau_hs6_2 = -1, tau_hs6_3 = 1, tau_hs6_4 = 2,
  237.   tau_hs7_1 = -2, tau_hs7_2 = -1, tau_hs7_3 = 1, tau_hs7_4 = 2,
  238.  
  239.   # Attitude Toward Multimodality
  240.   tau_att1_1 = -2, tau_att1_2 = -1, tau_att1_3 = 1, tau_att1_4 = 2,
  241.   tau_att2_1 = -2, tau_att2_2 = -1, tau_att2_3 = 1, tau_att2_4 = 2,
  242.   tau_att3_1 = -2, tau_att3_2 = -1, tau_att3_3 = 1, tau_att3_4 = 2,
  243.   tau_att5_1 = -2, tau_att5_2 = -1, tau_att5_3 = 1, tau_att5_4 = 2,
  244.   tau_att6_1 = -2, tau_att6_2 = -1, tau_att6_3 = 1, tau_att6_4 = 2,
  245.  
  246.   # Social Norms
  247.   tau_sn1_1 = -2, tau_sn1_2 = -1, tau_sn1_3 = 1, tau_sn1_4 = 2,
  248.   tau_sn2_1 = -2, tau_sn2_2 = -1, tau_sn2_3 = 1, tau_sn2_4 = 2,
  249.   tau_sn3_1 = -2, tau_sn3_2 = -1, tau_sn3_3 = 1, tau_sn3_4 = 2
  250. )
  251.  
  252.  
  253. apollo_fixed <- c()  # nothing fixed
  254.  
  255. # ─────────────────────────────────────────────────────────────────────────────
  256. # 3.  Draws and random coefficients  -----------------------------------------
  257. # ─────────────────────────────────────────────────────────────────────────────
  258. apollo_draws <- list(
  259.   interDrawsType = "halton",
  260.   interNDraws    = 100,
  261.   interNormDraws = c("eta_do","eta_ka","eta_hs","eta_att","eta_sn",
  262.                      "draws_conttc","draws_conttr","draws_conttb",
  263.                      "draws_conttt","draws_conttbike",
  264.                      "draws_uncerc","draws_uncerr","draws_uncerb",
  265.                      "draws_uncerbike")
  266. )
  267.  
  268. apollo_randCoeff <- function(apollo_beta, apollo_inputs){
  269.   rc <- list()
  270.  
  271.   ##  random coefficients for travel-time congestion & uncertainty  ----------
  272.   rc$b_conttc    <- -exp(mu_conttc    + sigma_conttc    * draws_conttc)
  273.   rc$b_conttr    <- -exp(mu_conttr    + sigma_conttr    * draws_conttr)
  274.   rc$b_conttb    <- -exp(mu_conttb    + sigma_conttb    * draws_conttb)
  275.   rc$b_conttt    <- -exp(mu_conttt    + sigma_conttt    * draws_conttt)
  276.   rc$b_conttbike <- -exp(mu_conttbike + sigma_conttbike * draws_conttbike)
  277.  
  278.   rc$b_uncerc    <- -exp(mu_uncerc    + sigma_uncerc    * draws_uncerc)
  279.   rc$b_uncerr    <- -exp(mu_uncerr    + sigma_uncerr    * draws_uncerr)
  280.   rc$b_uncerb    <- -exp(mu_uncerb    + sigma_uncerb    * draws_uncerb)
  281.   rc$b_uncerbike <- -exp(mu_uncerbike + sigma_uncerbike * draws_uncerbike)
  282.  
  283.   ## latent variables (MIMIC structure) --------------------------------------
  284.   rc$decisionoverload <- g_age_do*age + g_student_do*student + g_edu_below_uni_do*edu_below_uni +
  285.     g_hh_years_above_5_do*hh_years_above_5 +
  286.     g_personal_income_above_50k_do*personal_income_above_50k +
  287.     g_family_income_above_50k_do*family_income_above_50k +
  288.     g_license_2_do*license_2 + g_dissonant_user_do*dissonant_user +
  289.     g_pv_avail_number_do*pv_avail_number +
  290.     g_commuting_mmi_do*commuting_mmi +
  291.     g_passes_yes_do*passes_yes + eta_do
  292.  
  293.   rc$hassle <- g_age_hs*age + g_student_hs*student + g_edu_below_uni_hs*edu_below_uni +
  294.     g_hh_years_above_5_hs*hh_years_above_5 +
  295.     g_personal_income_above_50k_hs*personal_income_above_50k +
  296.     g_family_income_above_50k_hs*family_income_above_50k +
  297.     g_license_2_hs*license_2 + g_commuting_mmi_hs*commuting_mmi +
  298.     g_marry_stat_1_hs*marry_stat_1 + g_employed_hs*employed +
  299.     g_do_hs*rc$decisionoverload + eta_hs
  300.  
  301.   rc$attmultimodality <- g_age_att*age + g_edu_below_uni_att*edu_below_uni +
  302.     g_family_income_above_50k_att*family_income_above_50k +
  303.     g_license_2_att*license_2 + g_dissonant_user_att*dissonant_user +
  304.     g_marry_stat_1_att*marry_stat_1 + g_gender_att*gender +
  305.     g_employed_mm_view*employed + g_pv_access_att*pv_access +
  306.     g_disabled_yes_att*disabled_yes + eta_att
  307.  
  308.   rc$socialnorms <- g_age_sn*age + g_student_sn*student + g_edu_below_uni_sn*edu_below_uni +
  309.     g_hh_years_above_5_sn*hh_years_above_5 +
  310.     g_family_income_above_50k_sn*family_income_above_50k +
  311.     g_license_2_sn*license_2 + g_dissonant_user_sn*dissonant_user +
  312.     g_commuting_mmi_sn*commuting_mmi + g_marry_stat_1_sn*marry_stat_1 +
  313.     eta_sn
  314.  
  315.   rc$knowledge <- g_age_ka*age + g_edu_below_uni_ka*edu_below_uni +
  316.     g_hh_years_above_5_ka*hh_years_above_5 + g_license_2_ka*license_2 +
  317.     g_dissonant_user_ka*dissonant_user + g_commuting_mmi_ka*commuting_mmi +
  318.     g_gender_ka*gender + eta_ka
  319.  
  320.   # export them as plain symbols for apollo_probabilities()
  321.   list2env(rc, parent.frame())
  322.   return(rc)
  323. }
  324.  
  325. # ─────────────────────────────────────────────────────────────────────────────
  326. # 4.  Validate inputs  --------------------------------------------------------
  327. # ─────────────────────────────────────────────────────────────────────────────
  328. apollo_inputs <- apollo_validateInputs()
  329.  
  330. # ─────────────────────────────────────────────────────────────────────────────
  331. # 5.  Likelihood function  ----------------------------------------------------
  332. # ─────────────────────────────────────────────────────────────────────────────
  333. apollo_probabilities <- function(apollo_beta, apollo_inputs, functionality = "estimate"){
  334.  
  335.   apollo_attach(apollo_beta, apollo_inputs)
  336.   on.exit(apollo_detach(apollo_beta, apollo_inputs))
  337.  
  338.   P <- list()
  339.  
  340.   ## ordered-logit measurement models  ---------------------------------------
  341.   P$do4  <- apollo_ol(list(outcomeOrdered = do4,
  342.                            V = z_do4 * decisionoverload,
  343.                            tau = list(tau_do4_1,tau_do4_2,tau_do4_3,tau_do4_4),
  344.                            rows = (sp_scen == 1),
  345.                            componentName="do4"), functionality)
  346.  
  347.   P$do5  <- apollo_ol(list(outcomeOrdered = do5,
  348.                            V = z_do5 * decisionoverload,
  349.                            tau = list(tau_do5_1,tau_do5_2,tau_do5_3,tau_do5_4),
  350.                            rows = (sp_scen == 1),
  351.                            componentName="do5"), functionality)
  352.  
  353.   P$hs1 <- apollo_ol(list(outcomeOrdered = hs1,
  354.                           V = z_hs1 * hassle,
  355.                           tau = list(tau_hs1_1,tau_hs1_2,tau_hs1_3,tau_hs1_4),
  356.                           rows = (sp_scen == 1),
  357.                           componentName="hs1"), functionality)
  358.   # … (repeat for hs2-hs7, ka1-ka3, sn1-sn3, att1-att6) … --------------------
  359.   P$hs2 <- apollo_ol(list(outcomeOrdered=hs2,V=z_hs2*hassle,
  360.                           tau=list(tau_hs2_1,tau_hs2_2,tau_hs2_3,tau_hs2_4),
  361.                           rows=(sp_scen==1),componentName="hs2"),functionality)
  362.   P$hs3 <- apollo_ol(list(outcomeOrdered=hs3,V=z_hs3*hassle,
  363.                           tau=list(tau_hs3_1,tau_hs3_2,tau_hs3_3,tau_hs3_4),
  364.                           rows=(sp_scen==1),componentName="hs3"),functionality)
  365.   P$hs4 <- apollo_ol(list(outcomeOrdered=hs4,V=z_hs4*hassle,
  366.                           tau=list(tau_hs4_1,tau_hs4_2,tau_hs4_3,tau_hs4_4),
  367.                           rows=(sp_scen==1),componentName="hs4"),functionality)
  368.   P$hs5 <- apollo_ol(list(outcomeOrdered=hs5,V=z_hs5*hassle,
  369.                           tau=list(tau_hs5_1,tau_hs5_2,tau_hs5_3,tau_hs5_4),
  370.                           rows=(sp_scen==1),componentName="hs5"),functionality)
  371.   P$hs6 <- apollo_ol(list(outcomeOrdered=hs6,V=z_hs6*hassle,
  372.                           tau=list(tau_hs6_1,tau_hs6_2,tau_hs6_3,tau_hs6_4),
  373.                           rows=(sp_scen==1),componentName="hs6"),functionality)
  374.   P$hs7 <- apollo_ol(list(outcomeOrdered=hs7,V=z_hs7*hassle,
  375.                           tau=list(tau_hs7_1,tau_hs7_2,tau_hs7_3,tau_hs7_4),
  376.                           rows=(sp_scen==1),componentName="hs7"),functionality)
  377.  
  378.   P$ka1 <- apollo_ol(list(outcomeOrdered=ka1,V=z_ka1*knowledge,
  379.                           tau=list(tau_ka1_1,tau_ka1_2,tau_ka1_3,tau_ka1_4),
  380.                           rows=(sp_scen==1),componentName="ka1"),functionality)
  381.   P$ka2 <- apollo_ol(list(outcomeOrdered=ka2,V=z_ka2*knowledge,
  382.                           tau=list(tau_ka2_1,tau_ka2_2,tau_ka2_3,tau_ka2_4),
  383.                           rows=(sp_scen==1),componentName="ka2"),functionality)
  384.   P$ka3 <- apollo_ol(list(outcomeOrdered=ka3,V=z_ka3*knowledge,
  385.                           tau=list(tau_ka3_1,tau_ka3_2,tau_ka3_3,tau_ka3_4),
  386.                           rows=(sp_scen==1),componentName="ka3"),functionality)
  387.  
  388.   P$sn1 <- apollo_ol(list(outcomeOrdered=sn1,V=z_sn1*socialnorms,
  389.                           tau=list(tau_sn1_1,tau_sn1_2,tau_sn1_3,tau_sn1_4),
  390.                           rows=(sp_scen==1),componentName="sn1"),functionality)
  391.   P$sn2 <- apollo_ol(list(outcomeOrdered=sn2,V=z_sn2*socialnorms,
  392.                           tau=list(tau_sn2_1,tau_sn2_2,tau_sn2_3,tau_sn2_4),
  393.                           rows=(sp_scen==1),componentName="sn2"),functionality)
  394.   P$sn3 <- apollo_ol(list(outcomeOrdered=sn3,V=z_sn3*socialnorms,
  395.                           tau=list(tau_sn3_1,tau_sn3_2,tau_sn3_3,tau_sn3_4),
  396.                           rows=(sp_scen==1),componentName="sn3"),functionality)
  397.  
  398.   P$att1 <- apollo_ol(list(outcomeOrdered=att1,V=z_att1*attmultimodality,
  399.                            tau=list(tau_att1_1,tau_att1_2,tau_att1_3,tau_att1_4),
  400.                            rows=(sp_scen==1),componentName="att1"),functionality)
  401.   P$att2 <- apollo_ol(list(outcomeOrdered=att2,V=z_att2*attmultimodality,
  402.                            tau=list(tau_att2_1,tau_att2_2,tau_att2_3,tau_att2_4),
  403.                            rows=(sp_scen==1),componentName="att2"),functionality)
  404.   P$att3 <- apollo_ol(list(outcomeOrdered=att3,V=z_att3*attmultimodality,
  405.                            tau=list(tau_att3_1,tau_att3_2,tau_att3_3,tau_att3_4),
  406.                            rows=(sp_scen==1),componentName="att3"),functionality)
  407.   P$att5 <- apollo_ol(list(outcomeOrdered=att5,V=z_att5*attmultimodality,
  408.                            tau=list(tau_att5_1,tau_att5_2,tau_att5_3,tau_att5_4),
  409.                            rows=(sp_scen==1),componentName="att5"),functionality)
  410.   P$att6 <- apollo_ol(list(outcomeOrdered=att6,V=z_att6*attmultimodality,
  411.                            tau=list(tau_att6_1,tau_att6_2,tau_att6_3,tau_att6_4),
  412.                            rows=(sp_scen==1),componentName="att6"),functionality)
  413.  
  414.   ## utility for each alternative  ------------------------------------------
  415.   V <- list()
  416.   V$privatecar <- asc_pc +
  417.     b_attc * privatecar.attc +
  418.     b_conttc*privatecar.conttc*privatecar.attc +
  419.     b_uncerc*privatecar.uncer*privatecar.conttc*privatecar.attc +
  420.     b_cost  * privatecar.costc +
  421.     b_parkfee*privatecar.parkfeec
  422.  
  423.   V$ubercar <- asc_ubercar +
  424.     b_attc * ridehailingcar.attc +
  425.     b_conttc*ridehailingcar.conttc*ridehailingcar.attc +
  426.     b_uncerc*ridehailingcar.uncer*ridehailingcar.conttc*ridehailingcar.attc +
  427.     b_cost  * ridehailingcar.costu +
  428.     b_wait  * ridehailingcar.waitu
  429.  
  430.   V$cng  <- asc_cng +
  431.     b_attc * ridehailingcar.attc +
  432.     b_conttc*ridehailingcar.conttc*ridehailingcar.attc +
  433.     b_uncerc*ridehailingcar.uncer*ridehailingcar.conttc*ridehailingcar.attc +
  434.     b_cost  * ridehailingcng.costu +
  435.     b_wait  * ridehailingcar.waitu
  436.  
  437.   V$bike <- asc_bike +
  438.     b_attbike * ridehailingbike.attc +
  439.     b_conttbike*ridehailingbike.conttc*ridehailingbike.attc +
  440.     b_uncerbike*ridehailingcar.uncer*ridehailingbike.conttc*ridehailingbike.attc +
  441.     b_cost * ridehailingbike.costu +
  442.     b_wait * ridehailingcar.waitu
  443.  
  444.   V$rickshaw <- asc_rickshaw +
  445.     b_attr * rickshaw.attr +
  446.     b_conttr*rickshaw.conttc*rickshaw.attr +
  447.     b_uncerr*rickshaw.uncer*rickshaw.conttc*rickshaw.attr +
  448.     b_cost * rickshaw.costr +
  449.     b_wait * rickshaw.waitr +
  450.     b_transfers*rickshaw.transfersr
  451.  
  452.   V$bus <- asc_bus +
  453.     b_attb * bus.attb +
  454.     b_conttb*bus.conttc*bus.attb +
  455.     b_uncerb*bus.uncer*bus.conttc*bus.attb +
  456.     b_cost * bus.costb +
  457.     b_walk * bus.walk +
  458.     b_wait * bus.waitr +
  459.     b_transfers*bus.transfers +
  460.     b_crowd_2*bus.crowd2 + b_crowd_3*bus.crowd3 +
  461.     b_schedule*bus.schedule
  462.  
  463.   V$transit <- asc_transit +
  464.     b_attt * transit.attt +
  465.     b_conttt*transit.conttt*transit.attt +
  466.     b_cost * transit.costt +
  467.     b_walk * transit.walk +
  468.     b_wait * transit.waitu +
  469.     b_transfers*transit.transfers +
  470.     b_crowd_2*transit.crowd2 + b_crowd_3*transit.crowd3 +
  471.     b_schedule*transit.schedule +
  472.     b_pnr*transit.pnrt + b_grade*transit.gradet
  473.  
  474.   avail <- list(privatecar=pc_avail, ubercar=rhcar_avail, cng=rhcng_avail,
  475.                 bike=rhbike_avail, rickshaw=rick_avail,
  476.                 bus=bus_avail, transit=transit_avail)
  477.  
  478.   mnl_set <- list(alternatives = c(privatecar=1, ubercar=2, cng=3, bike=4,
  479.                                    rickshaw=5, bus=6, transit=7),
  480.                   avail        = avail,
  481.                   choiceVar    = best,
  482.                   V            = V,
  483.                   componentName= "choice")
  484.  
  485.   P$choice <- apollo_mnl(mnl_set, functionality)
  486.  
  487.   ## combine, average draws, panel etc. --------------------------------------
  488.   P <- apollo_combineModels(P, apollo_inputs, functionality)
  489.   P <- apollo_panelProd   (P, apollo_inputs, functionality)
  490.   P <- apollo_avgInterDraws(P, apollo_inputs, functionality)
  491.   P <- apollo_prepareProb (P, apollo_inputs, functionality)
  492.  
  493.   return(P)
  494. }
  495.  
  496. # ─────────────────────────────────────────────────────────────────────────────
  497. # 6.  Estimation  -------------------------------------------------------------
  498. # ─────────────────────────────────────────────────────────────────────────────
  499. estimate_settings <- list(maxIterations = 1500, estimationRoutine = "BFGS")
  500.  
  501. modechoice_model <- apollo_estimate(
  502.   apollo_beta,
  503.   apollo_fixed,
  504.   apollo_probabilities,
  505.   apollo_inputs,
  506.   estimate_settings
  507. )
  508.  
  509. apollo_modelOutput(modechoice_model)
  510.  
  511.  
  512.  
  513.  
  514. ##############output
  515.  
  516.  
  517. Preparing user-defined functions.
  518. WARNING: The pre-processing of 'apollo_probabilities' failed in initial testing. Your model may still run, but this indicates a potential problem. Please contact the
  519.   developers for assistance!
  520.  
  521. Testing likelihood function...
  522. INFORMATION: No coding provided for Ordered model component "do4", so assuming outcomeOrdered goes from 1 to 5
  523.  
  524. Overview of choices for OL model component do4:
  525.                               1      2      3      4     5
  526. Times chosen              13.00 463.00 152.00 357.00 86.00
  527. Percentage chosen overall  1.21  43.23  14.19  33.33  8.03
  528. INFORMATION: No coding provided for Ordered model component "do5", so assuming outcomeOrdered goes from 1 to 5
  529.  
  530. Overview of choices for OL model component do5:
  531.                               1      2      3      4      5
  532. Times chosen              26.00 365.00 182.00 391.00 107.00
  533. Percentage chosen overall  2.43  34.08  16.99  36.51   9.99
  534. INFORMATION: No coding provided for Ordered model component "hs1", so assuming outcomeOrdered goes from 1 to 5
  535.  
  536. Overview of choices for OL model component hs1:
  537.                              1      2      3      4      5
  538. Times chosen              3.00 148.00 213.00 598.00 109.00
  539. Percentage chosen overall 0.28  13.82  19.89  55.84  10.18
  540. INFORMATION: No coding provided for Ordered model component "hs2", so assuming outcomeOrdered goes from 1 to 5
  541.  
  542. Overview of choices for OL model component hs2:
  543.                              1      2      3      4      5
  544. Times chosen              7.00 219.00 218.00 451.00 176.00
  545. Percentage chosen overall 0.65  20.45  20.35  42.11  16.43
  546. INFORMATION: No coding provided for Ordered model component "hs3", so assuming outcomeOrdered goes from 1 to 5
  547.  
  548. Overview of choices for OL model component hs3:
  549.                               1      2     3      4      5
  550. Times chosen              19.00 253.00 81.00 570.00 148.00
  551. Percentage chosen overall  1.77  23.62  7.56  53.22  13.82
  552. INFORMATION: No coding provided for Ordered model component "hs4", so assuming outcomeOrdered goes from 1 to 5
  553.  
  554. Overview of choices for OL model component hs4:
  555.                               1      2     3      4    5
  556. Times chosen              49.00 366.00 85.00 480.00 91.0
  557. Percentage chosen overall  4.58  34.17  7.94  44.82  8.5
  558. INFORMATION: No coding provided for Ordered model component "hs5", so assuming outcomeOrdered goes from 1 to 5
  559.  
  560. Overview of choices for OL model component hs5:
  561.                               1      2      3      4    5
  562. Times chosen              18.00 425.00 141.00 397.00 90.0
  563. Percentage chosen overall  1.68  39.68  13.17  37.07  8.4
  564. INFORMATION: No coding provided for Ordered model component "hs6", so assuming outcomeOrdered goes from 1 to 5
  565.  
  566. Overview of choices for OL model component hs6:
  567.                               1      2      3      4      5
  568. Times chosen              18.00 410.00 152.00 384.00 107.00
  569. Percentage chosen overall  1.68  38.28  14.19  35.85   9.99
  570. INFORMATION: No coding provided for Ordered model component "hs7", so assuming outcomeOrdered goes from 1 to 5
  571.  
  572. Overview of choices for OL model component hs7:
  573.                              1      2      3      4      5
  574. Times chosen              6.00 278.00 190.00 489.00 108.00
  575. Percentage chosen overall 0.56  25.96  17.74  45.66  10.08
  576. INFORMATION: No coding provided for Ordered model component "ka1", so assuming outcomeOrdered goes from 1 to 5
  577.  
  578. Overview of choices for OL model component ka1:
  579.                              1     2     3      4      5
  580. Times chosen              1.00 57.00 65.00 687.00 261.00
  581. Percentage chosen overall 0.09  5.32  6.07  64.15  24.37
  582. INFORMATION: No coding provided for Ordered model component "ka2", so assuming outcomeOrdered goes from 1 to 5
  583.  
  584. Overview of choices for OL model component ka2:
  585.                              1      2      3      4     5
  586. Times chosen              3.00 114.00 134.00 533.00 287.0
  587. Percentage chosen overall 0.28  10.64  12.51  49.77  26.8
  588. INFORMATION: No coding provided for Ordered model component "ka3", so assuming outcomeOrdered goes from 1 to 5
  589.  
  590. Overview of choices for OL model component ka3:
  591.                              1     2      3      4      5
  592. Times chosen              2.00 84.00 124.00 624.00 237.00
  593. Percentage chosen overall 0.19  7.84  11.58  58.26  22.13
  594. INFORMATION: No coding provided for Ordered model component "sn1", so assuming outcomeOrdered goes from 1 to 5
  595.  
  596. Overview of choices for OL model component sn1:
  597.                              1      2      3      4  5
  598. Times chosen              7.00 310.00 270.00 409.00 75
  599. Percentage chosen overall 0.65  28.94  25.21  38.19  7
  600. INFORMATION: No coding provided for Ordered model component "sn2", so assuming outcomeOrdered goes from 1 to 5
  601.  
  602. Overview of choices for OL model component sn2:
  603.                              1      2      3      4      5
  604. Times chosen              8.00 310.00 282.00 369.00 102.00
  605. Percentage chosen overall 0.75  28.94  26.33  34.45   9.52
  606. INFORMATION: No coding provided for Ordered model component "sn3", so assuming outcomeOrdered goes from 1 to 5
  607.  
  608. Overview of choices for OL model component sn3:
  609.                               1      2      3      4     5
  610. Times chosen              26.00 313.00 284.00 385.00 63.00
  611. Percentage chosen overall  2.43  29.23  26.52  35.95  5.88
  612. INFORMATION: No coding provided for Ordered model component "att1", so assuming outcomeOrdered goes from 1 to 5
  613.  
  614. Overview of choices for OL model component att1:
  615.                               1      2      3      4    5
  616. Times chosen              12.00 206.00 210.00 597.00 46.0
  617. Percentage chosen overall  1.12  19.23  19.61  55.74  4.3
  618. INFORMATION: No coding provided for Ordered model component "att2", so assuming outcomeOrdered goes from 1 to 5
  619.  
  620. Overview of choices for OL model component att2:
  621.                               1     2      3      4      5
  622. Times chosen              13.00 151.0 201.00 562.00 144.00
  623. Percentage chosen overall  1.21  14.1  18.77  52.47  13.45
  624. INFORMATION: No coding provided for Ordered model component "att3", so assuming outcomeOrdered goes from 1 to 5
  625.  
  626. Overview of choices for OL model component att3:
  627.                               1      2     3      4     5
  628. Times chosen              10.00 152.00 242.0 593.00 74.00
  629. Percentage chosen overall  0.93  14.19  22.6  55.37  6.91
  630. INFORMATION: No coding provided for Ordered model component "att5", so assuming outcomeOrdered goes from 1 to 5
  631.  
  632. Overview of choices for OL model component att5:
  633.                              1      2      3      4      5
  634. Times chosen              7.00 134.00 215.00 615.00 100.00
  635. Percentage chosen overall 0.65  12.51  20.07  57.42   9.34
  636. INFORMATION: No coding provided for Ordered model component "att6", so assuming outcomeOrdered goes from 1 to 5
  637.  
  638. Overview of choices for OL model component att6:
  639.                              1     2      3      4     5
  640. Times chosen              7.00 121.0 235.00 627.00 81.00
  641. Percentage chosen overall 0.65  11.3  21.94  58.54  7.56
  642.  
  643. Overview of choices for MNL model component choice:
  644.                                  privatecar ubercar    cng   bike rickshaw     bus transit
  645. Times available                      149.00   120.0 290.00 890.00   538.00 1225.00 1516.00
  646. Times chosen                         117.00    15.0  61.00 369.00    97.00  293.00 1190.00
  647. Percentage chosen overall              5.46     0.7   2.85  17.23     4.53   13.68   55.56
  648. Percentage chosen when available      78.52    12.5  21.03  41.46    18.03   23.92   78.50
  649.  
  650.  
  651. Log-likelihood calculation fails at starting values!
  652. Affected individuals:
  653.    ID   LL
  654.    51 -Inf
  655.    52 -Inf
  656.    56  NaN
  657.    57  NaN
  658.    67 -Inf
  659.    68 -Inf
  660.    71  NaN
  661.    74 -Inf
  662.    77  NaN
  663.   120  NaN
  664.   126 -Inf
  665.   127 -Inf
  666.   128  NaN
  667.   130 -Inf
  668.   132 -Inf
  669.   133  NaN
  670.   135 -Inf
  671.   139  NaN
  672.   142  NaN
  673.   144 -Inf
  674.   145 -Inf
  675.   147  NaN
  676.   148 -Inf
  677.   149 -Inf
  678.   151  NaN
  679.   152  NaN
  680.   153 -Inf
  681.   154  NaN
  682.   156 -Inf
  683.   159  NaN
  684.   160 -Inf
  685.   161 -Inf
  686.   162 -Inf
  687.   163 -Inf
  688.   165  NaN
  689.   172 -Inf
  690.   173  NaN
  691.   175 -Inf
  692.   186 -Inf
  693.   189  NaN
  694.   204 -Inf
  695.   205 -Inf
  696.   206 -Inf
  697.   208  NaN
  698.   210 -Inf
  699.   211  NaN
  700.   212 -Inf
  701.   213  NaN
  702.   214 -Inf
  703.   215  NaN
  704.   216  NaN
  705.   220  NaN
  706.   224 -Inf
  707.   227 -Inf
  708.   228 -Inf
  709.   232 -Inf
  710.   233 -Inf
  711.   234 -Inf
  712.   238  NaN
  713.   240  NaN
  714.   244 -Inf
  715.   249 -Inf
  716.   253  NaN
  717.   256 -Inf
  718.   257  NaN
  719.   258  NaN
  720.   259 -Inf
  721.   260  NaN
  722.   264  NaN
  723.   265  NaN
  724.   274  NaN
  725.   275 -Inf
  726.   276 -Inf
  727.   277 -Inf
  728.   278  NaN
  729.   279 -Inf
  730.   280 -Inf
  731.   281 -Inf
  732.   282  NaN
  733.   283 -Inf
  734.   287 -Inf
  735.   294 -Inf
  736.   295  NaN
  737.   296 -Inf
  738.   297 -Inf
  739.   298 -Inf
  740.   303 -Inf
  741.   304 -Inf
  742.   307 -Inf
  743.   309 -Inf
  744.   313 -Inf
  745.   314 -Inf
  746.   321  NaN
  747.   322 -Inf
  748.   324 -Inf
  749.   326  NaN
  750.   331  NaN
  751.   332 -Inf
  752.   333 -Inf
  753.   337 -Inf
  754.   344  NaN
  755.   348 -Inf
  756.   349 -Inf
  757.   350 -Inf
  758.   351  NaN
  759.   352  NaN
  760.   354  NaN
  761.   356 -Inf
  762.   358 -Inf
  763.   359 -Inf
  764.   360 -Inf
  765.   361 -Inf
  766.   363  NaN
  767.   364 -Inf
  768.   365 -Inf
  769.   366 -Inf
  770.   367  NaN
  771.   368 -Inf
  772.   370  NaN
  773.   372 -Inf
  774.   373  NaN
  775.   374  NaN
  776.   376  NaN
  777.   379  NaN
  778.   380  NaN
  779.   382 -Inf
  780.   383 -Inf
  781.   385 -Inf
  782.   388 -Inf
  783.   389 -Inf
  784.   393 -Inf
  785.   394  NaN
  786.   395 -Inf
  787.   397 -Inf
  788.   399  NaN
  789.   401 -Inf
  790.   405 -Inf
  791.   414 -Inf
  792.   416 -Inf
  793.   419 -Inf
  794.   421 -Inf
  795.   423 -Inf
  796.   424 -Inf
  797.   425 -Inf
  798.   426 -Inf
  799.   428 -Inf
  800.   430  NaN
  801.   431 -Inf
  802.   432 -Inf
  803.   434 -Inf
  804.   435 -Inf
  805.   436  NaN
  806.   437 -Inf
  807.   438 -Inf
  808.   439 -Inf
  809.   440  NaN
  810.   443 -Inf
  811.   446 -Inf
  812.   451 -Inf
  813.   452 -Inf
  814.   453 -Inf
  815.   454  NaN
  816.   455 -Inf
  817.   456 -Inf
  818.   458 -Inf
  819.   459 -Inf
  820.   461  NaN
  821.   464  NaN
  822.   465  NaN
  823.   466  NaN
  824.   472 -Inf
  825.   474 -Inf
  826.   477  NaN
  827.   478 -Inf
  828.   479 -Inf
  829.   481 -Inf
  830.   482 -Inf
  831.   488  NaN
  832.   489 -Inf
  833.   494  NaN
  834.   497 -Inf
  835.   498 -Inf
  836.   499 -Inf
  837.   500 -Inf
  838.   502 -Inf
  839.   506 -Inf
  840.   507 -Inf
  841.   512 -Inf
  842.   513 -Inf
  843.   515  NaN
  844.   518  NaN
  845.   519  NaN
  846.   521 -Inf
  847.   525 -Inf
  848.   526  NaN
  849.   527 -Inf
  850.   528  NaN
  851.   531 -Inf
  852.   532  NaN
  853.   533 -Inf
  854.   534  NaN
  855.   535 -Inf
  856.   537 -Inf
  857.   538  NaN
  858.   540 -Inf
  859.   541 -Inf
  860.   542 -Inf
  861.   544  NaN
  862.   545  NaN
  863.   547  NaN
  864.   548 -Inf
  865.   553 -Inf
  866.   554  NaN
  867.   556 -Inf
  868.   557  NaN
  869.   560 -Inf
  870.   561 -Inf
  871.   564 -Inf
  872.   568 -Inf
  873.   572 -Inf
  874.   573  NaN
  875.   574 -Inf
  876.   576 -Inf
  877.   577  NaN
  878.   578 -Inf
  879.   580 -Inf
  880.   582 -Inf
  881.   585 -Inf
  882.   589 -Inf
  883.   590  NaN
  884.   591 -Inf
  885.   592 -Inf
  886.   593 -Inf
  887.   595 -Inf
  888.   596  NaN
  889.   597 -Inf
  890.   600 -Inf
  891.   602  NaN
  892.   605 -Inf
  893.   606  NaN
  894.   607  NaN
  895.   609  NaN
  896.   610  NaN
  897.   612  NaN
  898.   613 -Inf
  899.   614  NaN
  900.   615  NaN
  901.   616 -Inf
  902.   619  NaN
  903.   622  NaN
  904.   625 -Inf
  905.   631  NaN
  906.   635 -Inf
  907.   637 -Inf
  908.   638 -Inf
  909.   639  NaN
  910.   640 -Inf
  911.   645 -Inf
  912.   646  NaN
  913.   647 -Inf
  914.   648 -Inf
  915.   649 -Inf
  916.   650 -Inf
  917.   651 -Inf
  918.   654 -Inf
  919.   655 -Inf
  920.   657 -Inf
  921.   658  NaN
  922.   659  NaN
  923.   660 -Inf
  924.   662 -Inf
  925.   663  NaN
  926.   664 -Inf
  927.   665  NaN
  928.   666 -Inf
  929.   667 -Inf
  930.   668 -Inf
  931.   669  NaN
  932.   671  NaN
  933.   673  NaN
  934.   675 -Inf
  935.   676 -Inf
  936.   677 -Inf
  937.   679 -Inf
  938.   681 -Inf
  939.   682 -Inf
  940.   688  NaN
  941.   693  NaN
  942.   695 -Inf
  943.   697 -Inf
  944.   698 -Inf
  945.   700 -Inf
  946.   701 -Inf
  947.   702 -Inf
  948.   704  NaN
  949.   705  NaN
  950.   708 -Inf
  951.   709 -Inf
  952.   710 -Inf
  953.   715 -Inf
  954.   716  NaN
  955.   718 -Inf
  956.   721 -Inf
  957.   722 -Inf
  958.   723 -Inf
  959.   727  NaN
  960.   728 -Inf
  961.   730  NaN
  962.   731 -Inf
  963.   732 -Inf
  964.   734 -Inf
  965.   735 -Inf
  966.   736 -Inf
  967.   737 -Inf
  968.   739 -Inf
  969.   741 -Inf
  970.   742 -Inf
  971.   743  NaN
  972.   746 -Inf
  973.   748  NaN
  974.   750  NaN
  975.   752  NaN
  976.   753  NaN
  977.   754 -Inf
  978.   756  NaN
  979.   758 -Inf
  980.   759 -Inf
  981.   760  NaN
  982.   761 -Inf
  983.   762 -Inf
  984.   764  NaN
  985.   765 -Inf
  986.   766  NaN
  987.   769 -Inf
  988.   771 -Inf
  989.   772 -Inf
  990.   773 -Inf
  991.   774 -Inf
  992.   775 -Inf
  993.   776 -Inf
  994.   777 -Inf
  995.   778  NaN
  996.   783 -Inf
  997.   784 -Inf
  998.   785 -Inf
  999.   786 -Inf
  1000.   789  NaN
  1001.   792  NaN
  1002.   794 -Inf
  1003.   795 -Inf
  1004.   796  NaN
  1005.   797 -Inf
  1006.   800  NaN
  1007.   801 -Inf
  1008.   802  NaN
  1009.   803 -Inf
  1010.   805  NaN
  1011.   806  NaN
  1012.   807  NaN
  1013.   808 -Inf
  1014.   811  NaN
  1015.   812 -Inf
  1016.   813  NaN
  1017.   815  NaN
  1018.   817  NaN
  1019.   818  NaN
  1020.   819  NaN
  1021.   820 -Inf
  1022.   821 -Inf
  1023.   824  NaN
  1024.   827  NaN
  1025.   832 -Inf
  1026.   836  NaN
  1027.   843 -Inf
  1028.   850  NaN
  1029.   853 -Inf
  1030.   854  NaN
  1031.   855 -Inf
  1032.   856 -Inf
  1033.   858 -Inf
  1034.   861 -Inf
  1035.   862  NaN
  1036.   869  NaN
  1037.   870  NaN
  1038.   876 -Inf
  1039.   877 -Inf
  1040.   878 -Inf
  1041.   881 -Inf
  1042.   882  NaN
  1043.   883 -Inf
  1044.   884  NaN
  1045.   886  NaN
  1046.   887 -Inf
  1047.   888 -Inf
  1048.   890 -Inf
  1049.   891  NaN
  1050.   893 -Inf
  1051.   895 -Inf
  1052.   897 -Inf
  1053.   899  NaN
  1054.   900 -Inf
  1055.   901  NaN
  1056.   902  NaN
  1057.   903  NaN
  1058.   904 -Inf
  1059.   906  NaN
  1060.   908  NaN
  1061.   909 -Inf
  1062.   910 -Inf
  1063.   911 -Inf
  1064.   912  NaN
  1065.   914 -Inf
  1066.   921  NaN
  1067.   922 -Inf
  1068.   923 -Inf
  1069.   924  NaN
  1070.   926 -Inf
  1071.   927 -Inf
  1072.   928 -Inf
  1073.   929 -Inf
  1074.   930 -Inf
  1075.   932 -Inf
  1076.   933 -Inf
  1077.   935  NaN
  1078.   936  NaN
  1079.   940 -Inf
  1080.   942  NaN
  1081.   944 -Inf
  1082.   946  NaN
  1083.   948 -Inf
  1084.   952  NaN
  1085.   954  NaN
  1086.   957 -Inf
  1087.   959  NaN
  1088.   960 -Inf
  1089.   962  NaN
  1090.   963 -Inf
  1091.   964 -Inf
  1092.   965  NaN
  1093.   967 -Inf
  1094.   972  NaN
  1095.   974  NaN
  1096.   975  NaN
  1097.   979  NaN
  1098.   981  NaN
  1099.   984 -Inf
  1100.   986 -Inf
  1101.   990  NaN
  1102.   991 -Inf
  1103.   993  NaN
  1104.   994 -Inf
  1105.   996 -Inf
  1106.   999  NaN
  1107.  1000 -Inf
  1108.  1002  NaN
  1109.  1003 -Inf
  1110.  1005 -Inf
  1111.  1007 -Inf
  1112.  1008 -Inf
  1113.  1009  NaN
  1114.  1010  NaN
  1115.  1013 -Inf
  1116.  1014 -Inf
  1117.  1015 -Inf
  1118.  1016 -Inf
  1119.  1020 -Inf
  1120.  1021  NaN
  1121.  1022  NaN
  1122.  1025 -Inf
  1123.  1029 -Inf
  1124.  1030  NaN
  1125.  1031  NaN
  1126.  1033 -Inf
  1127.  1034 -Inf
  1128.  1035 -Inf
  1129.  1036 -Inf
  1130.  1038 -Inf
  1131.  1040 -Inf
  1132.  1043 -Inf
  1133.  1048 -Inf
  1134.  1051 -Inf
  1135.  1052 -Inf
  1136.  1054 -Inf
  1137.  1055  NaN
  1138.  1056 -Inf
  1139.  1060  NaN
  1140.  1061  NaN
  1141.  1063 -Inf
  1142.  1065 -Inf
  1143.  1066 -Inf
  1144.  1068  NaN
  1145.  1070  NaN
  1146.  1071 -Inf
  1147.  1072 -Inf
  1148.  1073 -Inf
  1149.  1075 -Inf
  1150.  1077  NaN
  1151.  1081 -Inf
  1152.  1083 -Inf
  1153.  1084  NaN
  1154.  [ reached 'max' / getOption("max.print") -- omitted 257 rows ]
  1155. Error in apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities,  :
  1156.   CALCULATION ISSUE - Log-likelihood calculation fails at values close to the starting values!
  1157.  
  1158.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement