Closed miaejeong630 closed 6 months ago
can you provide me more information? It looks like you have your data formatted correctly but perhaps are not providing the appropriate arguments to the logitr()
function. It would help if you posted the first 6 rows of your dataset (all of the columns, so I can see what variables you have). Also see here: https://jhelvy.github.io/logitr/articles/basic_usage.html#data-format
Thank you for your response. I am grateful that your package makes it easy to do analysis. I did include the part about obsID as you suggested, but it still didn't produce a z-value. I also read the data formatting paper you suggested. However, the coefficients are calculated, but the z-value is not, and the final WTP modeling does not proceed. First, the preference model results are shown below.
`mnl_pref<-logitr(`
`` data = wtpt3.1,
`` outcome = 'choice',
`obsID` = 'id',
pars = c('price','age','edu') )'
Running model... Done!`
<results>
> Model Coefficients:
Estimate Std. Error z-value Pr(>|z|)
price -0.00051319 NA NA NA
age 0.00000000 NA NA NA
edu 24.90583872 NA NA NA
bud 0.25813579 NA NA NA
act -6.32432679 NA NA NA
gar 0.00000000 NA NA NA
gre 14.52830879 NA NA NA
Log-Likelihood: -261.2535918
Null Log-Likelihood: -519.1672382
AIC: 536.5071836
BIC: 568.8384000
McFadden R2: 0.4967834
Adj McFadden R2: 0.4833002
Number of Observations: 749.0000000
data formatting are as belown
> # A tibble: 1,498 × 13
id idx Q8tt price choice alt age edu bud satis gar gre act
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1127 0 5000 0 1 3 4 4 3 2 1 2
2 1 1127 0 2000 1 2 3 4 4 3 2 1 2
3 2 412 0 5000 0 1 4 3 4 3 1 1 1
4 2 412 0 1000 1 2 4 3 4 3 1 1 1
5 3 418 0 5000 0 1 4 4 8 3 1 1 1
6 3 418 0 1000 1 2 4 4 8 3 1 1 1
7 4 410 0 5000 0 1 5 3 2 3 2 1 2
8 4 410 0 1000 1 2 5 3 2 3 2 1 2
9 5 218 0 5000 0 1 3 3 4 4 2 1 1
10 5 218 0 2000 1 2 3 3 4 4 2 1 1
WTP Model results are as below
'wtp(mnl_pref, scalePar = 'price')
Error` in eigen(S, symmetric = TRUE) : infinite or missing values in 'x'
is there a problem on my data such as shortage of alternative, variety of covariance, price data? or other things? How could I fix this? please help. Thanks so much..
Sincerely
Miae Jeong
Usually when you have NAs like this, it means your model is not properly specified. It is likely that one or more of your variables are perfectly or highly correlated. I would start by estimating as simple a model as you can, maybe with just one parameter like price
and see if you get reasonable results. Then add more and you'll see which variables are problematic. You could also just look at the correlations between variables and see the ones that are highly correlated. Finally, it looks like in many of these variables there is no variation within a feature. gre
for example looks like it might be 1 for the whole dataset?
Thanks for your comments. It helped a lot on my analysis. I'll consider more variables for fitting model. Thanks again.
I'm going to mark this issue as closed because this isn't an issue with the package.
Hi I'm Researcher who had studied on choice experiment of green infrastructure at South Korea. when I found R package of 'logitr', I'm very excited on estimating model of WTP and preference. Now, I'm suffered from this error of z-value missing. How coud I figure out the errors in my data and code? `` A tibble: 1,498 × 19 id idx Q8tt price choice alt age reg