fvcc | R Documentation |
Clustering Variying Coefficients with a Pitman-Yor Process
fvcc(
ID,
W,
X = NULL,
Z,
t,
Y,
num_knots = 30,
K_max,
num_iters = 10000,
thinning_unit = 5,
nu = 1,
Psi = NULL,
beta = NULL,
kappa = 1000,
return_var_coefs = TRUE
)
ID |
A vector of subjects' IDs. |
W |
A part of design matrix for varying coefficients |
X |
A part of design matrix for time-invariant fixed effects |
Z |
A part of design matrix for random effects |
t |
A vector of time observations |
Y |
A vector of binary responses |
num_knots |
The number of knot candidates for the basis splines |
K_max |
The upper bound of the number of clusters for the stick-breaking process |
num_iters |
The number of iterations for the partially collapsed Gibbs sampler |
thinning_unit |
Thinning unit of the pcg sampler |
nu |
The concentration parameter |
Psi |
An initial covariance matrix of the random effects |
beta |
An initial vector of the fixed effects |
library(fvcc)
#SimulationData is an example dataset.
ID <- SimulationData$ID
W <- SimulationData[c('W1','W2')]
X <- SimulationData[c('X1','X2')]
Z <- SimulationData[c('Z1','Z2')]
t <- SimulationData$t
Y <- SimulationData$Y
output <- fcvarpyp(ID = ID,
W = W,
X = X,
Z = Z,
t = t,
Y = Y,
num_knots = 15,
K_max = 10,
num_iters = 10000)
plot(output$fixed_effect, position = 1)
plot(output$random_effect, row_position = 1, col_position = 1)
plot(output$cluster)
plot(output$varying_coefficient, cluster_number = 5, variable_number = 1)
plot(output$latent_location, cluster_number = 5, variable_number = 1, time_range = output$time_range, knot_position = output$knot_position)
plot(output$nu)
plot(output$lambda)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.