set.seed(1000)
n <- 30
Lt <- list()
Ly <- list()
Lx1 <- list()
Lx2 <- list()
for (i in 1:n) {
Ni <- sample(10:15,1)
Lt[[i]] <- sort(runif(Ni,0,1))
Lx1[[i]] <- runif(Ni,0,1)
Lx2[[i]] <- runif(Ni,0,1)
Ly[[i]] <- Lt[[i]]*(cos(2*pi*Lx1[[i]]) + sin(2*pi*Lx2[[i]])) + rnorm(Ni,0,0.1)
}
LLx <- list(Lx1,Lx2)
gridT <- seq(0,1,length.out=31)
x0 <- seq(0,1,length.out=31)
x <- cbind(x0,x0)
ht <- 0.1
hx <- c(0.1,0.1)
tvam <- TVAM(Lt,Ly,LLx,gridT=gridT,x=x,ht=ht,hx=hx,K='epan')
g0Sbf <- tvam$tvamMean
gjSbf <- tvam$tvamComp
op <- par(mfrow=c(1,2), mar=c(1,1,1,1)+0.1)
persp(gridT,x0,gjSbf[[1]],theta=60,phi=30,
xlab='time',ylab='x1',zlab='g1(t, x1)')
persp(gridT,x0,gjSbf[[2]],theta=60,phi=30,
xlab='time',ylab='x2',zlab='g1(t, x2)')
par(op)
Run the code above in your browser using DataLab