Hello Im struggling on something... I have one continuous variable (A), and I need to explain it with 4 factors, and maybe one continuous covariate. And of course, my variable A is not normal at all (it's a duration in seconds, whole numbers). What can I do? I would know how do deal with it if I had one factor, maybe two, but in that case Im really not sure what I am supposed to do to write a model that is statistically correct. Thanks, Al -- View this message in context: http://r.789695.n4.nabble.com/1-continuous-non-normal-variable-4-factors-1-continuous-covariate-with-interactions-tp3444378p3444378.html Sent from the R help mailing list archive at Nabble.com.
1 continuous non-normal variable ~ 4 factors + 1 continuous covariate (with interactions)
5 messages · Dr. Pablo E. Verde, Alal
Im struggling on something... I have one continuous variable (A), and I need to explain it with 4 factors, and maybe one continuous covariate. And of course, my variable A is not normal at all (it's a duration in seconds, whole numbers). What can I do? I would know how do deal with it if I had one factor, maybe two, but in that case Im really not sure what I am supposed to do to write a model that is statistically correct.
If you are working with a positive outcome variable, one approach is to use glm( ..., family ="Gamma"), other approach is to use survreg() in the package survival. Cheers, Pablo
Thanks, Al -- View this message in context: http://r.789695.n4.nabble.com/1-continuous-non-normal-variable-4-factors-1-continuous-covariate-with-interactions-tp3444378p3444378.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.
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? -- 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.
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.
Thanks, I guess I can do that, and it actually seem appropriate for one of my variable. But can you do post-hoc tests on a survival analysis? Use contrasts or something? -- View this message in context: http://r.789695.n4.nabble.com/1-continuous-non-normal-variable-4-factors-1-continuous-covariate-with-interactions-tp3444378p3446782.html Sent from the R help mailing list archive at Nabble.com.