Running examples in ‘nmm-Ex.R’ failed
The error most likely occurred in:

> ### Name: diagnostics
> ### Title: Goodness of fit measures for both parts
> ### Aliases: diagnostics
> 
> ### ** Examples
> 
> library(systemfit)
> data( ppine , package="systemfit")
> hg.formula <- hg ~ exp( h0 + h1*log(tht) + h2*tht^2 + h3*elev)
> dg.formula <- dg ~ exp( d0 + d1*log(dbh) + d2*hg + d3*cr)
> labels <- list( "height.growth", "diameter.growth" )
> model <- list( hg.formula, dg.formula )
> start.values <- c(h0=-0.5, h1=0.5, h2=-0.001, h3=0.0001,
+                   d0=-0.5, d1=0.009, d2=0.25, d3=0.005)
> model.sur <- nlsystemfit( "SUR", model, start.values, data=ppine, eqnlabels=labels )
Warning in nlm(knls, startvals, typsize = abs(startvals), iterlim = maxiter,  :
  NA/Inf replaced by maximum positive value
Warning in nlm(knls, startvals, typsize = abs(startvals), iterlim = maxiter,  :
  NA/Inf replaced by maximum positive value
> eq_c <- as.character(c(hg.formula, dg.formula))
> parl <- c(paste0("h", 0:3),paste0("d", 0:3))
> start.values <- c(h0=-0.5, h1=0.5, h2=-0.001, h3=0.0001,
+                   d0=-0.5, d1=0.009, d2=0.25, d3=0.005)
> res <- nmm(ppine, eq_c=eq_c, start_v=start.values, par_c=parl, eq_type = "cont",
+ best_method = FALSE)
> ressur <- in2nmm(res, new_coef=model.sur$b)
> diagnostics(res)
      stat    eq    value
 1:   RMSE Total   1.0391
 2:   RMSE     1   1.3942
 3:   RMSE     2   0.4642
 4:   MAPE Total  47.8106
 5:   MAPE     1  33.7890
 6:   MAPE     2  61.8323
 7:    Rx2 Total   0.7938
 8:    Rx2     1   0.2781
 9:    Rx2     2   0.2649
10: Rx2adj Total   0.7894
11: Rx2adj     1   0.2648
12: Rx2adj     2   0.2513
13:    AIC Total 184.5915
14:   AICc Total 183.6743
15:    BIC Total 209.4874
> diagnostics(ressur)
      stat    eq    value
 1:   RMSE Total   1.0361
 2:   RMSE     1   1.3928
 3:   RMSE     2   0.4554
 4:   MAPE Total  48.1462
 5:   MAPE     1  33.7967
 6:   MAPE     2  62.4957
 7:    Rx2 Total   0.7950
 8:    Rx2     1   0.2796
 9:    Rx2     2   0.2924
10: Rx2adj Total   0.7906
11: Rx2adj     1   0.2663
12: Rx2adj     2   0.2793
13:    AIC Total 185.9270
14:   AICc Total 185.0098
15:    BIC Total 210.8229
> 
> #example discrete
> library(mlogit)
Loading required package: dfidx

Attaching package: ‘dfidx’

The following object is masked from ‘package:stats’:

    filter

> 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")
tcltk DLL is linked to '/opt/R/arm64/lib/libtk8.6.dylib'
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: Tcl/Tk libraries are missing: install the Tcl/Tk component from the R installer
Execution halted