# The "CancerModel" Class

### Description

A `CancerModel`

object contains a number of pieces of information
representing an abstract, heterogeneous collection of cancer patients.
It can be used to simulate patient outcome data linked to hit classes.

### Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
CancerModel(name,
nPossible,
nPattern,
HIT = function(n) 5,
SURV = function(n) rnorm(n, 0, 2),
OUT = function(n) rnorm(n, 0, 2),
survivalModel=NULL,
prevalence=NULL)
nPatterns(object)
nPossibleHits(object)
nHitsPerPattern(object)
outcomeCoefficients(object)
survivalCoefficients(object)
## S4 method for signature 'CancerModel'
ncol(x)
## S4 method for signature 'CancerModel'
nrow(x)
## S4 method for signature 'CancerModel'
rand(object, n, balance=FALSE, ...)
## S4 method for signature 'CancerModel'
summary(object, ...)
``` |

### Arguments

`name` |
character string specifying name given to this model |

`object, x` |
object of class |

`nPossible` |
integer scalar specifying number of potential hits relevant to the kind of cancer being modeled |

`nPattern` |
integer scalar specifying number of different cancer subtypes |

`HIT` |
function that generates non-negative integers from a discrete distribution. Used to determine the number of hits actually present in each cancer subtype. |

`SURV` |
function that generates real numbers from a continuous distributions. Used in simulations to select the coefficients associated with each hit in Cox proportional hazards models. |

`OUT` |
function that generates real numbers from a continuous distributions. Used in simulations to select the coefficients associated with each hit in logistic models of a binary outcome. |

`survivalModel` |
object of class |

`prevalence` |
optional numeric vector of relative prevalences of cancer subtypes |

`n` |
numeric scalar specifying quantity of random numbers |

`balance` |
logical scalar specifying how patients should be simulated |

`...` |
extra arguments for generic routines |

### Details

The `rand`

method is the most important method for objects of this
class. It returns a data frame with four columns: the
`CancerSubType`

(as an integer that indexes into the
`hitPattern`

slot of the object), a binary `Outcome`

that
takes on values `"Bad"`

or `"Good"`

, an `LFU`

column
with censored survival times, and a logical `Event`

column that
describes whether the simulated survival event has occurred.

The `rand`

method for the `CancerModel`

class adds an extra
logical parameter, `balanced`

, to the signature specified by the
default method. If `balanced=FALSE`

(the default), then
patients are simulated based on the `prevalence`

defined as apart
of the model. If `balanced=TRUE`

, then patients are simulated
with equal numbers in each hit pattern class, ordered by the hit
pattern class.

### Value

The `CancerModel`

function is used to contruct and return an object of
the `CancerModel`

class.

The `ncol`

and `nrow`

functions return integers with the size of
the matrix of hit patterns.

The `rand`

method returns data frame with four columns:

`CancerSubType` | integer index into object's 'hitPattern' slot |

`Outcome` | outcomes with values "Bad" or "Good" |

`LFU` | censored survival times |

`Event` | has simulated survival event has occurred? |

### Objects from the Class

Although objects of the class can be created by a direct call to
new, the preferred method is to use the
`CancerModel`

generator function.

### Slots

`name`

:Object of class

`"character"`

`hitPattern`

:Object of class

`"matrix"`

`survivalBeta`

:Object of class

`"numeric"`

containing the coeffieicents associated with each hit in a Cox proportional hazards model of survival.`outcomeBeta`

:Object of class

`"numeric"`

contaning the coefficients associated with each hit in a logistic model to predict a binary outcome.`prevalence`

:Object of class

`"numeric"`

containing the prevalence of each cancer subtype.`survivalModel`

:Object of class

`"survivalModel"`

containing parameters used to simualte survival times.`call`

:object of class

`"call"`

recording the function call used to initialize the object.

### Methods

- ncol
`signature(x = "CancerModel")`

: ...- nrow
`signature(x = "CancerModel")`

: ...- rand
`signature(object = "CancerModel")`

: ...- summary
`signature(object = "CancerModel")`

: ...

### Author(s)

Kevin R. Coombes krc@silicovore.com, P. Roebuck proebuck@mdanderson.org

### References

OOMPA

### See Also

`SurvivalModel`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
showClass("CancerModel")
set.seed(391629)
# set up survival outcome; baseline is exponential
sm <- SurvivalModel(baseHazard=1/5, accrual=5, followUp=1)
# now build a CancerModel with 6 subtypes
cm <- CancerModel(name="cansim",
nPossible=20,
nPattern=6,
OUT = function(n) rnorm(n, 0, 1),
SURV= function(n) rnorm(n, 0, 1),
survivalModel=sm)
# simulate 100 patients
clinical <- rand(cm, 100)
summary(clinical)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.