Title: | Personalised Synthetic Controls |
---|---|
Description: | Allows the comparison of data cohorts (DC) against a Counter Factual Model (CFM) and measures the difference in terms of an efficacy parameter. Allows the application of Personalised Synthetic Controls. |
Authors: | Richard Jackson [cre, aut] |
Maintainer: | Richard Jackson <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2025-02-27 05:18:52 UTC |
Source: | https://github.com/richjjackson/psc |
Function to accept (or not) a proposed solution used as part of the MCMC procedure
acc(old, new)
acc(old, new)
old |
a numeric value |
new |
a numeric value |
A function for the evaluation of two likelihoods as part of the MCMC procedure
returns the an evaluation of old/new > U where U is a draw from the uniform distribution
A generated model with a binary endpoint and a logistic link function. Data for the model were synthetically generated and are based on a dataset to evaulate the use of Sorafenib in HCC akin to the PROSASH model (see ?psc::surv.mod for more details)
bin.mod
bin.mod
A model of class 'glm':
vascular invasion
ECOG performance Status
AFP - log scale
albumin
Creatinine - log scale
metastesis
simulated
This function collects infomation ont he setting of a model for the definition of a Counter Factual Model (CFM) object. Setting information is provided in the PICO format. Intended to be used in conjuction with the pscCRM.R function
cfmSett(P = NULL, I = NULL, C = NULL, O = NULL)
cfmSett(P = NULL, I = NULL, C = NULL, O = NULL)
P |
Character; patient group |
I |
Character; intervention group - perhaps left unspecified |
C |
Character; comparitor group |
O |
Character; outcome definition |
A function for containg basic information pertaining to the setting of a model in PICO format
Validation of a flexsurvreg model This function intends to perform basic validation of a survival model of class 'flexsurvreg'. As a default internal validation will be performed by estimating basic measures of discrimination and calibration. If provided, measures will be estimated on external data. This is intended to be used in conjunction with the pscCRM.R function#' A generic function for extracting model information
cfmValid(cfm, exData)
cfmValid(cfm, exData)
cfm |
a model of class 'flexsurvreg' |
exData |
an external dataset (for external validation) |
a list of validation procedures for measures of discrimination and calibration. Discrimination performed by creating a variable with risk categories based on the 15th, 50th and 85th percentile of the linear predictor. Discrimation estimated provided in terms of kaplan merie estimates and hazard ratios.
Calibration performed by extracting the concordance statistic and by regression the linear predictor against the outcome.
Validation is internal unless an external dataset is provided.
Validation of a flexsurvreg model This function intends to perform basic validation of a survival model of class 'flexsurvreg'. As a default internal validation will be performed by estimating basic measures of discrimination and calibration. If provided, measures will be estimated on external data. This is intended to be used in conjunction with the pscCRM.R function#' A generic function for extracting model information
## S3 method for class 'flexsurvreg' cfmValid(cfm, exData = NULL)
## S3 method for class 'flexsurvreg' cfmValid(cfm, exData = NULL)
cfm |
a model of class 'flexsurvreg' |
exData |
an external dataset (for external validation) |
a list of validation procedures for measures of discrimination and calibration. Discrimination performed by creating a variable with risk categories based on the 15th, 50th and 85th percentile of the linear predictor. Discrimation estimated provided in terms of kaplan merie estimates and hazard ratios.
Calibration performed by extracting the concordance statistic and by regression the linear predictor against the outcome.
Validation is internal unless an external dataset is provided.
Returns basic measures of the posterior distribution obtained from the pscfit.R function
## S3 method for class 'psc' coef(object, ..., level = 0.05)
## S3 method for class 'psc' coef(object, ..., level = 0.05)
object |
a 'psc' object |
... |
not used |
level |
the level at which credibility intervals are assessed, defaults to 0.05 |
The summary of the posterior distribution for the efficacy parameter in terms of the median and 95
A generated model with a continuous data endpoint and a identity link function. Data for the model were synthetically generated and are based on a dataset to evaulate the use of Sorafenib in HCC akin to the PROSASH model (see ?psc::surv.mod for more details)
cont.mod
cont.mod
A model of class 'glm':
ECOG performance Status
AFP - log scale
albumin
Creatinine - log scale
simulated
A generated model with a count data endpoint and a log link function. Data for the model were synthetically generated and are based on a dataset to evaulate the use of Sorafenib in HCC akin to the PROSASH model (see ?psc::surv.mod for more details)
count.mod
count.mod
A model of class 'glm':
ECOG performance Status
AFP - log scale
albumin
Creatinine - log scale
simulated
A dataset containing 100 simulated patients. Data are based on the data used to generate PROSASH survival model -see ?psc::surv.mod for more detials.
data
data
A model of class 'flezsurvreg':
cumulative baseline hazard parameters
vascular invasion
patient age (centred at 60)
ECOG performance Status
AFP - log scale
albumin
Creatinine - log scale
metastesis
centred age nested within vascular invasion
survival time
censoring indicator
survival time
exapmple outcome for count data
exapmple identifier for mulitple treatment comparisons
Aetiology
simulated
A generic function for cleaning data ready for analysis
dataComb(CFM, DC, id = NULL, trt = NULL)
dataComb(CFM, DC, id = NULL, trt = NULL)
CFM |
a model object supplied to pscfit |
DC |
a dataset including covariates to match the CFM |
id |
to specify which observations in the data cohort should be evaluated. Defualts to 'NULL' i.e all observations |
trt |
used to specify multiple treatment effects. Defaults to NULL |
datComb returns a list containing objects which detial the components of both the Counter Factual Model (CFM) and the Data Cohort (DC) the required exported components of the model and a cleaned data cohort.
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data)
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data)
The purpose of this function is to prepare the dataset and the counter-factual model for estimation and is the first step pf the pscfit.R process. The output is a complete-case dataset where the data names match the variables used in the CFM.
## S3 method for class 'flexsurvreg' dataComb(CFM, DC, id = NULL, trt = NULL)
## S3 method for class 'flexsurvreg' dataComb(CFM, DC, id = NULL, trt = NULL)
CFM |
a model object supplied to pscfit |
DC |
a dataset including covariates to match the CFM |
id |
a vector specifiying whether a subset of the dataset should be selected. Defaults to 'NULL' e.g. all data points included |
trt |
An optional additional vector denoting treatment allocations for multiple treatment comparisons. Defaults to 'NULL' |
a list containing objects which specifiy the required exported components of the model and a cleaned data cohort. Attributes include
'model.type' specifying the class of model to be used as the CFM
'model_extract' sepcifying the model componets required for estimation
'cov' a cleaned dataset of covariates
'outcome' a cleaned dataset containing the outcomes
The purpose of this function is to prepare the dataset and the counter-factual model for estimation and is the first step pf the pscfit.R process. The output is a complete-case dataset where the data names match the variables used in the CFM.
## S3 method for class 'glm' dataComb(CFM, DC, id = NULL, trt = NULL)
## S3 method for class 'glm' dataComb(CFM, DC, id = NULL, trt = NULL)
CFM |
a model object supplied to pscfit |
DC |
a dataset including covariates to match the CFM |
id |
to specify which observations in the data cohort should be evaluated. Defualts to 'NULL' i.e all observations |
trt |
used to specify multiple treatment effects. Defaults to NULL |
a list containing objects which specifiy the required exported components of the model and a cleaned data cohort. Attirbutes of the 'cleaned' object include: Attributes include
'model.type' specifying the class of model to be used as the CFM
'model_extract' sepcifying the model componets required for estimation
'cov' a cleaned dataset of covariates
'outcome' a cleaned dataset containing the outcomes
A function which provides basic summaries of data provided within a data frame of covariets. Summaries are in the form of frequencies of counts and associated percentages for categorical data and median (IQR) for continuous data. Intended for use with the pscCFM.R function to define the setting in which a model has been generated
dataSumm(x)
dataSumm(x)
x |
a matrix of covariates |
Categorical/Character data are summarised by a table and Continuous data are summarised as median (IQR)
A generic function for estimating the initial parameters for estimation as part of the pscfti.R function. Parameter estimates are obtained using standard optomisation methods provided by the 'optim' set of functions. For a single parameter a Brent method is applied. For mutliple treatment comparisons the 'BFGS' method is applied.
initParm(CFM, DC_clean, trt)
initParm(CFM, DC_clean, trt)
CFM |
A counter-factual model |
DC_clean |
a cleaned dataset obsect obtained using dataComb.flexsurvreg |
trt |
An optional additional vector denoting treatment allocations for multiple treatment comparisons. Defaults to 'NULL' |
This function takes the liklihood for a 'flexsurvreg' model and uses 'optim' to fit the likelihood.
an 'optim' output giving the parameter values to be supplied as a starting value for the mcmc routine.
Fucntion for estimating initial parameter values 'flexsurvreg'
## S3 method for class 'flexsurvreg' initParm(CFM, DC_clean, trt = NULL)
## S3 method for class 'flexsurvreg' initParm(CFM, DC_clean, trt = NULL)
CFM |
A counter-factual model |
DC_clean |
a cleaned dataset obsect obtained using dataComb.flexsurvreg |
trt |
An optional additional vector denoting treatment allocations for multiple treatment comparisons. Defaults to 'NULL' |
This function takes the liklihood for a 'flexsurvreg' model and uses 'optim' to fit the likelihood.
an 'optim' output giving the parameter values to be supplied as a starting value for the mcmc routine.
Fucntion for estimating initial parameter values 'flexsurvreg'
## S3 method for class 'glm' initParm(CFM, DC_clean, trt = trt)
## S3 method for class 'glm' initParm(CFM, DC_clean, trt = trt)
CFM |
A counter-factual model |
DC_clean |
a cleaned dataset obsect obtained using dataComb.flexsurvreg |
trt |
An optional additional vector denoting treatment allocations for multiple treatment comparisons. Defaults to 'NULL' |
This function takes the liklihood for a 'flexsurvreg' model and uses 'optim' to fit the likelihood.
an 'optim' output giving the parameter values to be supplied as a starting value for the mcmc routine.
A function which defines the likelihood for a PSC model where the Counter
Factual Model (CFM) takes the form of a 'flexsurvreg' object and an efficacy
parameter () is being estimated. For more details on fitting please see
?pscfit and ?pscEst
lik.flexsurvreg(beta, DC_clean)
lik.flexsurvreg(beta, DC_clean)
beta |
a parameter to be estimate |
DC_clean |
a cleaned dataset including covariates to match the CFM |
A likelihood function for use by pscfit for a model of class 'flexsurvreg'
A function which defines the likelihood for a PSC model where the Counter
Factual Model (CFM) takes the form of a 'flexsurvreg' object and a mulitple efficacy
parameters () is being estimated. For more details on fitting please see
?pscfit and ?pscEst
lik.flexsurvreg.mtc(beta, DC_clean)
lik.flexsurvreg.mtc(beta, DC_clean)
beta |
a parameter to be estimate |
DC_clean |
a cleaned dataset including covariates to match the CFM |
A likelihood function for use by pscfit for a model of class 'flexsurvreg' where multiple treatment comparisons are required
A function which defines the likelihood for a PSC model where the Counter
Factual Model (CFM) takes the form of a 'glm' object and an efficacy
parameter () is being estimated. For more details on fitting please see
?pscfit and ?pscEst
lik.glm(beta, DC_clean)
lik.glm(beta, DC_clean)
beta |
a parameter to be estimate |
DC_clean |
a cleaned dataset including covariates to match the CFM |
A likelihood function for use by pscfit for a model of class 'glm'
A function which defines the likelihood for a PSC model where the Counter
Factual Model (CFM) takes the form of a 'glm' object and a mulitple efficacy
parameters () is being estimated. For more details on fitting please see
?pscfit and ?pscEst
lik.glm.mtc(beta, DC_clean)
lik.glm.mtc(beta, DC_clean)
beta |
a parameter to be estimate |
DC_clean |
a cleaned dataset including covariates to match the CFM |
A likelihood function for use by pscfit for a model of class 'flexsurvreg' where multiple treatment comparisons are required
A function which created a linear predictor from a model and an external dataset. If required, linear predictors will be provided on the response scale. For a survival outcome, this will take the form of median survival estimates.
linPred(DC_clean, resp = FALSE)
linPred(DC_clean, resp = FALSE)
DC_clean |
a cleaned data obhject created using dataComb() |
resp |
detailing whether the linear predictor shoudl be returned on the natural or response level. Defaults to the natural scale (resp=F) |
A function which combines the data from the data cohort against the model parameters of the PSC
Extracts the linear predictor from a object containing both a counter factual model and a data cohort which is created using the dataComb() fucntion.
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data) lp <- linPred(dc)
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data) lp <- linPred(dc)
A generic function for extracting model information
modelExtract(CFM)
modelExtract(CFM)
CFM |
a model of class either 'glm' or 'flexsurvreg' |
A function for extracting the model information required for using pscfit
a list of extracted model components
This function extracts model information for use with the pscfit.R function.
## S3 method for class 'flexsurvreg' modelExtract(CFM)
## S3 method for class 'flexsurvreg' modelExtract(CFM)
CFM |
a model of class 'flexsurvreg' |
A function for extracting the model information required for using pscfit
a list of extracted model components. Included are
model.frame a dataset of the covareits used to create the model
cov_co: covariate coefficients
sig: variance-covariance matrix
haz_co: hazard parameter coefficients
k: number of knots
knots: knot position
lam: lambda parameter
form: model formula
A generic function for extracting model information
## S3 method for class 'glm' modelExtract(CFM)
## S3 method for class 'glm' modelExtract(CFM)
CFM |
a model of class 'glm' |
A function for extracting the model information required for using pscfit
a list of extracted model components. Included are
model.frame a dataset of the covareits used to create the model
cov_co: covariate coefficients
sig: variance-covariance matrix
form: model formula
family: model family
out.nm: outcome covariates names
A function which rrturns either the input value (if positive) or zero (if negative)
modp(x)
modp(x)
x |
a numberic vector |
A fucntion which returns a version of x with negative values replacd with 0
a numeric vector with negative values replaced with 0
A function which plots a patients response against their predicted response from a CFM. Exact form of the output will depend on the form of the model supplied
plot_ite(x)
plot_ite(x)
x |
an object of class 'psc' |
This function plots the expected response of the control treatment along with the observe response rates for each patient in the dataset
A plot showing the individual treatment effects
library(psc) library(survival) bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot_ite(bin.psc)
library(psc) library(survival) bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot_ite(bin.psc)
A function which plots a patients response against their predicted response from a CFM
plot_ite.flexsurvreg(x)
plot_ite.flexsurvreg(x)
x |
an object of class 'psc' |
This function plots the expected response of the control treatment along with the observe response rates for each patient in the dataset
A plot showing the individual treatment effects
library(psc) library(survival) surv.mod <- psc::surv.mod data <- psc::data surv.psc <- pscfit(surv.mod,data) plot_ite(surv.psc)
library(psc) library(survival) surv.mod <- psc::surv.mod data <- psc::data surv.psc <- pscfit(surv.mod,data) plot_ite(surv.psc)
A function which plots a patients response against their predicted response from a CFM. Exact form of the output will depend on the form of the glm
plot_ite.glm(x)
plot_ite.glm(x)
x |
an object of class 'psc' |
This function plots the expected response of the control treatment along with the observe response rates for each patient in the dataset
A plot showing the individual treatment effects
library(psc) library(survival) bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot_ite(bin.psc)
library(psc) library(survival) bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot_ite(bin.psc)
A function which illsutrates the predicted response under the Counter Factual Model (CFM) and the observed response under the experimental treatment(s). Form of the output will depend on the form of the CFM used
## S3 method for class 'psc' plot(x, ...)
## S3 method for class 'psc' plot(x, ...)
x |
an object of class 'psc' |
... |
not used |
This function plots the expected response of the control treatment along with the observe response rates of the experimental arms
a survival plot corresponding to the psc fit
bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot(bin.psc)
bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot(bin.psc)
A function which illsutrates the predicted response under the counter factual model and the observed response under the experimental treatment(s).
## S3 method for class 'psc.binary' plot(x, ...)
## S3 method for class 'psc.binary' plot(x, ...)
x |
an object of class 'psc' |
... |
not used |
This function plots the expected response of the control treatment along with the observe response rates of the experimental arms
a survival plot corresponding to the psc fit
bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot(bin.psc)
bin.mod <- psc::bin.mod data <- psc::data bin.psc <- pscfit(bin.mod,data) plot(bin.psc)
A function which illsutrates the predicted response under the counter factual model and the observed response under the experimental treatment(s).
## S3 method for class 'psc.cont' plot(x, ...)
## S3 method for class 'psc.cont' plot(x, ...)
x |
an object of class 'psc' |
... |
not used |
This function plots the expected response of the control treatment along with the observe response rates of the experimental arms
a survival plot corresponding to the psc fit
cont.mod <- psc::cont.mod data <- psc::data cont.psc <- pscfit(cont.mod,data) plot(cont.psc)
cont.mod <- psc::cont.mod data <- psc::data cont.psc <- pscfit(cont.mod,data) plot(cont.psc)
Function for Plotting PSC objects #' A function which illsutrates the predicted response under the counter factual model and the observed response under the experimental treatment(s).
## S3 method for class 'psc.count' plot(x, ...)
## S3 method for class 'psc.count' plot(x, ...)
x |
an object of class 'psc' |
... |
not used |
This function plots the expected response of the control treatment along with the observe response rates of the experimental arms
a survival plot corresponding to the psc fit
count.mod <- psc::count.mod data <- psc::data count.psc <- pscfit(count.mod,data) plot(count.psc)
count.mod <- psc::count.mod data <- psc::data count.psc <- pscfit(count.mod,data) plot(count.psc)
Function for Plotting PSC objects
## S3 method for class 'psc.flexsurvreg' plot(x, ...)
## S3 method for class 'psc.flexsurvreg' plot(x, ...)
x |
an object of class 'psc' |
... |
not used |
making use of 'ggsurvplot' in the survminer package, this function plots the expected survival funtion for the 'control' treatment estimated from the CFM along with the Kaplan Meier estimates of the observed events
a survival plot corresponding to the psc fit
Personalised Synthetic Controls - print
## S3 method for class 'psc' print(x, ...)
## S3 method for class 'psc' print(x, ...)
x |
an object of class 'psc' |
... |
not used |
printing psc results
psc
objectAn object returned by the pscfit
function, inheriting from class
psc
and representing a fitted personlised synthetic control model.
psc.object
psc.object
An object of class NULL
of length 0.
Richard Jasckson ([email protected])
This function creates and object containaing all information relating to a model which may be used for counter-factual inference. This includes the model parameters, the intended setting for it's, details of validation and references for further details.
pscCFM(cfm, covnm = NULL, setting = NULL, valid = NULL, citation = NULL)
pscCFM(cfm, covnm = NULL, setting = NULL, valid = NULL, citation = NULL)
cfm |
a model object |
covnm |
an optinal character vector suppling covariate names to the terms included in the model |
setting |
and object from 'cfmSett' detailing the setting of the model. |
valid |
an object from cfmValid which details validation of the model |
citation |
a character giving a reference (if applicable), defaults to NULL (e.g no citation) |
Categorical/Character data are summarised by a table and Continuous data are summarised as median (IQR)
Function for performing estimation procedures in 'pscfit'
pscEst(CFM, DC_clean, nsim, start, trt)
pscEst(CFM, DC_clean, nsim, start, trt)
CFM |
a model object supplied to pscfit |
DC_clean |
a cleaned dataset ontained using dataComb(). |
nsim |
the number of MCMC simulations to run |
start |
the stating value for |
trt |
an optional vector denoting treatment allocations where mulitple treatment comparisons are bieng made |
Define the set of model parameters to contain
which summarize
the parameters of the CFM. Prior distributions are defined for B using a
multivariate normal distribution
where
is the vector of coefficient estimates from the validated model and
is the variance-covariance matrix. This information is taken directly from the
outputs of the parametric model and no further elicitation is required.
The prior distirbution for the efficacy parameter (
) is set
as an uniformative
.
Ultimately the aim is to estimate the posterior distribution for conditional
on the distribution of B and the observed data. A full form for the posterior
distribution is then given as
Please see 'pscfit' for more details on liklihood formation.
For each iteration of the MCMC procedure, the following algorithm is performed
Set and indicator s=1, and define an initial state based on prior
hyperparameters for and
such that
Update and draw model parameters
from
and an draw a
proposal estimate of
from some target distribution
Estimate where
is the subset of parameters from
which relate to the model covariates and define 2 new likelihood functions
&
Draw a single value from a Uniform (0,1) distribution and estimate
the condition
. If
then accept
as belonging
to the posterior distribution
otherwise retain
Repeat steps 2 – 4 for the required number of iterations
The result of the algorithm is a posterior distribution for the log hazard ratio,
, captures the variability in B through the defined priors
.
A matrix containing the draws form the posterior distribution
A function which performs the Bayesian MCMC estimation procedure for
estimating the efficacy parameter () using personalised sunthetic
controls methodology.
## S3 method for class 'flexsurvreg' pscEst(CFM, DC_clean, nsim, start, trt = trt)
## S3 method for class 'flexsurvreg' pscEst(CFM, DC_clean, nsim, start, trt = trt)
CFM |
a model object supplied to pscfit |
DC_clean |
a cleaned dataset ontained using dataComb(). |
nsim |
the number of MCMC simulations to run |
start |
the stating value for |
trt |
an optional vector denoting treatment allocations where multiple treatment comparisons are being made |
An MCMC routine for fitting a psc model
A matrix containing the draws form the posterior distribution
A function which performs the Bayesian MCMC estimation procedure for
estimating the efficacy parameter () using personalised sunthetic
controls methodology.
## S3 method for class 'glm' pscEst(CFM, DC_clean, nsim, start, trt = trt)
## S3 method for class 'glm' pscEst(CFM, DC_clean, nsim, start, trt = trt)
CFM |
a model object supplied to pscfit |
DC_clean |
a cleaned dataset ontained using dataComb(). |
nsim |
the number of MCMC simulations to run |
start |
the stating value for |
trt |
an optional vector denoting treatment allocations where multiple treatment comparisons are being made |
An MCMC routine for fitting a psc model
a matrix containing the draws form the posterior distribution
Function which allows comparison of a data cohort against a parametric Counter Factual Model (CFM). The function allows models of the type 'flexsurvreg' and 'glm' to be supplied. The function performs by calculating the linear predictor as a combination of the CFM and the dataset supplied and then selects a likelihood based on the type of model specified. Likelihood is estimated using a Baysian MCMC procedure wherebey the parameters of the CFM acts as informative priors.
pscfit(CFM, DC, nsim = 5000, id = NULL, trt = NULL)
pscfit(CFM, DC, nsim = 5000, id = NULL, trt = NULL)
CFM |
An R model object of class 'glm' or 'flexsurvspline' |
DC |
A dataset including columns to match to covariates in the model |
nsim |
The number of simulations for the MCMC routine |
id |
Numeric vector stating which patient(s) from the dataset should be included in the analysis. Defaults to all patients |
trt |
An optional vector denoting treatment allocations for multiple treatment comparisons. Defaults to NULL. |
Model currently supports estimation of more than one treatment (using the 'trt') option and esitmation restricted to sub-groups of the data cohort (using the 'id' option.
the pscfit
function compares a dataset ('DC') against a parametric model.
This is done by selecting a likelihood which is identified by the type of CFM that is supplied.
At present, two types of model are supported, a flexible parmaeteric survival model of type 'flexsurvreg'
and a geleneralised linear model of type 'glm'.
Where the CFM is of type 'flexsurvreg' the likeihood supplied is of the form:
Where defines the cumulative baseline hazard function,
is the linear predictor and
and
are the
event time and indicator variables.
Where the CFM is of the type 'glm' the likelihood supplied is of the form:
Where ,
and
represent the functions of the
exponential family. In both cases,
is defined as:
Where are the model coefficients supplied by the CFM and
is the parameter set to measure the difference between the CFM and the DC.
Estimation is performed using a Bayesian MCMC procedure. Prior distributions
for (&
) are derived directly from the model
coefficients (mean and variance covariance matrix) or the CFM. A bespoke MCMC
routine is performed to estimate
. Please see '?mcmc' for more detials.
For the standard example where the DC contains information from only a single treatment, trt need not be specified. Where comparisons between the CFM and multiple treatments are require, a covariate of treamtne allocations must be specified sperately (using the 'trt' option).
a object of class 'psc' with attributes model.type, the cleaned Dataset and the posterior distribution of the fitted model
Attributes include
A 'cleaned' dataset including extracted components of the CFM and the cleaned DC included in the procedure
An object defining the class of model (and therefore the procedure applied - see above)
A matrix containing the draws of the posterior distributions
library(psc) library(survival) data("surv.mod") data("data") surv.psc <- pscfit(surv.mod,data)
library(psc) library(survival) data("surv.mod") data("data") surv.psc <- pscfit(surv.mod,data)
A function which provides a summary of a DC_clean object. To be used either in conjunction with dataComb.R or summary.psc.R
pscSumm(DC_clean)
pscSumm(DC_clean)
DC_clean |
a cleaned dataset ontained using dataComb(). |
psc summary results including an estimate of the linear predictor combing the data and the model, an estimate of patient level response and summary statistics of the average responses for the sythenthic and observed populations
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data) pscSumm(dc)
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data) pscSumm(dc)
A generic function to provide a summary of a 'psc' object obtained from pscfit.R
## S3 method for class 'psc' summary(object, ...)
## S3 method for class 'psc' summary(object, ...)
object |
an object of class 'psc' |
... |
not used |
A summary of a psc object obtained using pscSumm and a copy of the pscfit object
library(psc) library(survival) data("surv.mod") data("data") psc.ob <- pscfit(surv.mod,data) summary(psc.ob)
library(psc) library(survival) data("surv.mod") data("data") psc.ob <- pscfit(surv.mod,data) summary(psc.ob)
This function provides basic survival estimates from a flexible parametric survival model
surv_fpm(DC_clean, beta = 0, s = NULL)
surv_fpm(DC_clean, beta = 0, s = NULL)
DC_clean |
a cleaned dataset ontained using dataComb(). |
beta |
a parameter to determine if the survival probabilities should be adjusted by some (log) hazard ratio. Defaults to beta=0, i.e. no adjustment. |
s |
if specified will return the time at which some threshold is passed (e.g. s=0.5 for median survival time) |
A fucntion which extracts survival probabilities from a flexsurvreg object
a list of times and assoicated survival probabilities
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data) s_est <- surv_fpm(dc)
library(psc) library(survival) data("surv.mod") data("data") dc <- dataComb(surv.mod,data) s_est <- surv_fpm(dc)
A generated model with a survival endpoint and a cuymulative hazard function estimated using flexible parametric splines. Data for the model were synthetically generated and are based on a dataset to evaulate the use of Sorafenib in HCC akin to the PROSASH model
surv.mod
surv.mod
A model of class 'flezsurvreg':
cumulative baseline hazard parameters
vascular invasion
patient age (centred at 60)
ECOG performance Status
AFP - log scale
albumin
Creatinine - log scale
metastesis
centred age nested within vascular invasion
survival time
censoring indicator
survival time
exapmple outcome for count data
exapmple identifier for mulitple treatment comparisons
Aetiology
simulated
Using prognostic and predictive clinical features to make personalised survival prediction in advanced hepatocellular carcinoma patients undergoing sorafenib treatment. Berhane S, et al., Br J Cancer. 2019 Jul;121(2):117-124