[R] R2BayesX help
Hairong Gu
nonlosing at gmail.com
Fri Apr 22 03:34:30 CEST 2016
Hi,
I wonder if anyone can help me with this issue. I am using R2BayesX. It
seems that the model can maximally contain 20 interactions. When the number
of interaction terms exceed 20, the code stops working. Here is a piece of
toy code.
rm(list=ls())
library(BayesX)
library(R2BayesX)
#data generating model
f2<-function(x1,x2,x3,x4)
{
y<-2*sin(pi*x1)*1.5+exp(2*x2)/3+2 * sin(4 * pi * (x3 - 0.2) *(x4 - 0.7))
}
#the dataset
nsample<-40 #sample size
x1.tot<-runif(nsample,0,1)
x2.tot<-runif(nsample,0,1)
x3.tot<-runif(nsample,0,1)
x4.tot<-runif(nsample,0,1)
x5.tot<-runif(nsample,0,1)
x6.tot<-runif(nsample,0,1)
x7.tot<-runif(nsample,0,1)
pnoise<-0.2
eta<-f2(x1.tot,x2.tot,x3.tot,x4.tot)
y.tot<-eta+pnoise*rnorm(nsample,0,1)
d<-data.frame(y.tot,x1.tot,x2.tot,x3.tot,x4.tot,x5.tot,x6.tot,x7.tot)
nk2<-5
# the full model that contains the interactions of all pairs of x1~x7, 21
terms in total
fr2<-y.tot ~ sx(x1.tot, x2.tot, knots = nk2, bs = "te") + sx(x1.tot,
x3.tot, knots = nk2, bs = "te") +
sx(x1.tot, x4.tot, knots = nk2, bs = "te") + sx(x1.tot, x5.tot, knots =
nk2, bs = "te") +
sx(x1.tot, x6.tot, knots = nk2, bs = "te") + sx(x1.tot, x7.tot, knots =
nk2, bs = "te") +
sx(x2.tot, x3.tot, knots = nk2, bs = "te") + sx(x2.tot, x4.tot, knots =
nk2, bs = "te") +
sx(x2.tot, x5.tot, knots = nk2, bs = "te") + sx(x2.tot, x6.tot, knots =
nk2, bs = "te") +
sx(x2.tot, x7.tot, knots = nk2, bs = "te") + sx(x3.tot, x4.tot, knots =
nk2, bs = "te") +
sx(x3.tot, x5.tot, knots = nk2, bs = "te") + sx(x3.tot, x6.tot, knots =
nk2, bs = "te") +
sx(x3.tot, x7.tot, knots = nk2, bs = "te") + sx(x4.tot, x5.tot, knots =
nk2, bs = "te") +
sx(x4.tot, x6.tot, knots = nk2, bs = "te") + sx(x4.tot, x7.tot, knots =
nk2, bs = "te") +
sx(x5.tot, x6.tot, knots = nk2, bs = "te") + sx(x5.tot, x7.tot, knots =
nk2, bs = "te") +
sx(x6.tot, x7.tot, knots = nk2, bs = "te")
m2<-bayesx(fr2,data = d)
The code halted in a couple of seconds after the last function, with a
warning:
Warning message:
running command
'"C:/Users/Hairong/Documents/R/win-library/3.2/BayesXsrc/libs/x64/BayesX.exe"
C:/Users/Hairong/AppData/Local/Temp/RtmpkFfoCH/bayesx5/bayesx.estim.input.prg'
had status 5
The model was not estimated. However, if I delete ANY one of the
interaction terms to make the total interaction terms 20, the model can be
estimated.
I would appreciate your suggestion and explanation on this problem. Thank
you a lot.
Hairong
[[alternative HTML version deleted]]
More information about the R-help
mailing list