Universite des Sciences et Technologies de Lille U F R de Mathematiques Pures et Appliquees Bat M2 F Villeneuve d Ascq Cedex
8 pages
English

Universite des Sciences et Technologies de Lille U F R de Mathematiques Pures et Appliquees Bat M2 F Villeneuve d'Ascq Cedex

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
8 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Niveau: Supérieur, Master, Bac+5
Universite des Sciences et Technologies de Lille U.F.R. de Mathematiques Pures et Appliquees Bat. M2, F-59655 Villeneuve d'Ascq Cedex Agregation externe Annee 2000-2001 Complements de documentation Scilab : les fonctions de repartition (cdf) 1 Fonctions de repartition de gaussiennes Voici ce que l'on peut lire dans l'aide en ligne de Scilab sur la fonction de repartition de la loi normale. cdfnor(1) Scilab Function cdfnor(1) NAME cdfnor - cumulative distribution function normal distribution CALLING SEQUENCE [P,Q]=cdfnor(PQ,X,Mean,Std) [X]=cdfnor(X,Mean,Std,P,Q) [Mean]=cdfnor(Mean,Std,P,Q,X) [Std]=cdfnor(Std,P,Q,X,Mean) PARAMETERS P,Q,X,Mean,Std : six real vectors of the same size. P,Q (Q=1-P) : The integral from -infinity to X of the normal density. Input range: (0,1]. X :Upper limit of integration of the normal-density. Input range: ( -infinity, +infinity) Mean : The mean of the normal density.

  • coup d'oeil sur la documentation en ligne

  • probleme analogue avec ? inconnu

  • fonctions de repartitions

  • standard normal

  • scilab function


Sujets

Informations

Publié par
Nombre de lectures 21
Langue English

Extrait

Agre´gationexterne
1
Universit´e U.F.R. de Bˆat.M2,
des Sciences et Technologies de Lille Mathe´matiquesPuresetApplique´es F-59655 Villeneuve d’Ascq Cedex
Ann´ee2000-2001
Compl´ementsdedocumentationScilab:lesfonctionsdere´partition(cdf)
Fonctionsdere´partitiondegaussiennes
VoicicequelonpeutliredanslaideenlignedeScilabsurlafonctiondere´partition de la loi normale.
cdfnor(1) Scilab Function NAME cdfnor - cumulative distribution function normal distribution
CALLING SEQUENCE [P,Q]=cdfnor("PQ",X,Mean,Std) [X]=cdfnor("X",Mean,Std,P,Q) [Mean]=cdfnor("Mean",Std,P,Q,X) [Std]=cdfnor("Std",P,Q,X,Mean)
PARAMETERS
P,Q,X,Mean,Std : six
real vectors of the same size.
P,Q (Q=1-P) : The integral Input range:
X
Mean
Sd
DESCRIPTION
cdfnor(1)
from -infinity to X of the normal density. (0,1].
:Upper limit of integration of the normal-density. Input range: ( -infinity, +infinity)
: The mean of the normal density. +infinity)
Input range: (-infinity,
: Standard Deviation of the normal density. Input range: (0,+infinity).
2
Ch.Suquet,Les f.d.r. en Scilab
Calculates any one parameter of the normal distribution given values for the others.
A slightly modified version of ANORM from Cody, W.D. (1993). "ALGORITHM 715: SPECFUN - A Portabel FORTRAN Package of Special Function Routines and Test Drivers" acm Transactions on Mathematical Software. 19, 22-32. is used to calulate the cumulative standard normal distribution.
The rational functions from pages 90-95 of Kennedy and Gentle, Statisti-cal Computing, Marcel Dekker, NY, 1980 are used as starting values to Newton’s Iterations which compute the inverse standard normal. Therefore no searches are necessary for any parameter.
For X < -15, the asymptotic expansion for ing value in finding the inverse standard of Abramowitz and Stegun.
the normal is normal. This
used as the start-is formula 26.2.12
The normal density is proportional to exp( - 0.5 * (( X - MEAN)/SD)**2)...
Ces«explications»e`erofmr:emeomitsuap.Lmireesce´dtpyrctne
[P,Q]=cdfnor("PQ",X,Mean,Std)
correspond`alaformule Z x21(tm) P= Φm,σ(x) =exp dt, Q= 1Φm,σ(x), 2 σ2π−∞2σ o`uΦm,σseltetcoifanopa´eerndndioitrtN(m, σ) avecm= Mean etσ= Std (pour standard deviationr,lemieleprtcreseepdereoptr).peimIlarectyt-dsia´lemonelgna param`etrePQetdecomprendrequelesdeuxparam`etresdesortiepeuventprendre n’importe quel nom :p,q, ouu,vonednnioensdpaneuedxuamoe`marapxtrese,ctS. de sortie, la fonction retourne seulement la valeur deP= Φm,σ(x).
-->[u,v]=cdfnor("PQ",1.2,0,1) v =
u
0.1150697 =
0.8849303 -->[u,v]=cdfnor("PQ",-1.2,0,1) v =
u
0.8849303 =
Ch.Suquet,Les f.d.r. en Scilab
0.1150697 -->cdfnor("PQ",1.96,0,1) ans =
0.9750021 -->b=cdfnor("PQ",1.96,0,1) b =
0.9750021
Examinonsladeuxie`meformedappeldecdfnor: [X]=cdfnor("X",Mean,Std,P,Q)
3
1 La fonction retourne cette fois la valeur du quantilex(= Φ P) lorsquem,σetP m,σ sontconnus(etrepr´esente´srespectivementdanslaformuleMean,StdetP). La valeur du parame`trePedans]0doitˆetr,meomrcniurfomeˆerte`marapreinredetuuqnamd[1teliaf 1 la valeurQ= 1PireuqreΦe(1.Pru´v,eopmelpraxe/2) = 0, il suffit de taper : 0,1
-->[X]=cdfnor("X",0,1,0.5,0.5) X =
- 5.405E-17 cequiestbienler´esultatattendu(nest-ilpas?).Voicidautresessais. -->[X]=cdfnor("X",0,1,0.999,0.001) X =
3.0902323 -->[X]=cdfnor("X",0,1,0.001,0.999) X =
- 3.0902323 -->[X]=cdfnor("X",3,1,0.999,0.001) X =
6.0902323 -->[X]=cdfnor("X",3,2,0.999,0.001) X =
9.1804646 -->z=cdfnor("X",3,2,0.999,0.001) z =
4
9.1804646
-->(z-3)/2 ans =
3.0902323
Ch.Suquet,Les f.d.r. en Scilab
Latroisi`emeforme [Mean]=cdfnor("Mean",Std,P,Q,X) sert`acalculerlespe´ranceinconnueIEZ=mundarevotaeerilbai´laeZde loiN(m, σ) lorsqueσest connue etZtelle queP(Zx) =PavecxetPconnus. Exemples : -->[Mean]=cdfnor("Mean",2,0.999,0.001,9.1804646) Mean =
3. -->m=cdfnor("Mean",1,0.975,0.025,1.96) m =
0.0000360
Est-ilvraimentn´ecessairedepr´eciserquelaquatrie`meforme [Std]=cdfnor("Std",P,Q,X,Mean) r´esoutleproble`meanalogueavecσinconnu etmqmselaeuldannˆomgieSnegpnen`?iuco stupide:lordredesparame`tresnestpasceluidelatroisi`emeformeenrempla¸cantStd parMean!
-->s=cdfnor("Std",0,0.975,0.025,1.96) input parameter P is out of range bound exceeded: 0.000000 !--error s=cdfnor("Std",0,0.975,0.025,1.96) -->s=cdfnor("Std",0.975,0.025,1.96,0) s =
999
1.0000184 R´esume´:La fonctioncdfnorunsthaecneˆıdeerteeL.smerpereijouratouram`s5pa caracte`resindiquantceluides5quiseraretourne´commevaleurdesortieenfonctiondes 4autres.Lesparame`tresPetQr´ilsapseoutturjoonsQ= 1Pteinsetrefourdoiventˆ touslesdeuxlorsquilssontenentr´ee.Lafonctionsappliqueaussiavecdesparam`etres vectoriels,pourvuquilssoientdemeˆmetaille.OnpeutainsitracerlegraphedeΦm,σ, 1 . . . Atte 1Φm,σ, Φm,σntion, la moyennemlteace´yttrepσntˆeoiveussitreaofmrossude vectorielle. Essayez
Ch.Suquet,en ScilabLes f.d.r.
-->x=(-4:.01:4)’;m=zeros(x);s=ones(x);
-->[p,q]=cdfnor("PQ",x,m,s);plot2d([x x],[p q])
2
Fonctionsder´epartitionsdebinomiales
Encore un coup d’oeil sur la documentation en ligne :
5
cdfbin(1) Scilab Function cdfbin(1) NAME cdfbin - cumulative distribution function Binomial distribution
CALLING SEQUENCE [P,Q]=cdfbin("PQ",S,Xn,Pr,Ompr) [S]=cdfbin("S",Xn,Pr,Ompr,P,Q) [Xn]=cdfbin("Xn",Pr,Ompr,P,Q,S) [Pr,Ompr]=cdfbin("PrOmpr",P,Q,S,Xn)
PARAMETERS
P,Q,S,Xn,Pr,Ompr : six real vectors of the same size.
P,Q (Q=1-P) : The cumulation from 0 to S of the binomial distribution. (Probablility of S or fewer successes in XN trials each with probability of success PR.) Input range: [0,1].
S
Xn
: The number of successes observed. Input range: [0, XN] Search range: [0, XN]
: The number of binomial Search range: [1E-300,
trials. 1E300]
Input range: (0, +infinity).
Pr,Ompr (Ompr=1-Pr) : The probability of success in each binomial trial. range: [0,1]. Search range: [0,1]
Input
DESCRIPTION Calculates any one parameter of the binomial distribution given values for the others.
Formula matical
26.5.24 Functions
of Abramowitz (1966) is used to
and Stegun, Handbook of Mathe-reduce the binomial distribution
6
to
the
cumulative incomplete
Ch.Suquet,en ScilabLes f.d.r.
beta distribution.
Computation of other parameters involve a seach for a produces the desired value of P. The search relies monotinicity of P with the other parameter....
value that on the
Fortsdenotreexpe´riencedeladocScilabpourlesf.d.r.gaussiennes,onseditquece texteestparfaitementlimpide.Lapremi`ereforme [P,Q]=cdfbin("PQ",S,Xn,Pr,Ompr)
correspond au calcul deP=P(Zx) etQ=P(Z > xu`al)o,atoial´eablevarireZsuit la loi binomiale Bin(n, p) avecx=S,n=Xn,p=Pr,q= 1p=Ompr. Par acquis de conscience,onve´rieavecn= 4 etp= 1/2. D’abord«amnia`al» -->x=0:4;y=cumsum([1 4 6 4 1]./16);[x;y] ans =
! 0. 1. 2. 3. ! 0.0625 0.3125 0.6875 0.9375 puisaveccdfbin(avecparame`tresvectoriels):
4. ! 1. !
-->n=4.*ones(x);p=0.5.*ones(x);q=1-p;[y,z]=cdfbin("PQ",x,n,p,q);
-->[x;y;z] ans =
! 0. 1. 2. 3. 4. ! ! 0.0625 0.3125 0.6875 0.9375 1. ! ! 0.9375 0.6875 0.3125 0.0625 0. ! Visiblementtoutvabien.Parcuriosite´onessaieunevaleurnonentie`repourleparam`etre x=SsOnteat.nuemssgadnostia`r,soit`aederreurlveoutrvameˆeampeuqruelruo [x].
-->cdfbin("PQ",2,4,0.5,0.5) ans =
0.6875 -->cdfbin("PQ",2.1,4,0.5,0.5) ans =
0.7216601 Rat´e!Passe´elapremi`ered´eception,onseditqu«ils»ont du prendre la fonction de r´epartitionpolygonalequiinterpoleline´airemententrelespointsdabscisseenti`ereau lieu de la vraie f.d.r. qui est en escaliers.
Ch.Suquet,en ScilabLes f.d.r.
-->cdfbin("PQ",2.5,4,0.5,0.5) ans =
0.8395305
-->cdfbin("PQ",2.5,4,0.5,0.5)== ans =
F
(0.6875+0.9375)/2
Encorerat´e!Pourenavoirlecoeurnet,ontape
-->x=0:.1:4;n=4*ones(x);p=0.5*ones(x);q=1-p;
-->y=cdfbin("PQ",x,n,p,q);plot(x,y)
7
et on obtient une magnifique courbe bien lisse au lieu d’une ligne polygonale. Si on veut tracerlarepre´sentationgraphiquedelavraief.d.r.,ilfauttaper(parexemple)
-->x=0:4;n=4*ones(x);p=0.5*ones(x);q=1-p;y=cdfbin("PQ",x,n,p,q); -->plot2d2("gnn",x’,y’)
Cenestpasencoretout`afaitcela`,caronnepeutprendredevaleurdexen dehors de [0, n] :
-->x=0:5;n=4*ones(x);p=0.5*ones(x);q=1-p;y=cdfbin("PQ",x,n,p,q); input parameter Pr is out of range bound exceeded: 4.000000 -->x=-1:4;n=4*ones(x);p=0.5*ones(x);q=1-p;y=cdfbin("PQ",x,n,p,q); input parameter Pr is out of range bound exceeded: 0.000000
Noteraupassagequelemessagederreursembleconfondreleparame`treSavecPr. Finalement,pouravoirlarepr´esentationgraphiquecorrecte,ilsutdefaire:
-->x=0:4;n=4*ones(x);p=0.5*ones(x);q=1-p;y=cdfbin("PQ",x,n,p,q);
-->x=[-1 x 5];y=[0 y 1];plot2d2("gnn",x’,y’)
Passonsaucalculdesquantiles.Onpre´pareleterrainavec:
-->k=0:4;n=4*ones(k);p=0.3*ones(k);q=1-p q =
!
0.7
0.7
0.7
0.7
-->[F,G]=cdfbin("PQ",k,n,p,q) G =
0.7 !
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents