s-news
[Top] [All Lists]

Problem with matrix

To: S-News <s-news@lists.biostat.wustl.edu>
Subject: Problem with matrix
From: Tristan Lorino <tristan.lorino@lcpc.fr>
Date: Mon, 21 Jan 2008 11:17:43 +0100
Organization: LCPC
Reply-to: Tristan Lorino <tristan.lorino@lcpc.fr>
Hi,

In this example, I fit several Weibull survival models and I put the
numerical results (scale, intercept and coefficient) in a length(y)x4
matrix. But the output matrix A is character, so I can't make
calculations on the results!
I don't understand why A is non-numerical matrix. How can I get
numerical values?

> y_c("005","01","015","02","025","03","035","04","045","05","055","06","065","07","075","08","085")
> z2_outer("csgg",y,paste,sep="")
> A_matrix(NULL,ncol=4)

> for (i in 1:length(y))
> {
>         w2_get(z2[i])
>         w1_survReg(Surv(w2[,2],w2[,3], type="interval2")~w2$Granulo, 
> dist="weibull",na.action=na.exclude)
>         A_rbind(A,c(y[i],w1$scale,w1$coef[1],w1$coef[2]))
>         A
> }
> A
> dimnames(A)[[2]]_c("threshold","scale","intercept","coef")

> mean(A[,2])
[1] NA
Warning messages:
  mean of data of class "character" undefined, returning NA in: mean(A[, 2])

Thank you,
Tristan Lorino

  
-- 
Laboratoire Central des Ponts et Chaussées
[Division ESAR — Section AGR]
Route de Bouaye BP 4129
44341 Bouguenais Cedex
France
Tél 33 (0)2 40 84 56 18
Fax 33 (0)2 40 84 59 92


<Prev in Thread] Current Thread [Next in Thread>