[S] using apply with a matrix

Fri, 20 Nov 1998 14:21:36 -0500

I am using S-PLUS version 4.5 with Windows 95. I would like to use the apply
function between two vectors, or equivalently, between two marices. I have two
matrices, A and B as follows:



I would like to consider A a matrix of lifetimes, and B a matrix of censoring
indicators (in this case no censoring). I would like to use the apply function
to take the first columns of A and B and use the function surv.fit on them, and
then repeat this for each column. I can then get out vectors of the
corresponding survival probabilities, times, etc for each column of A and B. I
would also like to apply my own likelihood function by columns as described

Does anyone know the proper syntax for using apply as above, especially for user
defined functions? Any help would be greatly appreciated.


Charlie Whitman

---------------------- Forwarded by Charles Whitman/Lex/Lexmark on 11/20/98
02:09 PM ---------------------------

Charles Whitman
07/24/98 09:28 AM

To: s-news@wubios.wustl.edu
Subject: Re: [S] MLE's with censored data

Perhaps I was a little informal in my use of terms. I have a data set of
lifetimes from a population. I would like to fit the lifetimes to a lognormal
distribution, and get MLE's of the parameters. When using the parametric
survival menu in the gui portion of S+, it seems to require two data sets. I am
not interested in comparing two populations. I only want distribution
parameters estimates for a single data set. Apparently, S+ will only plot the
data and give a report if I give it two data sets, not just one. In the report,
it is not clear where the MLE's for the two distributions are. I tried to
give it a dummy regression variable. That works for getting Kaplan-Meier
estimates, but does not work for parametric survival. It still gives me an
error. I have talked to technical support about this problem. They have been
able to duplicate it, but to date, have not been able to come up with an answer.
Also, they suggested I use s-news to see if anyone out there had a solution.
I would appreciate any input you can give me.

Thanks a lot,

Charlie Whitman

Prof Brian D Ripley <ripley%stats.ox.ac.uk@interlock.lexmark.com> on 07/23/98
05:40:13 PM

To: Charles Whitman@LEXMARK
Subject: Re: [S] MLE's with censored data

On Thu, 23 Jul 1998 whitman@lexmark.com wrote:

> I sent this note out a week ago, but have not gotten any response. Can
> anyone answer the question below?
> I am having a problem trying to get MLE's for a single population of life
> data with some censored observations. It seems the gui portion of S+ 4.5
> requires two populations to do any caluclations at all. After it has
> finished, it is not clear where the parameter estimates are located in the
> report screen. If I try to enter only one population, I get an error that
> my design matrix is collinear. Does anyone know how get the parameter
> estimates for a given distribution?

Aren't GUI's supposed to be intuitive?

I am afraid that I at least have no idea what you are talking about.
You get MLEs for distributions, not populations. And things needing
two populations are usually testing differences, not estimating.

As far as I know you can use censorReg and its GUI interface: just
have a constant ("1" for the regression part).

Perhaps you need to talk to technical support rather than this list?

Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

----------------------------------------------------------------------- This message was distributed by s-news@wubios.wustl.edu. To unsubscribe send e-mail to s-news-request@wubios.wustl.edu with the BODY of the message: unsubscribe s-news