Dear friends. I have the problem of assessing the importance of bleeding times censored at 20 minutes for predicting blood loss incurred after a liver biopsy. How would I use the knowledge that the censored values were 20 minutes or more ? Best wishes Troels Troels Ring, MD Department of Nephrology Aalborg Hospital, Denmark tring at mail1.stofanet.dk -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, 14 May 2000, Troels Ring wrote:> Dear friends. I have the problem of assessing the importance of bleeding > times censored at 20 minutes for predicting blood loss incurred after a > liver biopsy. How would I use the knowledge that the censored values were > 20 minutes or more ?This is a (partially) missing-value problem. Are values > 20 mins always censored? If so I would group the times and use an ordered factor as a regressor. If you really want a linear effect on, say `bt'' you can use ... + bt + I(bt==20) + ... which allows a separate value of bt==20 over and above a linear model. If your times are not all censored, you could build a model for the missing data and use multiple imputation. If you need, that, more details of your problem, please. -- Brian D. Ripley, ripley at 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 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 16:45 14/05/00 +0100, Brian D. Ripley wrote:>On Sun, 14 May 2000, Troels Ring wrote: > >> Dear friends. I have the problem of assessing the importance of bleeding >> times censored at 20 minutes for predicting blood loss incurred after a >> liver biopsy. How would I use the knowledge that the censored values were >> 20 minutes or more ? > >This is a (partially) missing-value problem. Are values > 20 mins >always censored? If so I would group the times and use an ordered factor >as a regressor. If you really want a linear effect on, say `bt'' you can >use > >... + bt + I(bt==20) + ... > >which allows a separate value of bt==20 over and above a linear model.I am trying to understand this. The help for ?I says: ... To avoid this confusion, the function `I()'' can be used to bracket those portions of a model formula where the operators are used in their arithmetic sense. For example, in the formula `y ~ a + I(b+c)'', the term `b+c'' is to be interpreted as the sum of `b'' and `c''. ... which is clear to me: doing lm(y ~ a + I(b+c)) is similar to d <- b + c lm(y ~ a + d) But what if the expression in I() is a logical? After playing a moment, I found out that a formula can include a logical variable, and treats it as a factor:> x <- runif(50, 0, 50) > y <- 2*x + rnorm(50, 0, 5) > lm(y ~ x < 25)Call: lm(formula = y ~ x < 25) Coefficients: (Intercept) x < 25 78.24 -53.92> lm(y ~ x > 25)Call: lm(formula = y ~ x > 25) Coefficients: (Intercept) x > 25 24.32 53.92 Is it worth adding a few lines in this help file on the use of logical variables in formula? (also characters can be included but must be converted into factors before) Emmanuel Paradis -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Emmanuel Paradis <paradis at isem.univ-montp2.fr> writes:> which is clear to me: doing lm(y ~ a + I(b+c)) is similar to > > d <- b + c > lm(y ~ a + d) > > But what if the expression in I() is a logical? After playing a moment, I > found out that a formula can include a logical variable, and treats it as a > factor: > > > x <- runif(50, 0, 50) > > y <- 2*x + rnorm(50, 0, 5) > > lm(y ~ x < 25) > > Call: > lm(formula = y ~ x < 25) > > Coefficients: > (Intercept) x < 25 > 78.24 -53.92 >I should hope that it is being converted to *numeric* (TRUE --> 1), not factor, otherwise there''d be all sorts of trouble with contrasts. This is a general feature: TRUE + 2 == 3 for instance, and (x>0)-(x<0) is the sign function. [Easiest way of checking is to compare lm(y ~ I(x < 25) - 1) with lm(y ~ factor(x < 25) - 1) ] -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /''_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 12:29 15/05/00 +0200, Peter Dalgaard wrote:>> which is clear to me: doing lm(y ~ a + I(b+c)) is similar to >> >> d <- b + c >> lm(y ~ a + d) >> >> But what if the expression in I() is a logical? After playing a moment, I >> found out that a formula can include a logical variable, and treats it as a >> factor: >> >> > x <- runif(50, 0, 50) >> > y <- 2*x + rnorm(50, 0, 5) >> > lm(y ~ x < 25) >> >> Call: >> lm(formula = y ~ x < 25) >> >> Coefficients: >> (Intercept) x < 25 >> 78.24 -53.92 >> > >I should hope that it is being converted to *numeric* (TRUE --> 1), >not factor, otherwise there''d be all sorts of trouble with contrasts. >This is a general feature: TRUE + 2 == 3 for instance, and (x>0)-(x<0) >is the sign function. > >[Easiest way of checking is to compare > >lm(y ~ I(x < 25) - 1) > >with > >lm(y ~ factor(x < 25) - 1) > >]You are right. I was misled by the fact that lm(y ~ as.factor(x < 25)) and lm(y ~ x < 25) give the same result. Emmanuel Paradis -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._