The below code creates a new variable "hdrs1" which takes the values of HAMD17tot_M0 if visit=0, and the values of HAMD17tot_M1 if visit =1 and the values of HAMD17tot_M3 if visit=3
I start by creating a vector than contains the values of HAMD17tot_M0, then I start modiying the vector using the ifelse command: if visit=1 then replace values by those of HAMD17tot_M1, else keep as is.
```
romain1$hdrs1<-romain1$HAMD17tot_M0
romain1$hdrs1<-ifelse(romain1$visit==1,romain1$HAMD17tot_M1, romain1$hdrs1)
romain1$hdrs1<-ifelse(romain1$visit==3,romain1$HAMD17tot_M3, romain1$hdrs1)
```
Introduction to the Analysis of Survival Data in the Presence of Competing Risks
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4741409/
-
Sometimes when you are running a regression model with variables that have different lengths, r will prompt with the following error message...
-
In linear regression analysis, If the predictor X is the numerical variable "calories", then an increase of X from 10 to 30 will h...
-
Amateur code ``` jad<-function(x, y) { model<-lm(y~x) std.err<-coef(summary(model))[, 2] coef.model1<-coef(summary(model)...