Package 'sgstar'

Title: Seasonal Generalized Space Time Autoregressive (S-GSTAR) Model
Description: A set of function that implements for seasonal multivariate time series analysis based on Seasonal Generalized Space Time Autoregressive with Seemingly Unrelated Regression (S-GSTAR-SUR) Model by Setiawan(2016)<https://www.researchgate.net/publication/316517889_S-GSTAR-SUR_model_for_seasonal_spatio_temporal_data_forecasting>.
Authors: M. Yoga Satria Utama Developer [aut, cre], Ernawati Pasaribu Developer [aut]
Maintainer: M. Yoga Satria Utama Developer <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-02-07 03:26:44 UTC
Source: https://github.com/yogasatria30/sgstar

Help Index


Coordinate of region in South Sumatera

Description

A simple tibble dataset containing the coordinate region In South.

Usage

coords

Format

A tibble with 17 rows as Region/City and 2 column,which are:

"Longitude"

longitude coordinate for each location

"Latitude"

latitude coordinate for each location

Source

https://www.bps.go.id/


Timeseries Plot for Model

Description

Plotting line chart dataset and fit.values of the Seasonal GSTAR model.

Usage

plot_sgstar(formula)

Arguments

formula

an object from the output from sgstar() function.

Value

returns output a list that shown line chart for each location.

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)
plot1 <- plot_sgstar(fit)

Predict for Seasonal GSTAR model.

Description

Predicting value based on Sgstar object

Usage

predict_sgstar(formula, n_time)

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

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)

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

Sample Data for simulate analysis data

Description

A simple tibble that is generate from random normal distribution for simulate seasonal generalized space-time autoregressive model.

Usage

simulatedata

Format

A tibble with 100 observation time and 17 column as location,which are:

"PALEMBANG"

a value dataset for PALEMBANG

"LUBUKLINGGAU"

a value dataset for LUBUKLINGGAU

"OGAN KOMERING ULU SELATAN"

a value dataset for OGAN KOMERING ULU SELATAN

"OGAN KOMERING ULU"

a value dataset for OGAN KOMERING ULU

"OGAN KOMERING ILIR"

a value dataset for OGAN KOMERING ILIR

"MUSI RAWAS"

a value dataset for MUSI RAWAS

"OGAN ILIR"

a value dataset for OGAN ILIR

"PAGAR ALAM"

a value dataset for PAGAR ALAM

"BANYU ASIN"

a value dataset for BANYU ASIN

"OGAN KOMERING ULU TIMUR"

a value dataset for OGAN KOMERING ULU TIMUR

"EMPAT LAWANG"

a value dataset for EMPAT LAWANG

"PRABUMULIH"

a value dataset for EMPAT LAWANG

"LAHAT"

a value dataset for LAHAT

"MUSI RAWAS UTARA"

a value dataset for MUSI RAWAS UTARA

"PENUKAL ABAB LEMATANG ILIR"

a value dataset for PENUKAL ABAB LEMATANG ILIR

"MUARA ENIM"

a value dataset for MUARA ENIM

"MUSI BANYUASIN"

a value dataset for MUSI BANYUASIN