[R] Invalid term in model formula with gmm after formula.tools is loaded

Elysée Aristide @r|e|92@nd @end|ng |rom gm@||@com
Wed Oct 30 17:45:29 CET 2024


Hi everyone,

I am using the gmm function from the gmm package and encountered an
unexpected error. No model can be estimated if I load formula.tools—I need
to restart R each time. Here is a simple reproducible example:


















*library(gmm)data(Finance)r <- Finance[1:300, 1:10]rm <- Finance[1:300,
"rm"]rf <- Finance[1:300, "rf"]z <- as.matrix(r-rf)zm <- rm-rfres <- gmm(z
~ zm, x = ~ zm)summary(res)# Now the model cannot be estimated is
formula.tools is loadedlibrary(formula.tools)res <- gmm(z ~ zm, x = ~ zm) #
invalid term in model formula# Even if I detach
detach("package:formula.tools", unload = TRUE)res <- gmm(z ~ zm, x = ~ zm)
# invalid term in model formula*

Once formula.tools is loaded in my environment, I cannot estimate any model
with the gmm function. I need to restart R each time.

Is there a way to avoid restarting R once formula.tools has been loaded?

Best,
Aristide

	[[alternative HTML version deleted]]



More information about the R-help mailing list