Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there known compatibility issues with R package mgcv? Are there general rules for compatibility?

Tags:

r

mgcv

I use R version 2.15.1 (2012-06-22) and mgcv version 1.7-22

I load the following set of packages in R:


library(sqldf)
library(timeDate)
library(forecast)
library(xts)
library(tseries)
library(MASS)
library(mgcv)

It happens that I can not run a simple model (I omit the code). Even the sample code taken from the help pages:


dat = gamSim(1,n=400,dist="normal",scale=2)
b = gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)

gives an error:


Error in qr.qty(qrc, sm$S[[l]]) : 
  NA/NaN/Inf in foreign function call (arg 5)
In addition: Warning message:
In smoothCon(split$smooth.spec[[i]], data, knots, absorb.cons, scale.penalty = scale.penalty,  :
  number of items to replace is not a multiple of replacement length

Note that everything works fine, if I just load the package mgcv and then use the sample code right away. It also works if I just load all the packages and run the sample code. It just does not work if I

  1. load all packages
  2. do some file reading, sqldf statements, ts operations and some models from package forecast.
  3. if I then apply GAM, it does not work anymore.

Apparently the variable definitions in the general environment mess up the functioning of the package.

Are there any known issues? Are there general rules that I have to obey if I load various packages? Can I write code that "disturbed" the package mgcv?

like image 240
Richi W Avatar asked Nov 04 '22 04:11

Richi W


1 Answers

@ Richard there are 2 GAM related packages: gam and mgcv. Loading both libraries at the same time usually causes a conflict.

like image 175
Meso Avatar answered Nov 08 '22 15:11

Meso