predict_sgstar: Predict for Seasonal GSTAR model.

Description Usage Arguments Value References Examples

View source: R/predict_sgstar.R

Description

Predicting value based on Sgstar object

Usage

1

Arguments

formula

an object from the output from sgstar() function.

n_time

number of steps ahead for which prediction is required.

Value

returns output a dataframe that shown predict value based on model, with rows as time and column that shown for each location.

References

Setiawan, Suhartono, and Prastuti M.(2016).S GSTAR-SUR for Seasonal Spatio Temporal Data Forecasting. Malaysian Journal Of Mathematical Sciences.10.<Corpus ID :189955959>.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(sgstar)
data("coords")
data("simulatedata")

#create weight matrix using distance inverse matrix
z<-dist(coords,method = "euclidean")
z <- as.matrix(z)

matriksd <- 1/z
matriksd[is.infinite(matriksd)] <- 0

matriksd_w <- matriksd / rowSums(as.data.frame(matriksd))


fit <- sgstar(data = simulatedata, w = matriksd_w, p = 2,ps = 1, s =4)

#predicting for 12 time ahead
predict.fit <-predict_sgstar(fit,12)

sgstar documentation built on May 23, 2021, 5:06 p.m.