Monthly Gaussian mixture with two components
Monthly Gaussian mixture with two components
Version 1.0.0
controlList to contain custom control parameters.
mu1Function, see monthlyParams.
mu2Function, see monthlyParams.
sd1Function, see monthlyParams.
sd2Function, see monthlyParams.
probFunction, see monthlyParams.
dataA tibble with the following columns:
Time series of dates.
Vector of Month.
Time series used for fitting.
Time series of weights.
meansMatrix of means where a row represents a month and a column a mixture component.
sdMatrix of std. deviations where a row represents a month and a column a mixture component.
pMatrix of probabilities where a row represents a month and a column a mixture component.
modelNamed List with 12 gaussianMixture objects.
loglikNumeric, total log-likelihood.
fittedA tibble with the classified series
momentsA tibble with the theoric moments. It contains:
Month of the year.
Theoric monthly expected value of the mixture model.
Theoric monthly variance of the mixture model.
Theoric monthly skewness.
Theoric monthly kurtosis.
Number of observations used for fitting.
Monthly log-likelihood.
coefficientsA tibble with the fitted parameters.
std.errorsA tibble with the fitted std.errors
tidyA tibble with the fitted std.errors
new()Initialize a solarMixture object
solarMixture$new(
components = 2,
method = "mixtools",
maxit = 10000,
maxrestarts = 1000,
abstol = 1e-08
)components(integer(1)), number of components.
methodCharacter, package used to fit the parameters. Can be mixtools or mclust.
maxit(integer(1)) Numeric, maximum number of iterations.
maxrestarts(integer(1)) Numeric, maximum number of restarts.
abstol(numeric(1)) Numeric, absolute level for convergence.
fit()Fit the parameters with mclust package
xvector
datedate vector
weightsobservations weights, if a weight is equal to zero the observation is excluded, otherwise is included with unitary weight.
When missing all the available observations will be used.
methodCharacter, package used to fit the parameters. Can be mclust or mixtools.
mu_targetNumeric vector with length 12, target mean of the mixture to match.
var_targetNumeric vector with length 12, target variance of the mixture to match.
update()Update means, sd, p .
filter()Apply the $filter() method to all the gaussianMixture models
# Model fit
model <- solarModel$new(spec)
model$fit()
#> No outliers!
# Inputs
x <- model$data$u_tilde
w <- model$data$weights
date <- model$data$date
# Solar Mixture object
sm <- solarMixture$new()
sm$fit(x, date, w)
params <- sm$parameters
sm$std.errors
#> # A tibble: 12 × 7
#> Month mu1 mu2 sd1 sd2 p1 p2
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0.0801 0.0436 0.0459 0.0381 0.0482 0.0482
#> 2 2 0.110 0.0323 0.0674 0.0476 0.0518 0.0518
#> 3 3 0.106 0.0392 0.0667 0.0297 0.0405 0.0405
#> 4 4 0.126 0.0585 0.0623 0.0487 0.0624 0.0624
#> 5 5 0.129 0.0446 0.0597 0.0394 0.0463 0.0463
#> 6 6 0.158 0.0437 0.0596 0.0379 0.0488 0.0488
#> 7 7 0.138 0.0311 0.0637 0.0302 0.0443 0.0443
#> 8 8 0.216 0.0397 0.0750 0.0565 0.0716 0.0716
#> 9 9 0.124 0.0341 0.0594 0.0320 0.0417 0.0417
#> 10 10 0.144 0.0447 0.0425 0.0418 0.0516 0.0516
#> 11 11 0.158 0.0715 0.0811 0.0441 0.0683 0.0683
#> 12 12 0.134 0.0562 0.0573 0.0837 0.0860 0.0860
# params[1,]$mu1 <- params[1,]$mu1*0.9
# sm$update(means = params[,c(2,3)])