\HeaderA{survexp.fit}{Work Function to Compute Expected Survival}{survexp.fit}
\keyword{survival}{survexp.fit}
\begin{Description}\relax
Compute expected survival. This function is not to be called by the user.
\end{Description}
\begin{Usage}
\begin{verbatim}
survexp.fit(x, y, times, death, ratetable)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a matrix. The first column contains the group,
an integer value that divides the subjects into subsets.
Remaining columns must match the dimensions of the \code{ratetable},
in the correct order.

\item[\code{y}] the follow up time for each subject.

\item[\code{times}] the vector of times at which a result will be computed.

\item[\code{death}] death indicator
\item[\code{ratetable}] a rate table, such as \code{survexp.uswhite}.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For cohort survival it must be the potential censoring time for
each subject, ignoring death.


For an exact estimate \code{times} should be a superset of \code{y}, so that each
subject at risk is at risk for the entire sub-interval of time.
For a large data set, however, this can use an inordinate amount of
storage and/or compute time.  If the \code{times} spacing is more coarse than
this, an actuarial approximation is used which should, however, be extremely
accurate as long as all of the returned values are > .99.


For a subgroup of size 1 and \code{times} > \code{y},
the conditional method reduces to exp(-h) where
h is the expected cumulative hazard for the subject over his/her
observation time.  This is used to compute individual expected survival.
\end{Details}
\begin{Value}
A list containing the number of subjects and the expected survival(s)
at each time point.
If there are multiple groups, these will be
matrices with one column per group.
\end{Value}
\begin{Section}{WARNING}
Most users will call the higher level routine \code{survexp}.
Consequently, this function has very few error checks on its input arguments.
\end{Section}
\begin{SeeAlso}\relax
\code{\LinkA{survexp}{survexp}}, \code{\LinkA{survexp.us}{survexp.us}}
\end{SeeAlso}


