[R] 1 continuous non-normal variable ~ 4 factors + 1 continuous covariate (with interactions)

PabloEmilio.Verde at uni-duesseldorf.de PabloEmilio.Verde at uni-duesseldorf.de
Tue Apr 12 22:10:05 CEST 2011


Zitat von Alal <bohk at voila.fr>:

> Thanks
>
> Im not sure about the gamma, but a survival analysis seems appropriate, but
> does it work for factors and continuous covariates? Do you have to verify
> some conditions beforehand?

Here is an example:

# test data...
library(survival)

set.seed(1007)
x <- runif(50)
mu <- c(rep(1, 25), rep(2, 25))

test1 <- data.frame(Time = qsurvreg(x, mean = mu, scale= 0.5, distribution =
"weibull"),
                    Status = rbinom(50,1,0.7),
                    f1 = gl(2, 25),
                    f2 = factor(rbinom(50, 1, 0.5)),
                    f3 = factor(rbinom(50, 1, 0.5)),
                    f4 = factor(rbinom(50, 1, 0.5)),
                    z = rnorm(50)
                    )

mod1 <- survreg(Surv(Time, Status) ~  f1*(f2 + f2 + f4) + z, data = test1)
summary(mod1)

Cheers,

Pablo









>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/1-continuous-non-normal-variable-4-factors-1-continuous-covariate-with-interactions-tp3444378p3444670.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list