fit_copula_model_BinCont: Fit copula model for binary true endpoint and continuous...

View source: R/fit_model_BinCont_copula.R

fit_copula_model_BinContR Documentation

Fit copula model for binary true endpoint and continuous surrogate endpoint

Description

The function fit_copula_model_BinCont() fits the copula model for a continuous surrogate endpoint and binary true endpoint. Because the bivariate distributions of the surrogate-true endpoint pairs are functionally independent across treatment groups, a bivariate distribution is fitted in each treatment group separately.

Usage

fit_copula_model_BinCont(
  data,
  copula_family,
  marginal_surrogate,
  marginal_surrogate_estimator = NULL,
  twostep = FALSE,
  fitted_model = NULL,
  maxit = 500,
  method = "BFGS"
)

Arguments

data

A data frame in the correct format (See details).

copula_family

One of the following parametric copula families: "clayton", "frank", "gaussian", or "gumbel". The first element in copula_family corresponds to the control group, the second to the experimental group.

marginal_surrogate

Marginal distribution for the surrogate. For all available options, see ?Surrogate::cdf_fun.

marginal_surrogate_estimator

Not yet implemented

twostep

(boolean) if TRUE, the two step estimator implemented in twostep_BinCont() is used for estimation.

fitted_model

Fitted model from which initial values are extracted. If NULL (default), standard initial values are used. This option intended for when a model is repeatedly fitted, e.g., in a bootstrap.

maxit

Maximum number of iterations for the numeric optimization, defaults to 500.

method

Optimization algorithm for maximizing the objective function. For all options, see ?maxLik::maxLik. Defaults to "BFGRS".

Value

WIP

Examples


# Load Schizophrenia data set.
data("Schizo_BinCont")
# Perform listwise deletion.
na = is.na(Schizo_BinCont$CGI_Bin) | is.na(Schizo_BinCont$PANSS)
X = Schizo_BinCont$PANSS[!na]
Y = Schizo_BinCont$CGI_Bin[!na]
Treat = Schizo_BinCont$Treat[!na]
# Ensure that the treatment variable is binary.
Treat = ifelse(Treat == 1, 1, 0)
data = data.frame(X,
                  Y,
                  Treat)
# Fit copula model.
fitted_model = fit_copula_model_BinCont(data, "clayton", "normal", twostep = FALSE)
# Perform sensitivity analysis with a very low number of replications.
sens_results = sensitivity_analysis_BinCont_copula(
  fitted_model,
  10,
  lower = c(-1,-1,-1,-1),
  upper = c(1, 1, 1, 1),
  n_prec = 1e3
)


Surrogate documentation built on June 22, 2024, 9:16 a.m.