Description Usage Arguments Author(s) See Also Examples
The prediction at new locations are calculated based on the fitting results saved in memory based on the original dataset.
1 | predNew_local(original, newdata, mlcontrol = spacetime.control())
|
original |
The data.frame which contains all fitting results of original dataset. The data.frame is saved in memory, not on HDFS. |
newdata |
A data.frame includes all locations' longitude, latitude, and elevation, where the prediction is to be calculated. |
mlcontrol |
Should be a list object generated from |
Xiaosu Tong
spacetime.control
, mapreduce.control
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ## Not run:
library(maps)
library(Spaloess)
library(datadr)
new.grid <- expand.grid(
lon = seq(-126, -67, by = 1),
lat = seq(25, 49, by = 1)
)
instate <- !is.na(map.where("state", new.grid$lon, new.grid$lat))
new.grid <- new.grid[instate, ]
elev.fit <- spaloess( elev ~ lon + lat,
data = station_info,
degree = 2,
span = 0.05,
distance = "Latlong",
normalize = FALSE,
napred = FALSE,
alltree = FALSE,
family="symmetric",
control=loess.control(surface = "direct")
)
grid.fit <- predloess(
object = elev.fit,
newdata = data.frame(
lon = new.grid$lon,
lat = new.grid$lat
)
)
new.grid$elev <- grid.fit
n <- 5000 # just use 5000 stations as example
set.seed(99)
first_stations <- sample(unique(tmax_all$station.id), n)
small_dt <- subset(tmax_all, station.id %in% first_stations)
small_dt$station.id <- as.character(small_dt$station.id)
small_dt$month <- as.character(small_dt$month)
mlcontrol <- spacetime.control(
vari="tmax", time="date", n=576, n.p=12, stat_n=n, surf = "interpolate",
s.window="periodic", t.window = 241, degree=2, span=0.75, Edeg=0
)
fitted <- drsstl(
data=small_dt,
output=NULL,
model_control=mlcontrol
)
rst <- predNew_local(
original = recombine(fitted, combRbind), newdata = new.grid, mlcontrol = mlcontrol
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.