# \donttest{
deep <- argo_floats_atlantic_2003[argo_floats_atlantic_2003$depth==3, ]
deep$x2inter <- deep$xinter*deep$xinter
deep$month <- factor(deep$month)
deep$lat2 <- (deep$lat)^2
deep$sin1 <- round(sin(deep$time*2*pi/365), 4)
deep$cos1 <- round(cos(deep$time*2*pi/365), 4)
deep$sin2 <- round(sin(deep$time*4*pi/365), 4)
deep$cos2 <- round(cos(deep$time*4*pi/365), 4)
deep[, c( "xlat2", "xsin1", "xcos1", "xsin2", "xcos2")] <-
scale(deep[,c("lat2", "sin1", "cos1", "sin2", "cos2")])
f2 <- temp ~ xlon + xlat + xlat2+ xinter + x2inter
M2 <- Bmoving_sptime(formula=f2, data = deep, coordtype="lonlat",
coords = 1:2, N=11, burn.in=6, validrows =NULL, mchoice = FALSE)
summary(M2)
plot(M2)
names(M2)
# Testing for smaller data sets with different data pattern
d2 <- deep[1:25, ]
d2$time <- 1:25
# Now there is no missing times
M1 <- Bmoving_sptime(formula=f2, data = d2, coordtype="lonlat", coords = 1:2,
N=11, burn.in=6, mchoice = FALSE)
summary(M1)
d2[26, ] <- d2[25, ]
# With multiple observation at the same location and time
M1 <- Bmoving_sptime(formula=f2, data = d2, coordtype="lonlat", coords = 1:2,
N=11, burn.in=6, mchoice = FALSE)
summary(M1)
d2[27, ] <- d2[24, ]
d2[27, 3] <- 25
# With previous location re-sampled
M1 <- Bmoving_sptime(formula=f2, data = d2, coordtype="lonlat", coords = 1:2,
N=11, burn.in=6, mchoice = FALSE)
summary(M1)
# }
Run the code above in your browser using DataLab