Version: | 1.1.5 |
Author: | R. Gentleman |
Title: | A Set of Methods for Longitudinal Data Objects |
Description: | A very simple implementation of a class for longitudinal data. |
Depends: | R(≥ 1.2) |
Imports: | graphics, stats |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Maintainer: | Arthur Allignol <arthur.allignol@gmail.com> |
NeedsCompilation: | no |
Packaged: | 2017-09-18 19:49:54 UTC; arthur |
Repository: | CRAN |
Date/Publication: | 2017-09-19 16:18:13 UTC |
Longitudinal Class
Description
as.lgtdl
coerces its argument to class lgtdl
if possible.
is.lgtdl
returns TRUE
if its argument is of class
lgtdl
and FALSE
otherwise.
Usage
as.lgtdl(x, row.names=NULL)
is.lgtdl(x)
Arguments
x |
An object which is coerced to a |
row.names |
An optional set of row names to be used for the names
of the covariates in the resulting |
Value
is.lgtdl |
Returns |
as.lgtdl |
Returns an object of class |
Author(s)
Robert Gentleman
See Also
Examples
x1<-data.frame(time=c(1,3,5), cov=c(4,6,8))
x2<-data.frame(time=c(11,13,15), interest=c(66,45,88))
x1<-as.lgtdl(x1)
x2<-as.lgtdl(x2)
is.lgtdl(TRUE)
A function to extract the covariate from an object of class lgtdl.
Description
The covariate component of the lgtdl
object is returned.
Usage
getcov(x, ...)
## S3 method for class 'lgtdl'
getcov(x, cov, ...)
Arguments
x |
The |
cov |
The name of the covariate to be extracted. |
... |
Ignored, there for potential future use. |
Value
The covariate, as either a matrix or vector, is returned.
Author(s)
Robert Gentleman
See Also
Examples
x1<-data.frame(time=c(1,3,5), cov=c(4,6,8))
x2<-data.frame(time=c(11,13,15), interest=c(66,45,88))
x1<-as.lgtdl(x1)
x2<-as.lgtdl(x2)
getcov(x1)
getcov(x2)
A function to provide estimates of the response for a longitudinal data object. The estimate is obtained by linear interpolation from the preceding and following observations.
Description
A linear interpolation, using approx
, is used to obtain
estimates of the covariate at times other than those observed.
Usage
interplinear(x, ...)
## S3 method for class 'lgtdl'
interplinear(x, time, cov = NULL, ...)
## S3 method for class 'AsIs'
interplinear(x, ...)
Arguments
x |
The |
time |
The time(s) at which interpolation is desired. |
cov |
The name of the covariate in the |
... |
Ignored. |
Value
A vector containing the interpolated estimates of the covariate values at the requested times.
Author(s)
Robert Gentleman
See Also
Examples
x1<-data.frame(time=c(1,3,5), cov=c(4,6,8))
x2<-data.frame(time=c(11,13,15), interest=c(66,45,88))
x1<-as.lgtdl(x1)
x2<-as.lgtdl(x2)
interpprev(x1, 4)
interpprev(x2, c(12, 14))
Interpolation Using the Previous Value
Description
These functions provide an interpolation mechanism for objects of
class lgtdl
. The AsIs
method is the vectorized version.
Usage
interpprev(x, ...)
## S3 method for class 'lgtdl'
interpprev(x, time, cov, ...)
## S3 method for class 'AsIs'
interpprev(x, ...)
Arguments
x |
|
time |
A vector of times at which interpolation is requested. |
cov |
The name of the covariate on which interpolation is
requested. It is only required if |
... |
Ignored. |
Details
If objects of class lgtdl
are inserted into a data frame they
become a vector with class AsIs
. In order to operate on these
we provide a method for that class. The method is simply a vectorized
version.
Value
interpprev.lgtdl
returns a numeric vector of the interpolated
values of the covariate at the time(s) specified by time
.
interpprev.AsIs
returns a vector of interpolated values of the
covariate. In this case the vector contains one value for each element
x
. time
must be either the same length as x
or
of length one. In the latter case all interpolations are done at that
time.
Author(s)
Robert Gentleman
See Also
Examples
x1<-data.frame(time=c(1,3,5), cov=c(4,6,8))
x2<-data.frame(time=c(11,13,15), interest=c(66,45,88))
x1<-as.lgtdl(x1)
x2<-as.lgtdl(x2)
interpprev(x1, c(2,4))
interpprev(x2, c(12, 14))
Longitudinal Class
Description
The lgtdl
class is a simple class of R/S objects that make it
simpler to manipulate longitudinal data.
Author(s)
Robert Gentleman
References
Gentleman Robert (2001). Modeling with Objects. Proceedings of the 2nd International Workshop on Distributed Statistical Computing. http://r-project.org/nosvn/conferences/DSC-2001/Proceedings/Gentleman.pdf
A function for plotting lgtdl objects.
Description
A lgtdly object consists of a time component and one or more covariates measured or observed at the times specified in the time component. This function plots the covariate trajectories as lines on the y axis.
Usage
## S3 method for class 'lgtdl'
plot(x, ...)
Arguments
x |
An object of class |
... |
Optional arguments to control the plotting. |
Details
One should be able to specify values for any of the graphics parameters to change the appearance of the plot.
Value
No value is returned. A line plot of the longitudinal object is rendered on the active graphics device.
Author(s)
Robert Gentleman
See Also
Examples
x1<-data.frame(time=c(1,3,5), cov=c(4,6,8))
x2<-data.frame(time=c(11,13,15), interest=c(66,45,88))
x1<-as.lgtdl(x1)
x2<-as.lgtdl(x2)
plot(x1)
plot(x2)
Produce a character string suitable for printing.
Description
Data frames can contain lgtdl
objects as elements. When the data
frame is printed this function provides a suitable string for printing.
Usage
## S3 method for class 'lgtdl'
toString(x, width, ...)
Arguments
x |
The object to be formated. |
width |
To control the width of the returned string-ignored. |
... |
Ignored. |
Value
A character string. Currently it is "lgtdl, length = "
with the
length of the time
component added.
Author(s)
Robert Gentleman
See Also
toString