public class CoxR extends Object
In R you can pass in different paramaters to override defaults which requires parsing of the paramaters. In the Java code tried to be a little more exact in the code related to paramaters where using strata, weighting, robust and cluster are advance options. Additionaly code is implemented from Bob Gray to do variance correction when using weighted paramaters in a data set. /Users/Scooter/NetBeansProjects/biojava3-survival/docs/wtexamples.docx
The CoxHelper class is meant to hide some of the implementation details.
Issues
the input parameters are
maxiter :number of iterations
time(n) :time of status or censoring for person i
status(n) :status for the ith person 1=dead , 0=censored
covar(nv,n) :covariates for person i.
Note that S sends this in column major order.
strata(n) :marks the strata. Will be 1 if this person is the
last one in a strata. If there are no strata, the
vector can be identically zero, since the nth person's
value is always assumed to be = to 1.
offset(n) :offset for the linear predictor
weights(n) :case weights
init :initial estimate for the coefficients
eps :tolerance for convergence. Iteration continues until
the percent change in loglikelihood is <= eps.
chol_tol : tolerance for the Cholesky decompostion
method : 0=Breslow, 1=Efron
doscale : 0=don't scale the X matrix, 1=scale the X matrix
returned parameters
means(nv) : vector of column means of X
beta(nv) :the vector of answers (at start contains initial est)
u(nv) :score vector
imat(nv,nv) :the variance matrix at beta=final
(returned as a vector)
loglik(2) :loglik at beta=initial values, at beta=final
sctest :the score test at beta=initial
flag :success flag 1000 did not converge
1 to nvar: rank of the solution
iterations :actual number of iterations used
work arrays
mark(n)
wtave(n)
a(nvar), a2(nvar)
cmat(nvar,nvar) ragged array
cmat2(nvar,nvar)
newbeta(nvar) always contains the "next iteration"
calls functions: cholesky2, chsolve2, chinv2
the data must be sorted by ascending time within strata
| Constructor and Description |
|---|
CoxR() |
| Modifier and Type | Method and Description |
|---|---|
static void |
calculateWaldTestInfo(CoxInfo ci) |
void |
coxphfitSCleanup(CoxInfo ci,
boolean useWeighted,
boolean robust,
ArrayList<String> cluster) |
double |
coxsafe(double x) |
static void |
main(String[] args) |
CoxInfo |
process(ArrayList<String> variables,
ArrayList<SurvivalInfo> DataT,
boolean useStrata,
boolean useWeighted,
boolean robust,
boolean cluster) |
CoxInfo |
process(ArrayList<String> variables,
ArrayList<SurvivalInfo> data,
int maxiter,
CoxMethod method,
double eps,
double toler,
double[] beta,
int doscale,
boolean useStrata,
boolean useWeighted,
boolean robust,
boolean cluster) |
public CoxR()
public CoxInfo process(ArrayList<String> variables, ArrayList<SurvivalInfo> DataT, boolean useStrata, boolean useWeighted, boolean robust, boolean cluster) throws Exception
variables - DataT - useStrata - useWeighted - robust - cluster - Exceptionpublic CoxInfo process(ArrayList<String> variables, ArrayList<SurvivalInfo> data, int maxiter, CoxMethod method, double eps, double toler, double[] beta, int doscale, boolean useStrata, boolean useWeighted, boolean robust, boolean cluster) throws Exception
variables - data - maxiter - method - eps - toler - beta - doscale - useStrata - useWeighted - robust - cluster - Exceptionpublic void coxphfitSCleanup(CoxInfo ci, boolean useWeighted, boolean robust, ArrayList<String> cluster) throws Exception
ci - useWeighted - robust - cluster - Exceptionpublic static void calculateWaldTestInfo(CoxInfo ci)
public double coxsafe(double x)
x - Copyright © 2000–2017 BioJava. All rights reserved.