Objects of class,
response, contain response values, and possibly
the corresponding times, binomial totals, nesting categories, censor
indicators, and/or units of precision/Jacobian. Objects of class,
tccov, contain time-constant or inter-individual, baseline
covariates. Objects of class,
tvcov, contain time-varying or
intra-individual covariates. Objects of class,
response object and possibly
In formula and functions, the key words,
times can be used to
refer to the response times from the data object as a covariate,
individuals to the index for individuals as a factor covariate,
nesting the index for nesting as a factor covariate. The
latter two only work for W&R notation.
The following methods are available for accessing the contents of such data objects.
as.data.frame: places all of the variables in the data object
in one dataframe, extending time-constant covariates to the length of
the others unless the object has class,
tccov. Binomial and
censored response variables have two columns, respectively ‘yes’ and
‘no’ and response and censoring indicator, with the name given to the
as.matrix: places all of the variables in the data object
in one matrix, extending time-constant covariates to the length of
the others unless the object has class,
tccov. If any
covariates are factor variables (instead of the corresponding sets of
indicator variables), the matrix will be character instead of numeric.
covariates: extracts covariate matrices from a data object (for
formulae and functions, possibly for selected individuals. See
covind: gives the indexing of the response by individual (that
is, the nesting indicator for observations within individuals). It can
be used to expand time-constant covariates to the size of the repeated
delta: extracts the units of measurement vector and Jacobian of
any transformation of the response, possibly for selected individuals.
Note that, if the unit of measurement/Jacobian is available in the
response object, this is automatically included in the
calculation of the likelihood function in all library model functions.
units: prints the variable names and their description
and returns the latter.
formula: gives the formula used to create the time-constant
covariate matrix of a data object (for formulae and functions, see
names: extracts the names of the response and/or covariates.
nesting: gives the coding variable(s) for individuals (same as
covind) and also for nesting within individuals if available,
possibly for selected individuals.
nobs: gives the number of observations per individual.
plot: plots the variables in the data object in various ways.
name can be a response or a
response: extracts the response vector, possibly for selected
individuals. If there are censored observations, this is a two-column
matrix, with the censor indicator in the second column. For binomial
data, it is a two-column matrix with "positive" (y) and "negative"
resptype: extracts the type of each response.
times: extracts the times vector, possibly for selected
transform: transforms variables. For example,
transform(z, y=fcn1(y), times=fcn2(times)) where
fcn2 are transformation functions. When the response is
transformed, the Jacobian is automatically calculated. New response
variables and covariates can be created in this way, if the left hand
side is a new name (
ynew=fcn3(y)), as well as replacing an old
variable with the transformed one. If the transformation reverses the
order of the responses, use its negative to keep the ordering and have
a positive Jacobian; for example,
objects, only the response and the times can be transformed.
units: prints the variable names and their units of measurement
and returns the latter.
weights: extracts the weight vector, possibly for selected
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
as.data.frame(x, ...) as.matrix(x, ...) covariates(z, ...) covind(z, ...) delta(z, ...) ## S3 method for class 'tccov' formula(x, ...) ## S3 method for class 'repeated' formula(x, ...) ## S3 method for class 'tccov' names(x, ...) ## S3 method for class 'repeated' names(x, ...) nesting(z, ...) nobs(z, ...) ## S3 method for class 'response' plot(x, name=NULL, nind=NULL, nest=1, ccov=NULL, add=FALSE, lty=NULL, pch=NULL, main=NULL, ylim=NULL, xlim=NULL, xlab=NULL, ylab=NULL, ...) ## S3 method for class 'repeated' plot(x, name=NULL, nind=NULL, nest=1, ccov=NULL, add=FALSE, lty=NULL, pch=NULL, main=NULL, ylim=NULL, xlim=NULL, xlab=NULL, ylab=NULL, ...) ## S3 method for class 'tccov' print(x, ...) ## S3 method for class 'repeated' print(x, nindmax=50, ...) response(z, ...) resptype(z, ...) times(z, ...) ## S3 method for class 'response' transform(`_data`, times=NULL, units=NULL, ...) ## S3 method for class 'repeated' transform(`_data`, times=NULL, ...) units(x, ...) weights(object, ...)
The function, when the times are to be transformed.
The names of the response variable(s) or covariate(s).
The numbers of individuals to be used. (For plotting,
cannot be used simultaneously with
For plotting: If a vector of values for the time-constant
covariates is supplied, only individuals having that set of values
will have profiles plotted. These values must be in the order in which
the covariates appear when the data object is printed. For factor
variables, the codes must be given. If the name of a covariate is
supplied, a set of graphs is plotted, one for each covariate value,
showing profiles of all individuals having that value. (The covariate
can have a maximum of six values.) Cannot be used simultaneously with
For plotting: nesting category to plot.
For plotting: add to previous plot.
For printing a
See base plot.
Arguments to other methods
These methods extract information stored in
repeated data objects created
Note that if a vector of binomial totals or a censoring indicator is
present, this is extract as the second column of the matrix produced
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 68 69 70 71 72 73 74 75 76
# set up some data and create the objects # y <- matrix(rnorm(20),ncol=5) tt <- c(1,3,6,10,15) print(resp <- restovec(y, times=tt, units="m", type="duration")) x <- c(0,0,1,1) x2 <- as.factor(c("a","b","a","b")) tcc <- tcctomat(data.frame(x=x,x2=x2)) z <- matrix(rpois(20,5),ncol=5) tvc <- tvctomat(z) print(reps <- rmna(resp, tvcov=tvc, ccov=tcc)) # plot(resp) plot(reps) plot(reps, nind=1:2) plot(reps, ccov=c(0,1)) plot(reps, ccov="x2") plot(reps, name="z", nind=3:4, pch=1:2) plot(reps, name="z", ccov="x2") # response(resp) response(transform(resp, y=1/y)) response(reps) response(reps, nind=2:3) response(transform(reps,y=1/y)) # times(resp) times(transform(resp,times=times-6)) times(reps) # delta(resp) delta(reps) delta(transform(reps,y=1/y)) delta(transform(reps,y=1/y), nind=3) # nobs(resp) nobs(tvc) nobs(reps) # units(resp) units(reps) # resptype(resp) resptype(reps) # weights(resp) weights(reps) # covariates(tcc) covariates(tcc, nind=2:3) covariates(tvc) covariates(tvc, nind=3) covariates(reps) covariates(reps, nind=3) covariates(reps,names="x") covariates(reps,names="z") # names(tcc) names(tvc) names(reps) # nesting(resp) nesting(reps) # # because individuals are the only nesting, this is the same as covind(resp) covind(reps) # as.data.frame(resp) as.data.frame(tcc) as.data.frame(tvc) as.data.frame(reps) # # use in glm rm(y,x,z) glm(y~x+z, data=as.data.frame(reps))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.