aggrmodel_cluster: Fit aggregated model with clusters

Description Usage Arguments Value Examples

View source: R/aggrmodel_cluster.R

Description

Fit aggregated model with clusters

Usage

 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
aggrmodel_cluster(
  formula = NULL,
  data,
  market,
  Y = NULL,
  timeVar,
  groupVar,
  repVar,
  n_basis,
  n_basis_cov = NULL,
  n_cluster = NULL,
  n_trials = 42,
  basisFunction = "B-Splines",
  cicleRep = FALSE,
  n_order = 4,
  covType = "Homog_Uniform",
  corType = "exponential",
  optMethod = "L-BFGS-B",
  returnFitted = FALSE,
  optLk = TRUE,
  corPar_init = NULL,
  diffTol = 1e-06,
  itMax = 100,
  verbose = FALSE
)

Arguments

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

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

n_cluster

Number of grouping clusters

n_trials

Number of random grouping trials for cluster initial values (Default: 42 and don't forget your towel!)

basisFunction

Character indicating which basis: 'B-Splines' (default) 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" (default), "Homog" or "Heterog"

corType

Correlation structure type. One of "periodic" (default) or "exponential"

corPar_init
diffTol

Tolerance of model covergence (Default: 1e-06)

itMax

Number of maximum iterations of EM algorithm (Default: 100)

verbose

TRUE/FALSE indicating if steps of optimization should be printed as messages (Default: FALSE)

Value

An aggrmodel_cluster object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(81453)
df <- createSimuData(nRep=5)
mkt <- attr(df,"market")

fit_cl = aggrmodel_cluster(data = df, market=mkt, Y = obs, timeVar =
time,groupVar = group, repVar = rep, n_basis = 9, n_basis_cov = NULL,
n_cluster = 2,n_trials = 500, n_order = 4, corType = 'exponential',
returnFitted = TRUE, verbose=TRUE)

plot(fitCluster, scales="free")

gabrielfranco89/aggrmodel documentation built on June 1, 2020, 8:57 a.m.