Description Usage Arguments Value Author(s) Examples
View source: R/get.pseudodata.cox.R
For Cox's regression model, given the current estimates of regression coefficients, working responses and their corresponding weights are obtained.
1 | get.pseudodata.cox(Y, X, event, beta, time, ntime, sumevent)
|
Y |
an (n*1) numeric matrix of time response. |
X |
an (n*p) numeric design matrix. |
event |
an (n*1) numeric matrix of status: of status indicator: |
beta |
a (p*1) matrix of regression coefficients. |
time |
a vector or sorted value of |
ntime |
length of the vector |
sumevent |
a vector of size |
Return a list including elements
z |
an (n*1) matrix of working responses |
sigma2 |
an (n*1) matrix of inverse of weights. |
Vitara Pungpapong, Min Zhang, Dabao Zhang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | data(simCox)
Y<-as.matrix(simCox[,1])
event<-as.matrix(simCox[,2])
X<-as.matrix(simCox[,-(1:2)])
time<-sort(unique(Y))
ntime<-length(time)
# sum of event_i where y_i =time_k
sumevent<-rep(0, ntime)
for(j in 1:ntime)
{
sumevent[j]<-sum(event[Y[,1]==time[j]])
}
# Obtain initial values from lasso
data(initbetaCox)
initbeta<-as.matrix(initbetaCox)
# Get Pseudodata
pseudodata<-get.pseudodata.cox(Y, X, event, initbeta, time, ntime, sumevent)
z<-pseudodata$z
sigma<-sqrt(pseudodata$sigma2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.