как решить в lnl.rlo git (param = c (цена = y, вес = x,: dims [product x] не соответствуют длине объекта [y] в mlo git? - PullRequest
0 голосов
/ 28 апреля 2020

Я реализовал смешанную модель lo git в mlo git, но у меня возникает проблема, связанная с измерением, но я не могу ее решить. есть ли какие-либо ограничения на данные? Я добавил формат данных, имена столбцов, а также код для смешанной модели lo git.

>str(sample_choice_dat)
 'data.frame':  28702 obs. of  32 variables:
  $ customer_id: Factor w/ 11767 levels 
      "00053a61a98854899e70ed204dd4bafe",..: 1 1 2 2 3 3 3 3 4 4 ...
  $ price_1    : num  8.18 8.05 8.5 8.18 8.67 ...
  $ price_2    : num  8.87 7.79 8.67 8.28 8.41 ...
  $ price_3    : num  8.25 7.98 7 5.46 7.55 ...
  $ price_4    : num  7.79 8.66 6.38 6.67 6.92 ...
  $ price_5    : num  8.66 7.19 8.58 8.54 8.39 ...
  $ price_6    : num  8.61 8.81 4.78 8.15 7.97 ...
  $ weight_1   : num  5.48 6.13 6.44 5.26 7.28 ...
  $ weight_2   : num  7.34 6.45 5.79 7.45 6.78 ...
  $ weight_3   : num  5.63 7.15 4.69 4.69 6.43 ...
  $ weight_4   : num  7.256 4.5 0.693 6.923 6.482 ...
  $ weight_5   : num  5.05 6.48 7.22 7.02 7.28 ...
  $ weight_6   : num  7.435 6.91 0.693 6.91 7.311 ...
  $ length_1   : num  3.69 3.66 3.78 3.71 2.89 ...
  $ length_2   : num  2.56 3.3 3.5 2.64 3.04 ...
  $ length_3   : num  2.48 3.18 2.4 2.94 3.43 ...
  $ length_4   : num  3.61 3.3 2.56 2.56 2.56 ...
  $ length_5   : num  3.33 2.56 3.47 3.09 2.77 ...
  $ length_6   : num  2.83 2.56 2.56 2.56 3.3 ...
  $ height_1   : num  3.43 2.4 4.26 2.77 2.2 ...
  $ height_2   : num  1.95 0 3 2.83 0 ...
  $ height_3   : num  2.83 3.53 2.2 1.79 3.09 ...
  $ height_4   : num  2.48 3.14 4.26 2.77 2.77 ...
  $ height_5   : num  2.94 2.77 3.78 3.09 2.2 ...
  $ height_6   : num  2.83 2.48 3.64 2.3 3.09 ...
  $ width_1    : num  3.4 3.04 3.47 3.47 2.56 ...
  $ width_2    : num  1.95 3.3 2.4 2.64 1.95 ...
  $ width_3    : num  2.48 3.22 1.95 2.4 3.4 ...
  $ width_4    : num  3.87 3 2.08 2.89 2.08 ...
  $ width_5    : num  2.77 1.95 2.48 3.09 2.64 ...
  $ width_6    : num  2.83 2.56 2.4 1.95 2.83 ...
  $ y          : Factor w/ 6 levels "1","2","3","4",..: 5 4 1 1 2 1 6 3 1 3 

Complete.choice <- mlogit.data(sample_choice_dat, choice = "y", 
                           varying = 2:31, shape = "wide", sep = "_", 
                            id ="customer_id")

sample.mxl <- mlogit(y ~ weight + length + height + width + price | 0, 
                    Complete.choice,
                     rpar=c(weight = 'n', length = 'n', height = 'n',
                      width = 'n', price = 'n'), 
                     R = 40, halton = NA, panel = TRUE, seed = 123, 
                     print.level = 2)

Я получаю сообщение об ошибке:

Error in lnl.rlogit(param = c(price = -0.303318157269777, weight = 
            0.0314261479574793,  : 
         dims [product 2353400] do not match the length of object [3763520]
In addition: Warning messages:
1: In weights[!duplicated(id)] * log(pm) :longer object length is not a 
    multiple of shorter object length
2: In Pch2 * b$betaa :
   longer object length is not a multiple of shorter object length
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...