Bonjour,
J'essaye de calculer l'intégrale suivante :
Les A et alpha sont des fonctions déjà écrites qui fonctionnent.
Seulement quand je lance le code suivant j'ai l'erreur suivante : Error in integrate(fun, low, up) : length(upper) == 1 is not TRUE
j'ai l'erreur suivante : Error in integrate(fun, low, up) : length(upper) == 1 is not TRUE
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 l=data$r[i] AT=A("weibull",theta,tT) aT02=alpha(methode = "weibull",tT,theta[2,]) aT12=alpha(methode = "weibull",tT,theta[3,]) fun= function(u){ Au=A("weibull",theta,u,0) au=alpha("weibull",u,theta[1,]) res=exp(-Au$trans01-Au$trans02)*au*exp(AT$trans12+Au$trans12)*aT12 return(res) } int=integrate(fun,l,tT)$value
Je n'ai rien trouvé sur internet pour me débloquer...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #Forme de l'intensité de transition dans le cas paramétrique alpha=function(methode,t,theta){ if (methode=="weibull"){ alpha=theta[1]*(theta[2])*t**(theta[1]-1) } return(alpha) } #Intensité de transition cumulée A=function(methode="weibull",theta,up,low=0){ n=dim(theta)[1] A=rep(NA,n) for(k in 1:n){ if(methode=="weibull"){ fun=function(u) alpha("weibull",u,theta[k,]) A[k]=integrate(fun,low,up)$value } } return(list(trans01=A[1],trans02=A[2],trans12=A[3])) }
Partager