Plot the cumulative intensity process survival analysis Let T be an exponentially distributed survival time with hazard rate $\alpha(t) = 2$ for t > 0. Define $T = min(T,1)$ and $Delta = I(T \le 1)$.
Let $\lambda(t)$ be the intensity process and $\Lambda(t) =\int_0^t \lambda(u)du$ be the cumulative intensity process.
My questions are:

*

*How to generate the data in R? Can I use rexp to generate the survival data in this case?

*How to plot the cumulative intensity process for $Delta=1$ and $Delta=0$, respectively?

 A: Do what you can analytically to start. You have a survival function $S(t)=\exp(-2t)$.
What is the hazard function associated with this survival function? Does it vary over time?
What is the relationship between the hazard of a survival function and the intensity of the corresponding counting process?  What does that say about the intensity of the counting process? Does the intensity change with time before $t=1$? What is the integral of that intensity, the cumulative intensity, over time up through $t =1$?
Are there events observed after $t=1$?
You certainly can use the rexp() function to generate sample data for the distribution of $T$, then censor values having $T > 1$, but I think that you can answer the underlying question and sketch the plot without doing that.
After you work this through, consider posting the result as an answer to your own question.
Added in response to comment:
There might be some ambiguity in what's meant by the "intensity" here.
I would take it to represent the intensity of an underlying process shared by members of a population. In this situation the (cumulative) intensity would be the (cumulative) hazard function itself, independent of the numbers at risk in a particular data set. That's consistent with Therneau and Grambsch, whose Index entry says: "intensity, see hazard function" and who show in Figure 1.1 the observed "N(t)" (observed event) and "Y(t)" (at-risk) processes for individual hypothetical subjects. These "Notes on Counting Process in Survival Analysis" seem to take a similar view; the discussion of the "One jump counting process" in Section 3 seems to be particularly relevant to this question.
You seem to interpret "intensity" in terms of the expected number of observed events in a data sample from such a population. Under that interpretation you would have to multiply the instantaneous hazard by the number at risk Y(t) and integrate over time to get a "cumulative intensity," as you indicate in a comment.
In either case, you have correctly identified that the hazard function, which you call $\alpha(t)$, of an observed event is constant at a value of 2 up through $t=1$.
