postcAIC_CI: Post-cAIC confidence intervals

Description Usage Arguments Details Value Examples

View source: R/postcAIC_CI.R

Description

Function postcAIC_CI provides post-cAIC confidence intervals for mixed and fixed effects under NERM

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
postcAIC_CI(
  cAIC_min,
  degcAIC_models,
  X_full,
  X_cluster_full,
  sig_u_full,
  sig_e_full,
  model = "NERM",
  clusterID,
  beta_sel,
  mu_sel,
  modelset_matrix,
  x_beta_lin_com = NULL,
  n_starting_points = 5,
  scale_mvrnorm = 1,
  alpha = 0.05
)

Arguments

cAIC_min

Index of the selected model among models in the model set

degcAIC_models

Penalty for all considered models

X_full

Matrix with a full set of covariates

X_cluster_full

Matrix with cluster level covariates for fixed effects of the full model

sig_u_full

Variance parameter of random effects from the full model

sig_e_full

Variance parameter of errors from the full model

model

Type of mixed model. For the moment, only NERM is supposted.

clusterID

Vector with cluster labels

beta_sel

Fixed effects (regression parameters) of the selected model

mu_sel

Mixed effects of the selected model

modelset_matrix

Matrix composed of zeros and ones

x_beta_lin_com

Vector or matrix to create linear combinations with fixed parameters. Default: x_beta_lin_com = NULL

n_starting_points

Number of initial starting points for sampling from a truncated normal distribution. Default: n_starting_points = NULL

scale_mvrnorm

Scale parameter for multivariate normal distribution to sample. Default: scale_mvrnorm = 1.

alpha

Construct 1 - alpha confidence intervals. Default: alpha = 0.05

Details

The running time of function postcAIC_CI is extremely sensitive to the choice of scaling factor scale_mvrnorm which affects the speed of finding initial starting points in function find_starting_points. These starting points are necessary to sample from a constrained normal distribution from which we obtain critical values to construct confidence intervals. We suggest choosing a larger/smaller value if the running time of function postcAIC_CI is longer than 1 minute.

Value

List with parameters:

beta_postcAIC_CI_up

Upper boundary of CI for fixed effects

beta_postcAIC_CI_do

Lower boundary of CI for fixed effects

mixed_postcAIC_CI_up

Upper boundary of CI for mixed effects

mixed_postcAIC_CI_do

Lower boundary of CI for mixed effects

beta_x_postcAIC_CI_up

Upper boundary of CI for linear combinations of fixed effects

beta_x_postcAIC_CI_do

Lower boundary of CI for linear combinations of fixed effects

Examples

 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Define basic parameters -------------------------------------------------
n = 15
m_i = 5
m_total = n * m_i

beta = c(2.25, -1.1, 2.43, rep(0, 2))
sig_e = 1
sig_u = 1

X = simulations_n15_mi5
X_intercept = cbind(rep(1, m_total), X)

clusterID = rep(1:n, each = m_i)

# Create responses, errors and random effects  -------------------
e_ij = rnorm(m_total, 0, sig_e)

u_i = rnorm(n, 0, sig_u)
u_i_aug = rep(u_i, each = m_i)

y = X_intercept%*% beta + u_i_aug + e_ij

# Compute cAIC for models from the set of models -----------------------


cAIC_model_set = compute_cAIC_for_model_set(
  X,
  y,
  clusterID,
  model = "NERM",
  covariate_selection_matrix = NULL,
  modelset  = "part_subset",
  common = c(1:3),
  intercept = FALSE
)

cAIC_min = cAIC_model_set$cAIC_min
degcAIC_models = cAIC_model_set$degcAIC_models
X_full = cAIC_model_set$X_full
X_cluster_full = cAIC_model_set$X_cluster_full

sig_u_full = cAIC_model_set$sig_u_full
sig_e_full = cAIC_model_set$sig_e_full

beta_sel = cAIC_model_set$beta_sel
mu_sel = cAIC_model_set$mu_sel

modelset_matrix = cAIC_model_set$modelset_matrix
x_beta_lin_com = cAIC_model_set$X_cluster_full

# Post-cAIC CI for mixed and fixed parameters ------------------------------------

postcAIC_CI_results = postcAIC_CI(
  cAIC_min,
  degcAIC_models,
  X_full,
  X_cluster_full,
  sig_u_full,
  sig_e_full,
  model = "NERM",
  clusterID,
  beta_sel,
  mu_sel,
  modelset_matrix,
  x_beta_lin_com = NULL )

  plot(postcAIC_CI_results)

KatarzynaReluga/postcAIC documentation built on Jan. 25, 2022, 12:33 a.m.