I am conducting multinomial logistic regressions. They seem to work for all variables except for the price variable, where I get the following error:
reg.M <- mlogit::mlogit(formula = value ~ 1 | price, data = listDatasets[[2]])
Error in solve.default(H, g[!fixed]) :
system is computationally singular: reciprocal condition number = 7.4671e-18
That is my the head of the dataset used (I have 15 like these, with different prices):
> head(listDatasets[[2]])
index Age ScoreEnvAtt MoneyInvested Gender Beliefs_eff_Green Beliefs_eff_ESG Beliefs_eff_Comp Beliefs_perf_ESG Beliefs_perf_Green Beliefs_perf_Comp Guilt Social.Altruistic Biospheric Egoistic DummyMedium
1.SS_Green_1 1 26 4.2 13 2 4 3 3 2 3 2 71 6.000000 6.000000 5 1
1.SS_Green_2 1 26 4.2 13 2 4 3 3 2 3 2 71 6.000000 6.000000 5 1
1.SS_Green_3 1 26 4.2 13 2 4 3 3 2 3 2 71 6.000000 6.000000 5 1
1.SS_Green_4 1 26 4.2 13 2 4 3 3 2 3 2 71 6.000000 6.000000 5 1
2.SS_Green_1 2 30 4.8 2 2 4 3 4 2 3 3 26 6.666667 5.333333 5 1
2.SS_Green_2 2 30 4.8 2 2 4 3 4 2 3 3 26 6.666667 5.333333 5 1
DummyHigh CompensationGroup Past_compensation Knowledge_CO2 variable value price
1.SS_Green_1 0 Group1 2 1 SS_Green_1 FALSE 1.5
1.SS_Green_2 0 Group1 2 1 SS_Green_2 FALSE 1.5
1.SS_Green_3 0 Group1 2 1 SS_Green_3 FALSE 1.5
1.SS_Green_4 0 Group1 2 1 SS_Green_4 TRUE 1.3
2.SS_Green_1 0 Group2 2 2 SS_Green_1 FALSE 1.5
2.SS_Green_2 0 Group2 2 2 SS_Green_2 FALSE 1.5
I checked the other threads on this error already but can not find a solution to my problem. Any suggestions? Thanks!
Edit: I tried to do it with multinom
instead of mlogit
. It does not seem to recognize the levels of the dependent variable.
test <- multinom(value ~ price, listDatasets[[2]])
summary(test)
> summary(test)
Call:
multinom(formula = value ~ price, data = listDatasets[[2]])
Coefficients:
Values Std. Err.
(Intercept) 25.77925 1.464741
price -18.86853 1.037180
Residual Deviance: 653.8391
AIC: 657.8391
Edit 2:
dput(head(data_long))
structure(list(Pride = c(17, 71, 1, 50, 0, 13), Guilt = c(71,
26, 89, 50, 100, 13), Shame = c(36, 77, 5, 50, 67, 8), Joy = c(12,
50, 0, 50, 30, 37), Attitudes1 = c(6, 5, 7, 5, 7, 5), Attitudes2 = c(5,
7, 3, 4, 5, 3), Attitudes3 = c(6, 6, 7, 6, 7, 6), Attitudes4 = c(5,
3, 5, 5, 6, 6), Attitudes5 = c(4, 7, 6, 6, 5, 6), Attitudes6 = c(5,
7, 3, 7, 7, 6), Attitudes7 = c(3, 4, 1, 3, 1, 6), Attitudes8 = c(3,
4, 5, 6, 7, 2), Attitudes9 = c(2, 3, 7, 4, 7, 6), Attitudes10 = c(3,
2, 5, 4, 7, 6), Concern1 = c(6, 4, 7, 6, 7, 6), Concern2 = c(6,
6, 7, 6, 7, 6), Concern3 = c(5, 5, 7, 6, 4, 6), Concern4 = c(6,
6, 5, 6, 4, 5), Concern5 = c(6, 7, 7, 6, 4, 5), Concern6 = c(6,
6, 7, 6, 5, 6), Concern7 = c(6, 6, 7, 6, 7, 6), Concern8 = c(4,
4, 5, 6, 3, 6), Concern9 = c(6, 7, 6, 6, 7, 7), Beliefs_perf_ESG = c(2,
2, 3, 2, 3, 2), Beliefs_perf_Comp = c(2, 3, 2, 3, 3, 2), Beliefs_perf_Green = c(3,
3, 3, NA, 3, 2), Beliefs_eff_ESG = c(3, 3, 4, 3, 4, 3), Beliefs_eff_Comp = c(3,
4, 2, 4, 2, 3), Beliefs_eff_Green = c(4, 4, 5, 5, 5, 3), Eval_Ego = c(3,
2, 3, 4, 2, 3), Eval_Nature1 = c(3, 3, 3, 4, 2, 2), Eval_Nature2 = c(4,
4, 4, 4, 2, 3), Eval_Social = c(3, 2, 4, 4, 2, 3), Reforestation = c(2,
1, 1, 2, 2, 3), Renewable_Energy = c(1, 2, 3, 1, 1, 1), Efficient_Energy = c(3,
4, 4, 3, 3, 2), Methane = c(4, 3, 2, 4, 4, 4), France = c(3,
3, 1, 1, 3, 2), Europe = c(2, 2, 3, 3, 2, 3), Development = c(1,
1, 2, 2, 1, 1), Co_benefits = c(5, 4, 5, 3, 4, 4), Poverty = c(1,
1, 2, 2, 1, 1), Health = c(4, 2, 4, 1, 3, 3), Biodiversity = c(2,
4, 1, 3, 2, 2), Equality = c(3, 5, 5, 5, 5, 5), Economic_Growth = c(5,
3, 3, 4, 4, 4), Knowledge_CO2 = c(1, 2, 3, 2, 2, 2), Past_compensation = c(2,
2, 1, 2, 1, 2), Age = c(26, 30, 30, 30, 21, 40), Gender = c(2,
2, 2, 2, 2, 2), MoneyInvested = c(13, 2, 1, 3, 13, 1), Investment_Experience = c(2,
1, 1, 1, 2, 1), Participant_s_ID = c("1234asdf", "Password04",
"hiquet8350", "masmas2121", "1712flju", "Lemurien4555"), Compensationproject1 = c(1,
NA, NA, 1, NA, 1), Compensationproject2 = c(NA, 1, 1, NA, NA,
NA), Compensationproject3 = c(NA, NA, NA, NA, 1, NA), FL_42_DO_ChoiceExperiment1 = c(6,
14, 3, 13, 10, 7), FL_42_DO_ChoiceExperiment2 = c(3, 1, 4, 6,
13, 2), FL_42_DO_ChoiceExperiment3 = c(7, 10, 1, 7, 11, 13),
FL_42_DO_ChoiceExperiment4 = c(11, 15, 5, 2, 4, 11), FL_42_DO_ChoiceExperiment5 = c(14,
7, 2, 11, 2, 10), FL_42_DO_ChoiceExperiment6 = c(2, 11, 8,
15, 5, 6), FL_42_DO_ChoiceExperiment7 = c(1, 6, 6, 12, 14,
1), FL_42_DO_ChoiceExperiment8 = c(10, 2, 14, 5, 9, 5), FL_42_DO_ChoiceExperiment9 = c(4,
8, 13, 1, 1, 8), FL_42_DO_ChoiceExperiment10 = c(12, 5, 7,
14, 6, 3), FL_42_DO_ChoiceExperiment11 = c(15, 13, 10, 10,
12, 14), FL_42_DO_ChoiceExperiment12 = c(13, 3, 12, 8, 7,
9), FL_42_DO_ChoiceExperiment13 = c(9, 9, 11, 9, 8, 15),
FL_42_DO_ChoiceExperiment14 = c(8, 12, 9, 3, 3, 12), FL_42_DO_ChoiceExperiment15 = c(5,
4, 15, 4, 15, 4), ScoreEnvAtt = c(4.2, 4.8, 4.9, 5, 5.9,
5.2), Eval_NatureScore = c(3.5, 3.5, 3.5, 4, 2, 2.5), Social.Altruistic = c(6,
6.66666666666667, 6, 6, 5, 5.66666666666667), Biospheric = c(6,
5.33333333333333, 7, 6, 7, 6), Egoistic = c(5, 5, 6.33333333333333,
6, 4, 6), GroupEnvAtt = structure(c(2L, 2L, 2L, 2L, 2L, 2L
), .Label = c("low", "medium", "high"), class = "factor"),
DummyMedium = structure(c(2L, 2L, 2L, 2L, 2L, 2L), .Label = c("0",
"1"), class = "factor"), CompensationGroup = structure(c(1L,
2L, 2L, 1L, 3L, 1L), .Label = c("Group1", "Group2", "Group3"
), class = "factor"), ID = structure(1:6, .Label = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
"13", "14", "15", "16", "17", "18", "19", "20", "21", "22",
"23", "24", "25", "26", "27", "28", "29", "30", "31", "32",
"33", "34", "35", "36", "37", "38", "39", "40", "41", "42",
"43", "44", "45", "46", "47", "48", "49", "50", "51", "52",
"53", "54", "55", "56", "57", "58", "59", "60", "61", "62",
"63", "64", "65", "66", "67", "68", "69", "70", "71", "72",
"73", "74", "75", "76", "77", "78", "79", "80", "81", "82",
"83", "84", "85", "86", "87", "88", "89", "90", "91", "92",
"93", "94", "95", "96", "97", "98", "99", "100", "101", "102",
"103", "104", "105", "106", "107", "108", "109", "110", "111",
"112", "113", "114", "115", "116", "117", "118", "119", "120",
"121", "122", "123", "124", "125", "126", "127", "128", "129",
"130", "131", "132", "133", "134", "135", "136", "137", "138",
"139", "140", "141", "142", "143", "144", "145", "146", "147",
"148", "149", "150", "151", "152", "153", "154", "155", "156",
"157", "158", "159", "160", "161", "162", "163", "164", "165",
"166", "167", "168", "169", "170", "171", "172", "173", "174",
"175", "176", "177", "178", "179", "180", "181", "182", "183",
"184", "185", "186", "187", "188", "189", "190", "191", "192",
"193", "194", "195", "196", "197", "198", "199", "200", "201",
"202", "203", "204", "205", "206", "207", "208", "209", "210",
"211", "212", "213", "214", "215", "216", "217", "218", "219",
"220", "221", "222", "223", "224", "225", "226", "227", "228",
"229", "230", "231", "232", "233", "234", "235", "236", "237",
"238", "239", "240", "241", "242", "243", "244", "245", "246",
"247"), class = "factor"), ChoiceSet = structure(c(1L, 1L,
1L, 1L, 1L, 1L), .Label = c("Baseline_Choice_1", "Baseline_Choice_2",
"Baseline_Choice_3", "Baseline_Choice_4", "SS_Green_1", "SS_Green_2",
"SS_Green_3", "SS_Green_4", "SS_Green_ESG_1", "SS_Green_ESG_2",
"SS_Green_ESG_3", "SS_Green_ESG_4", "SS_ESG_1", "SS_ESG_2",
"SS_ESG_3", "SS_ESG_4", "SS_Comp_Green_1", "SS_Comp_Green_2",
"SS_Comp_Green_3", "SS_Comp_Green_4", "SS_Comp_ESG_1", "SS_Comp_ESG_2",
"SS_Comp_ESG_3", "SS_Comp_ESG_4", "SS_Comp_1", "SS_Comp_2",
"SS_Comp_3", "SS_Comp_4", "SS_All_1", "SS_All_2", "SS_All_3",
"SS_All_4", "WTP_All_1", "WTP_All_2", "WTP_All_3", "WTP_All_4",
"WTP_Comp_1", "WTP_Comp_2", "WTP_Comp_3", "WTP_Comp_4", "WTP_Comp_ESG_1",
"WTP_Comp_ESG_2", "WTP_Comp_ESG_3", "WTP_Comp_ESG_4", "WTP_Comp_Green_1",
"WTP_Comp_Green_2", "WTP_Comp_Green_3", "WTP_Comp_Green_4",
"WTP_ESG_1", "WTP_ESG_2", "WTP_ESG_3", "WTP_ESG_4", "WTP_ESG_Green_1",
"WTP_ESG_Green_2", "WTP_ESG_Green_3", "WTP_ESG_Green_4",
"WTP_Green_1", "WTP_Green_2", "WTP_Green_3", "WTP_Green_4"
), class = "factor"), value = c("Off", "Off", "Off", "Off",
"Off", "Off"), Choice = c("Conventional", "Conventional",
"Conventional", "Conventional", "Conventional", "Conventional"
), price = c(1.5, 1.5, 1.5, 1.5, 1.5, 1.5)), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))