Dear R-useRs,
I'm looking for an R-function for censored linear regression. I have the
following data
x1 <- rnorm(100)
x2 <- rnorm(100)
y <- x1 + 2*x2 + rnorm(100,0,0.5)
stat <- rep(1,100)
stat[50:100] <- 0
data <- data.frame(y,x1,x2,stat)
y is the dependent variable, x1 and x2 are the independent variables in
a linear model. the variable y could be right-censored, this information
is in the variable stat, where 1 denotes observed and 0 denotes
censored. If stat is 0, then the value in y is the observed
right-censored value and could be greater. Using the Tobit-model would
not be the right thing here because the Tobit model assumes the same
limit for all observations, in my data each value of y[50:100] could
have a different limit.
If i use linear regression
lm1 <- lm(y ~ x1 + x2, data=data)
summary(lm1)
the censoring is not incorporated, so my idea is to use survreg from the
survival package
library(survival)
s1 <- survreg(Surv(y, stat) ~ x1 + x2, data, dist='gaussian')
summary(s1)
my question is, is this the right approach for my aim? Is it right, that
here each censored observations could have its own limit?
Thanks and best regards
Andreas
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.