您好,欢迎访问三七文档
ExampleAstudentattemptsamultiplechoiceexam(optionsAtoFforeachquestion),buthavingdonenowork,selectshisanswerstoeachquestionbyrollingafairdie(A=1,B=2,etc.).Iftheexamcontains100questions,whatistheprobabilityofobtainingamarkbelow20?微快车微信营销=100anda=ThiscanbedoneonRusingthecommandrbinom.16Forexample,let’ssimulate1000students.xsim=rbinom(1000,100,1/6)xsim[1]18229171820211681811161613161425151617[21]1325112417161321101718101718191719151312[41]1511212319141925231920171715161413161714[61]242119818202216152019171315132122121212[81]111411121616172117161714917161712201617[101]1813151612151716172618142115102312161612[121]1718221718141922131721152116171616281617[141]1819161114181618181420131919222213171917[161]182011221925151517185151413181517152017[181]1614231716101216213016132214151617141618[201]1420161925141524221915172210201310151422[221]171216192017152114132111199212216131312[241]14131881418101610122118151716819171118[261]2317201612201116221716132220151520172214[281]1823182020161916151918171422152417151722[301]1822101924211614111420152111171620191314[321]1717191517131823161225131321191620271918[341]1824152313131415231319151119171215151714[361]1820171316141320181518161720141921121317[381]221719161418161812161315169151618221416[401]1417121621162113141918181619171717131711[421]1616131026122017111918121514142015151511[441]1823202313121822121613212214182117121916[461]171815222220151613121922162019191681512[481]2926191620151122152021141613171510131712[501]1820171413192311271917161720211520202119[521]211613211619139102012181413181922192118[541]617171919222318131217162116182119132219[561]2017181517151510181323171423221018111118[581]161714139121414212324191215171811141919[601]191617131315171817139191822171314221323[621]231919162414171817131612715171618221915[641]161818132018126151116191213111711151119[661]1716162112182019161418171614111717161717[681]171816181218182019131216141313615121914[701]201716142119152617201224131119211813916[721]916171615121121211319131316111715192219[741]1113141620151612181412142112232119102417[761]1719191518121414142012201221192021201718[781]1512162316161915121421251219202217162120[801]232417201719142220251012151671414182210[821]1522231812101418151518102111201520101316[841]161722191916820171321162516131714171921[861]1719142220181419172320181411161826242418[881]2116232014161513141112131416181716171320[901]228171716161422171818211511202118151921[921]1622141216201621111319142312121714152617[941]1814211714242112211320221120101616151913[961]161516179141112191716152114151415171516[981]1911151717171118211415171816112219161415Itmakessensenowtolookatpropertiesofthese1000simulationswhichhavebeenplacedinthevector“xsim”.mean(xsim)[1]16.624median(xsim)[1]17sd(xsim)[1]3.778479var(xsim)[1]14.2769Nowcomparetheactualvaluesfromthesimulations,withthetheoreticalvaluesfromtheprobabilitydistribution.SIMULATIONTHEORETICALMEAN16.62416.66667VARIANCE14.276913.88889Afullsummaryoftheresultsofthesimulationisgivenwith:table(xsim)xsim5678910111213141516171327102140577280821181181819202122232425262728293085836155462514962111AHistogramcanalsobeplottedofthis:hist(xsim)NoticethataBARPLOTofxsimdoesNOTproduceausefulgraph!barplot(xsim)AbarplotoftheTABLEofxsimdoeswork,though.barplot(table(xsim))PoissonDistributionThePoissondistributionisusedtomodelthenumberofeventsoccurringwithinagiventimeinterval.TheformulaforthePoissonprobabilitydensity(mass)functionisistheshapeparameterwhichindicatestheaveragenumberofeventsinthegiventimeinterval.()!xepxxSomeeventsareratherrare-theydon'thappenthatoften.Forinstance,caraccidentsaretheexceptionratherthantherule.Still,overaperiodoftime,wecansaysomethingaboutthenatureofrareevents.Anexampleistheimprovementoftrafficsafety,wherethegovernmentwantstoknowwhetherseatbeltsreducethenumberofdeathincaraccidents.Here,thePoissondistributioncanbeausefultooltoanswerquestionsaboutbenefitsofseatbeltuse.OtherphenomenathatoftenfollowaPoissondistributionaredeathofinfants,thenumberofmisprintsinabook,thenumberofcustomersarriving,andthenumberofactivationsofaGeigercounter.ThedistributionwasderivedbytheFrenchmathematicianSiméonPoissonin1837,andthefirstapplicationwasthedescriptionofthenumberofdeathsbyhorsekickinginthePrussianarmy.ExampleArrivalsatabus-stopfollowaPoissondistributionwithanaverageof4.5everyquarterofanhour.Obtainabarplotofthedistribution(assumeamaximumof20arrivalsinaquarterofanhour)andcalculatetheprobabilityoffewerthan3arrivalsinaquarterofanhour.Theprobabilitiesof0upto2arrivalscanbecalculateddirectlyfromtheformula()!xepxx4.504.5(0)0!epwith=4.5Sop(0)=0.01111Similarlyp(1)=0.04999andp(2)=0.11248Sotheprobabilityoffewerthan3arrivalsis0.01111+0.04999+0.11248=0.17358RCodeAswiththeBinomialdistribution,thecodesdpoisandppoiswilldothecalculationsforyou.x=dpois(0:20,4.5)x[1]1.110900e-024.999048e-021.124786e-011.687179e-01
本文标题:优化营销平台流程
链接地址:https://www.777doc.com/doc-645137 .html