Description Usage Arguments Value Examples
Calculates pseudo R^2 for discrete choice part.
1 2 3 4 5 |
x |
Fitted |
which |
which pseudo R^2 to calculate, options are: "all", "McFadden", "adjMcFadden", "Cox&Snell","Nagelkerke". |
only_total |
If |
matrix with goodness of fit measures
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library(mlogit)
data("Fishing", package = "mlogit")
Fish <- mlogit.data(Fishing, varying = c(2:9), shape = "wide", choice = "mode")
## a pure "conditional" model
mres <- summary(mlogit(mode ~ price + catch, data = Fish))
data <- prepare_data(Fish %>% data.frame %>% dplyr::select(-idx),
choice="alt", dummy="mode", PeID="chid", mode_spec_var = c("price", "catch"),
type="long")
eq_d <- c("a1 + p1 * price_1 + p2 * catch_2", "a2 + p1 * price_2 + p2 * catch_2",
"a3 + p1 * price_3 + p2 * catch_3", "a4 + p1 * price_4 + p2 * catch_4")
par_d <- c(paste0("a", 1:4), paste0("p", 1:2))
res <- nmm(data, eq_d=eq_d, par_d = par_d, eq_type="disc", fixed_term=FALSE,
best_method=FALSE)
pseudoR(res, which = c("McFadden"))
ncf <- c(mres$coefficients)
names(ncf) <- par_d[-1]
mress <- in2nmm(res, new_coef = ncf)
pseudoR(mress, which = c("McFadden"))
pseudoR(mress)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.