R6 class that stores the component specifications and control settings used to initialize and fit a solarModel object.

Value

An R6 object of class solarModel_spec.

Note

Version 1.0.3

Public fields

outliers

List containing detected outlier information.

place

Character, optional name of the location considered.

coords

A named list with coordinates for the selected location. Contains:

lat

Numeric, reference latitude in degrees.

lon

Numeric, reference longitude in degrees.

alt

Numeric, reference altitude in metres.

Active bindings

target

Character, name of the target variable to model. Can be "GHI" or "clearsky".

location

A Tibble with the name and the coordinates of the location considered. Contains:

place

Character, selected location

target

Target variable

lat

Numeric, reference latitude in degrees.

lon

Numeric, reference longitude in degrees.

alt

Numeric, reference altitude in metres.

model_name

Character, standard model's name.

dates

A named list with three sub-lists: data for the complete dataset, train for the training dataset, and test for the test dataset. Each sub-list is structured as follows:

from

Character date, minimum date in the dataset.

to

Character date, maximum date in the dataset.

nobs

Integer scalar, number of observations contained in the dataset between from and to.

perc

Numeric scalar, percentage of data in the dataset with respect to the complete data.

data

Tibble, dataset with CAMS solar radiation data.

transform

A solarTransform object with the transformation applied to the data.

seasonal_model_Ct

A seasonalClearsky object with the clear-sky model applied to the data.

seasonal.mean

A seasonalModel object with the seasonal model applied to the data.

mean.model

An ARMA_modelR6 object with the ARMA model applied to the data.

seasonal.variance

A seasonalModel object with the seasonal variance applied to the data.

variance.model

An sGARCH object with the GARCH model applied to the data.

mixture.model

A solarMixture object with the monthly Gaussian Mixture models applied to the data.

coefficients

Get the model parameters as a named list.

std.errors

Get model parameter standard errors as a named list.

hessian

Get the model hessian.

jacobian

Get the model jacobian.

clearsky_threshold

Numeric, parameter > 1, used to scale up CAMS clearsky.

stochastic_clearsky

Logical, when TRUE the clear sky is considered stochastic.

quiet

Logical. If TRUE, suppress messages where supported.

Methods


Method new()

Initialize a solarModel_spec object.

Usage

Returns

Initializes component specifications and control settings.


Method set_params()

Set general controls.

Usage

solarModel_spec$set_params(
  stochastic_clearsky = FALSE,
  clearsky_threshold = 1.01,
  quiet = FALSE
)

Arguments

stochastic_clearsky

Logical, when TRUE the clear sky will be considered stochastic.

clearsky_threshold

Numeric. Parameter greater than 1 used to scale up CAMS clear-sky radiation.

quiet

Logical. If TRUE, suppress messages where supported.

Returns

Updates general control settings.


Method set_transform()

Control parameters for the solarTransform. See solarTransform for more details.

Usage

solarModel_spec$set_transform(
  min_pos = 1,
  max_pos = 1,
  link = "invgumbel",
  delta = 0.05,
  threshold = 0.01
)

Arguments

min_pos

Integer, position of the minimum. For example when 2 the minimum is the second lowest value.

max_pos

Integer, position of the maximum. For example when 3 the maximum is the third greatest value.

link

Character, link function.

delta

Numeric. Small adjustment used around fitted transformation bounds.

threshold

Numeric. Threshold used to estimate the transformation parameters $$\alpha$$ and $$\beta$$. The default is 0.01. See solarTransform for more details.

Returns

Updates the stored solarTransform object and its controls.


Method set_clearsky()

List with specification's parameters of the clear sky model.

Usage

solarModel_spec$set_clearsky(
  spec = seasonalClearsky_spec(),
  control = control_seasonalClearsky()
)

Arguments

spec

Named list, model's specification. See the function seasonalClearsky_spec for more details.

control

Named list, control parameters. See the function control_seasonalClearsky for more details.

Returns

Updates the stored seasonalClearsky model object.


Method set_seasonal.mean()

List with specification's parameters of the seasonal mean \(\bar{Y}_t\) for \(Y_t\).

Usage

solarModel_spec$set_seasonal.mean(
  order = 1,
  period = 365,
  include.trend = FALSE,
  include.intercept = TRUE,
  monthly.mean = FALSE
)

Arguments

order

Integer. Specify the order of the seasonal mean $$\bar{Y}_t$$. The default is 1.

period

Integer, seasonal periodicity, the default is 365.

include.trend

Logical. When TRUE an yearly trend $$t$$ will be included in the seasonal model, otherwise will be excluded. The default is FALSE.

include.intercept

Logical. When TRUE the intercept $$a_0$$ will be included in the seasonal model, otherwise will be excluded. The default is TRUE.

monthly.mean

Logical. When TRUE, monthly means are computed on the deseasonalized series $$\tilde{Y}_t = Y_t - \bar{Y}_t$$ and subtracted from the series.

Returns

Updates the stored seasonal mean model.


Method set_mean.model()

List with specification's parameters of the ARMA model for deseasonalized series \(\tilde{Y}_t = Y_t - \bar{Y}_t\).

Usage

solarModel_spec$set_mean.model(
  arOrder = 1,
  maOrder = 0,
  include.intercept = FALSE
)

Arguments

arOrder

Integer. An integer specifying the order of the AR component. The default is 1.

maOrder

Integer. An integer specifying the order of the MA component. The default is 0.

include.intercept

Logical. When TRUE the intercept $$\phi_0$$ will be included in the seasonal model, otherwise will be excluded. The default is FALSE.

Returns

Updates the stored ARMA mean model.


Method set_seasonal.variance()

List with specification's parameters of the seasonal variance \(\bar{\sigma}_t\) for ARMA's residuals \(e_t\)

Usage

solarModel_spec$set_seasonal.variance(
  order = 1,
  period = 365,
  include.trend = FALSE,
  correction = FALSE,
  monthly.mean = FALSE
)

Arguments

order

Integer. Specify the order of the seasonality of the seasonal variance. The default is 1.

period

Integer, seasonal periodicity, the default is 365.

include.trend

Logical. When TRUE an yearly trend $$t$$ will be included in the seasonal model, otherwise will be excluded. The default is FALSE.

correction

Logical. When TRUE, seasonal variance parameters are corrected to target unit variance for standardized residuals.

monthly.mean

Logical. When TRUE a vector of 12 monthly std. deviations will be computed on the standardized residuals $$\tilde{\varepsilon}_t$$ and used to standardize the time series by month.

Returns

Updates the stored seasonal variance model.


Method set_variance.model()

List with specification's parameters of the GARCH variance \(\sigma_t\) for deseasonalized residuals \(\tilde{e}_t = e_t/\bar{\sigma}_t\).

Usage

solarModel_spec$set_variance.model(archOrder = 1, garchOrder = 1)

Arguments

archOrder

Integer. An integer specifying the order of the ARCH component. The default is 1.

garchOrder

Integer. An integer specifying the order of the GARCH component. The default is 1.

Returns

Updates the stored GARCH variance model.


Method set_mixture.model()

List with specification's parameters of the Gaussian mixture model for GARCH residuals \(u_t = \tilde{e}_t/\sigma_t\).

Usage

solarModel_spec$set_mixture.model(
  abstol = 1e-20,
  match.expectation = FALSE,
  match.variance = FALSE,
  match.empiric = FALSE,
  method = "mclust",
  maxit = 5000,
  maxrestarts = 500
)

Arguments

abstol

Numeric. Absolute level for convergence of the EM-algorithm. The default is 1e-20.

match.expectation

Logical. If TRUE, mixture parameters are fitted with an expectation-matching constraint.

match.variance

Logical. If TRUE, mixture parameters are fitted with a variance-matching constraint.

match.empiric

Logical, when TRUE and match.expectation = TRUE or match.variance = TRUE the mixture parameters will be estimated ensuring that mean and variance matches the empirical parameters. Otherwise if FALSE and match.expectation = TRUE or match.variance = TRUE the target expectation will be zero and the target variance 1.

method

Character, package used to fit the parameters. Can be mclust or mixtools.

maxit

Integer. Maximum number of iterations for EM-algorithm. The default is 5000.

maxrestarts

Integer. Maximum number of restarts when EM-algorithm does not converge. The default is 500.

Returns

Updates the stored monthly Gaussian mixture model.


Method specification()

Specification function for a solarModel

Usage

solarModel_spec$specification(
  place,
  target = "GHI",
  min_date,
  max_date,
  from,
  to,
  data
)

Arguments

place

Character, name of an element in the CAMS_data list.

target

Character, target variable to model. Can be GHI or clearsky.

min_date

Character. Date in the format YYYY-MM-DD. Minimum date for the complete data. If missing will be used the minimum data available.

max_date

Character. Date in the format YYYY-MM-DD. Maximum date for the complete data. If missing will be used the maximum data available.

from

Character. Date in the format YYYY-MM-DD. Starting date to use for training data. If missing will be used the minimum data available after filtering for min_date.

to

Character. Date in the format YYYY-MM-DD. Ending date to use for training data. If missing will be used the maximum data available after filtering for max_date.

data

Optional data frame for the selected location.

Returns

Updates stored data, location metadata, date ranges, and target variable.


Method update()

Update the parameters inside object

Usage

solarModel_spec$update(params)

Arguments

params

List of parameters. See the slot $coefficients for a template.

Returns

Updates component model parameters when params is supplied.


Method print()

Print method for solarModel_spec class.

Usage

solarModel_spec$print()

Returns

Prints a summary of the specification.


Method clone()

The objects of this class are cloneable with this method.

Usage

solarModel_spec$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

spec <- solarModel_spec$new()
spec$specification("Bologna", max_date = "2005-01-10")
#> No outliers!
spec$model_name
#> [1] "invgumbel-ARMA(1, 0)-GARCH(1, 1)"