sgstar {sgstar} | R Documentation |
Fit Seasonal Generalized Space Time Autoregressive Model
Description
sgstar function return the parameter estimation of Seaonal Generalized Space Time Autoregressive Model by using Generalized Least Square (GLS)
Usage
sgstar(data, w, p, ps, s)
Arguments
data |
A dataframe that contain timeseries data with k column as space and n rows as time. |
w |
a spatial weight, matrix ncol(data) * ncol(data) with diagonal = 0. |
p |
an autoregressive order, value must be greater than 0. |
ps |
an autoregressive order for seasonal, value must be greater than 0. |
s |
an order of the seasonal period |
Value
sgstar returns output with detail are shown in the following list :
Coefficiens |
coefficiens parameter model for each location |
Fitted.Values |
a dataframe with fit value for each location based on model |
Residual |
a dataframe that contain residual,that is response minus fitted values based on model |
Performance |
a dataframe containing the following objects: |
MSE : Mean Squared Error (MSE) for all the data combined.
RMSE : Root Mean Squared Error (RMSE) for all the data combined.
AIC : a Version of Akaike's Information Criterion (AIC)
Rsquared : R^2, the ‘fraction of variance explained by the model’.
p |
an autoregressive order |
ps |
an autoregressive order for seasonal |
s |
an order of the seasonal period |
weight |
a spatial weight |
data |
a dataset that used in modeling |
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
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)
fit