[R] (no subject)
David Winsemius
dw|n@em|u@ @end|ng |rom comc@@t@net
Sun May 13 18:37:56 CEST 2018
> On May 13, 2018, at 9:35 AM, David Winsemius <dwinsemius using comcast.net> wrote:
>
>
>> On May 12, 2018, at 9:42 AM, malika yassa via R-help <r-help using r-project.org> wrote:
>>
>>
>> hello
>> for exampl, i have this programme
>> # Generating data which are right truncated
>> library(DTDA)
>> library(splines)
>> library(survival)
>> n<-25
>> X<-runif(n,0,1)
>> V<-runif(n,0.75,1)
>> for (i in 1:n){
>> while (X[i]>V[i]){
>> X[i]<-runif(1,0,1)
>> V[i]<-runif(1,0.75,1)
>> }}
>> res<-lynden(X=X,U=NA, V=V, boot=TRUE)
>> attach(res)
>> temps = time
>> M_i = n.event
>> L_t = res
>> F_t=1-L_t
>
>> F_t=1-L_t
> Error in 1 - L_t : non-numeric argument to binary operator
>
> L_t is a list. You cannot subtract a list (at least in R). I'm not sure what you think F_t is supposed to be and you don't seem to use it. If you are attempting to calculate the Hazard function, it's just:
>
> str(L_t) # note the hazard component of that list.
>
> res$hazard
>
> [1] 0.03958 0.04121 0.04299 0.04492 0.04703 0.04935 0.05191 0.05476
> [9] 0.05793 0.06149 0.06552 0.07011 0.07540 0.08155 0.08879 0.09744
> [17] 0.10795 0.12102 0.13768 0.15966 0.19000 0.23457 0.30645 0.44186
> [25] 1.00000
>
> For some interpretations of your question, this may be what you are seeking. It's the Pr( X > t )
Wrong. It's Pr( X < t)
Sorry;
David.
>
>>
>> par(mfrow=c(1,1))
>> plot(L_t$time,L_t$survival,type="s",lty=2:3,lwd=2,las=1,cex.lab=1.1,font.lab=2,col="red",xlab="temps",ylab="L(t)",main="Esitmation de la Fonction de Survie L(t)")
>>
>>
>> i need to calculate the probability p(X>V)
>
> As I see it the probability of X>V is:
>
> sum(X > V)
> [1] 0
>
> And I see this as a matter of definition. I'm guessing you wanted the estimated Hazard. If I'm wrong, I wonder if you can rephrase the question so it makes more sense to a general statistical audience. What is the subject matter of the investigation?
>
>
> --
> David
>>
>> Le jeudi 10 mai 2018 à 17:15:06 UTC+2, John Kane <jrkrideau using yahoo.ca> a écrit :
>>
>> We need some idea of the problem.
>>
>> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>>
>>
>> http://adv-r.had.co.nz/Reproducibility.html
>>
>>
>>
>> On Thursday, May 10, 2018, 11:07:30 a.m. EDT, malika yassa via R-help <r-help using r-project.org> wrote:
>>
>>
>> Hello
>>
>> Do You help me, i have the problem in the package DTDA for find the probability of truncation (alpha)
>> thank you
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>
> David Winsemius
> Alameda, CA, USA
>
> 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
David Winsemius
Alameda, CA, USA
'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
More information about the R-help
mailing list