Description Usage Arguments Value Examples
Fit Aggregated Model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | aggrmodel(
formula = NULL,
data,
market,
Y = NULL,
timeVar,
timeVar2 = NULL,
groupVar,
repVar,
n_basis,
n_basis_cov = NULL,
basisFunction = "B-Splines",
n_basis2 = NULL,
n_order2 = NULL,
basisFunction2 = NULL,
cicleRep = FALSE,
n_order = 4,
covType = "Homog_Uniform",
corType = "exponential",
optSampleCovMatrix = FALSE,
sigPar_init = NULL,
corPar_init = NULL,
tauPar_init = NULL,
betaCov_init = NULL,
returnFitted = TRUE,
positive_restriction = FALSE,
optimMethod = "L-BFGS-B",
use_parallel = FALSE,
n_cores = parallel::detectCores() - 1,
truncateDec = NULL,
verbose = FALSE,
optVerbose = FALSE,
useGrad = FALSE,
diffTol = 1e-05,
itMax = 100
)
|
formula |
building... |
data |
Dataset containing group, replicates (if any), time and aggregated signal |
market |
Market data frame. MUST be a 3 column dataframe with the following order: Group, Type and Number of subjects |
Y |
Dependent variable: aggregated signal |
timeVar |
Name of time variable |
timeVar2 |
Name of second functional |
groupVar |
Name of grouping variable |
repVar |
Name of replicates variable |
n_basis |
Number of basis functions for basis expansion |
n_basis_cov |
Number of basis functions for variance functional expansion |
basisFunction |
Character indicating which basis: 'B-Splines' or 'Fourier' |
n_basis2 |
Number of basis for second functional |
n_order2 |
Order for second functional expansion |
basisFunction2 |
Character indicating which basis: 'B-Splines' or 'Fourier' |
cicleRep |
Indicator TRUE/FALSE if replicates are cyclical |
n_order |
Order of basis Splines (Default: 4) |
covType |
Covariance functional type. One of "Homog_Uniform", "Homog" or "Heterog" |
corType |
Correlation structure type. One of "periodic" or "exponential" |
optSampleCovMatrix |
Optmization criterion via sample covariance matrix convergence (TRUE and default) or via likelihood (more sensitive) |
sigPar_init |
Inital values for sigma |
corPar_init |
Numeric: Initial value for correlation parameters (default:20) |
tauPar_init |
Numeric: Initial value for expoent parameters of complete covariance (default:0.5) |
betaCov_init |
Inital values for variance functional expansion |
returnFitted |
Should the fitted values be returned in output? |
positive_restriction |
TRUE/FALSE if mean curves are strictly positive |
optimMethod |
Choose optim method (Default: L-BFGS-B) |
use_parallel |
TRUE/FALSE if computation should be parallel |
n_cores |
Number of clusters. Default: parallel::detectCores() |
truncateDec |
Decimal to be truncated at covariance matrix |
verbose |
TRUE/FALSE prints likelihood values during optimization |
optVerbose |
Print parameters while in optmization |
useGrad |
Use gradient function approximation for optimization? (Default: FALSE) |
diffTol |
Tolerance of model covergence |
itMax |
Maximum number of iterations (Default: 100) |
An aggrmodel object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | set.seed(81453)
df <- createSimuData(B1 = 8,
nRep=10)
mkt <- attr(df,"market")
df <- subset(df, group <= 8) # get only cluster 1
mkt <- subset(mkt,group<=8)
fit <-
aggrmodel(
data = df,
market = mkt,
Y = obs,
timeVar = time,
groupVar = group,
repVar = rep,
n_basis = 8,
covType = "Homog_Uniform",
corType = "exponential",
returnFitted = TRUE,
use_parallel = TRUE
)
plot(fit)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.