/
Package comparison February   Version Package comparison February   Version

Package comparison February Version - PDF document

liane-varnes
liane-varnes . @liane-varnes
Follow
429 views
Uploaded On 2015-03-08

Package comparison February Version - PPT Presentation

04 Date 05112013 Title Multivariate likelihood ratio calculation and evaluation Author David Lucy Maintainer David Lucy Description Functions for calculating and evaluating likelihood ratios from unimultivariate continu ous observations Imports isoto ID: 42758

Date 05112013 Title Multivariate

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Package comparison February Version" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Package`comparison'August5,2020Version1.0-5Date2020-08-04TitleMultivariateLikelihoodRatioCalculationandEvaluationEncodingUTF-8DescriptionFunctionsforcalculatingandevaluatinglikelihoodratiosfromuni/multivariatecontinu-ousobservations.Thepackageincludesthetwo-levelfunctionstocalculatetheLRassumingmultivariatenormality,andanotherwithdropsthisassumptionandusesamultivariatekerneldensityestimate.Thepackagealsocon-tainscodetoperformempiricalcrossentropy(ECE)calibrationoflikelihoodratios.TheLRfunctionsarebasedprimarilyonAitken,C.G.G.andLucy,D.(2004) oi:;.1;F/;&#xj.00;5-];&#xTJ 0;&#x -11;&#x.955;&#x Td ;&#x[000;9254.2003.05271.x,Evaluationoftraceevidenceintheformofmultivariatedata,JournaloftheRoyalStatisticalSociety:SeriesC(AppliedStatistics),53:109-122.TheECEfunctionsarebasedprimarilyonD.RamosandJ.Gonzalez-Rodrigues,(2008)Cross-entropyanalysisoftheinformationinforensicspeakerrecognition,inProc.IEEEOdyssey,SpeakerLang.Recognit.Workshop.DependsR oi:;.1;F/;&#xj.00;5-];&#xTJ 0;&#x -11;&#x.955;&#x Td ;&#x[000;(=3.5.0)ImportsisotoneLicenseGPL oi:;.1;F/;&#xj.00;5-];&#xTJ 0;&#x -11;&#x.955;&#x Td ;&#x[000;(=2)URLgithub.com/jmcurran/comparisonLazyLoadyesRoxygenNote7.1.1NeedsCompilationnoAuthorDavidLucy[aut],JamesCurran[aut,cre],AgnieszkaMartyna[aut]MaintainerJamesCurran&#xj.cu;&#xrran;&#x@auc;&#xklan; .ac;&#x.nz0;RepositoryCRANDate/Publication2020-08-0511:40:02UTC1 2calc.eceRtopicsdocumented:calc.ece...........................................2calibrate.set.........................................3comparison.........................................4glass.............................................5plot.ece...........................................6two.level.comparison.items.................................7two.level.components....................................7two.level.density.LR....................................8two.level.lindley.LR.....................................9two.level.normal.LR....................................11Index13 calc.eceEmpiricalcross-entropy(ECE)calculation DescriptionCalculatestheempiricalcross-entropy(ECE)forlikelihoodratiosfromasequencesameanddif-ferentitemcomparisons.Usagecalc.ece(LR.ss,LR.ds,prior=seq(from=0.01,to=0.99,length=99))ArgumentsLR.ssavectoroflikelihoodratios(LRs)fromsamesourcecalculationsLR.dsavectorofLRsfromdifferentsourcecalculationsprioravectorofordinatesforthepriorinascendingorder,andbetween0and1.Defaultis99divisionsof0.01to0.99.DetailsAcknowledgements:Thefunctiontocalculatethevaluesofthelikelihoodratioforthecalibrated.setdrawsheavilyupontheopt_loglr.mfunctionfromNikoBrummer'sFoCalpackageforMatlab.ValueReturnsanS3objectofclasseceAuthor(s)DavidLucy calibrate.set3References@referencesD.RamosandJ.Gonzalez-Rodrigues,(2008)"Cross-entropyanalysisoftheinforma-tioninforensicspeakerrecognition,"inProc.IEEEOdyssey,SpeakerLang.Recognit.Workshop.Zadora,G.&Ramos,D.(2010)Evaluationofglasssamplesforforensicpurposes-anapplica-tionoflikelihoodratiomodelandinformation-theoreticalapproach.ChemometricsandIntelligentLaboratory:102;63-83.SeeAlsoisotone::gpava(),calibrate.set()ExamplesLR.same=c(0.5,2,4,6,8,10)#thesamehas1LR1LR.different=c(0.2,0.4,0.6,0.8,1.1)#thedifferenthas1LR&#x-500;1ece.1=calc.ece(LR.same,LR.different)#simplestinvocationplot(ece.1)#useplotmethod calibrate.setCalculatethecalibratedsetofideaLRs DescriptionCalculatesandreturnsthecalibratedsetofidealLRsfromtheobservedLRsusingthepenalisedad-jacentviolatorsalgorithm.ThisisverymucharewriteofNicoBrummersoptloglr()`functionforMatlab.Usagecalibrate.set(LR.ss,LR.ds,method=c("raw","laplace"))ArgumentsLR.ssavectoroflikelihoodratiosforthecomparisonsofitemsknowntobefromthesamesourceLR.dsavectoroflikelihoodratiosforthecomparisonsofitemsknowntobefromdifferentsourcesmethodthemethodusedtoperformthecalculation,either"raw"or"laplace"DetailsThisisaninternalfunction,andisnotmeanttobecalleddirectly.Howeverithasbeenexportedjustincase. 4comparisonValuealistwithtwoitems:LR.cal.sscalibratedLRsforthecomparisonforsamesetLR.cal.dscalibratedLRsforthecomparisonfordifferentsetAuthor(s)DavidLucyReferencesD.RamosandJ.Gonzalez-Rodrigues,(2008)"Cross-entropyanalysisoftheinformationinforensicspeakerrecognition,"inProc.IEEEOdyssey,SpeakerLang.Recognit.Workshop.SeeAlsoisotone::gpava(),calc.ece() comparisoncomparison:Apackageforcomputinglikelihoodratiosforunivariateandmultivariateevidence. DescriptionThispackageisforcomputingtheweightoftheevidence,i.e.thelikelihoodratio(LR)fortraceevidencewhichhasbeenquantiedwithsomeinstrument.Forexampleaforensicscientistmightbehavedeterminedtherefractiveindicesoffragmentsofglasstakenfromacrimesceneandfragmentsofglassrecoveredfromtheclothingofthesuspectedbreaker.Thispackageevaluatestheprobability(density)oftheevidence,E,(theRIvaluesfromthetwosamples)underthehypothesisHpthattheyoriginatedfromthesamesource,andalternativelyunderthehypothesisHdthattheyoriginatedfromanothersource.TheLRistheratioofthesetwoquantities,i.e.LR=p(EjHp) p(EjHd).ALRwhichisgreaterthanoneindicatesthattheevidencesupportsHp,andaLRwhichislessthanoneindicatesthattheevidencesupportsHd.DetailsThecomputationcanuseeitherunivariateormultivariateobservationsofaphysicalobject.Forex-ampletraceelementmeasurements,andasimilarsetofuni/multivariateobservationsfromanotherobject,andcalculatesalikelihoodratioforthepropositionsthattherstitemcamefromthesamesourceasthesecondgivensomepopulationdata. glass5Acknowledgements:Inapackageoffunctionssuchasthesewhichhaveundergonealongdevelopmentoveranum-berofyears,itisinevitablethatanumberofpeople,besidesthosedirectlycited,havehelpedtocorrectandaddtothecode.Thesepeopleare(inalphabeticalorder):IvoAlberink(NFI),AnabelBolck(NFI),SonjaMenges(BKA),GeoffMorrison(Aston),TerezaNeocleous(Glasgow),An-dersNordgaard(SKL),BradPatterson(GeorgeMason),PhilRose(ANU),AgnieszkaRzepecka(Jagiellonian),MarjanSjerps(NFI)andHanjingZhang(Edinburgh).ReferencesAitken,C.G.G.&Lucy,D.(2004)Evaluationoftraceevidenceintheformofmultivariatedata.AppliedStatistics:53(1):109-122. glassGlasscompositiondataforsevenelementsfrom200glassitems. DescriptionThesedataarefromGrzegorz(Greg)ZadoraattheInstituteofForensicResearchinKrakow,Poland.Theyarethelogoftheratiosofeachelementtooxygen,sologNaOisthelog(10)oftheSodiumtoOxygenratio,andlogAlOisthelogoftheAluminiumtoOxygenratio.Theinstru-mentalmethodwasSEM-EDX.Usagedata(glass)Formatadata.framewith2400rowsand9columns.itemfactor200levels-whichitemthemeasurementscamefromfragmentfactor4levels-whichofthefourfragmentsfromeachitemtheobservationsweremadeuponlogNaOnumericlogofsodiumconcentrationtooxygenconcentrationlogMgOnumericlogofmagnesiumconcentrationtooxygenconcentrationlogAlOnumericlogofaluminiumconcentrationtooxygenconcentrationlogSiOnumericlogofsiliconconcentrationtooxygenconcentrationlogKOnumericlogofpotassiumconcentrationtooxygenconcentrationlogCaOnumericlogofcalciumconcentrationtooxygenconcentrationlogFeOnumericlogofironconcentrationtooxygenconcentration 6plot.eceDetailsTheitemindicatestheobjecttheglasscamefrom.Thelevelsforeachitemareuniquetothatitem.Thefragmentcanbeconsideredasub-item.WhencollectingtheseobservationsGregtookaglassobject,sayajamjar,hewouldthenbreakit,andextractfourfragments.Eachfragmentwouldbemeasuredthreetimesupondifferentpartsofthatfragment.Thefragmentlabelsarerepeated,so,forexample,fragment"f1"fromitem"s2"hasnothingwhatsoevertodowithfragment"f1"fromitem"s101".Fortwolevelmodelsuseitemasthelowerlevel-threelevelmodelscanusetheadditionalinfor-mationfromtheindividualfragments.SourceGrzegorzZadoraInstituteofForensicResearch,Krakow,Poland.ReferencesAitken,C.G.G.Zadora,G.&Lucy,D.(2007)ATwo-LevelModelforEvidenceEvaluation.JournalofForensicSciences:52(2);412-419. plot.eceAnS3plotmethodforobjectsofclassece DescriptionAnS3plotmethodforobjectsofclasseceUsage##S3methodforclass'ece'plot(x,...)ArgumentsxanS3objectofclassecewhichisgeneratedfromcalc.ece()....otherargumentsthatarepassedtotheplotgeneric.Author(s)DavidLucySeeAlsocalc.ece() two.level.comparison.items7 two.level.comparison.itemsCreateacompitemobject. DescriptionThisfunctioncreatesacompitemobjectfromadata.frameormatrixofobservationsfromanitemtobedeemedacontrol,orarecovered,item.Usagetwo.level.comparison.items(data,data.columns)Argumentsdataamatrixordata.frameofobservedpropertiesfromeitherthecontrolitem,ortherecovereditemdata.columnsvectorofintegersgivingwhichcolumnsindataaretheobservationsofthepropertiesValueanobjectofclasscompitemExamples#loadGregZadora'sglassdatadata(glass)#calculateacompitemobjectrepresentingthecontrolitemcontrol=two.level.comparison.items(glass[1:6,],c(7,8,9)) two.level.componentsComputeintegratedmeansandcovariances DescriptionTakesalargesamplefromthebackgroundpopulationandcalculatesthewithinandbetweencovari-ancematrices,avectorofmeans,avectorofthecountsofreplicatesforeachitemfromthesample,andotherbitsneededtomakeupacompcovarobject.Usagetwo.level.components(data,data.columns,item.column) 8two.level.density.LRArgumentsdataamatrix,ordata.frame,ofobservations,withcasesinrows,andpropertiesascolumnsdata.columnsavectorindicatingwhichcolumnsarethepropertiesitem.columnanintegerindicatingwhichcolumngivestheitemDetailsUsesMLestimationatthemoment-thiswillalmostcertainlychangeinthefutureandhopefullyallowregularisationmethodstogetamorestable(andnon-singular)estimate.ValueanobjectofclasscompvarExamples#loadGregZadora'sglassdatadata(glass)#calculateacompcovarobjectbaseduponglas#usingK,CaandFe-warning-couldtaketime#onslowermachinesZ=two.level.components(glass,c(7,8,9),1) two.level.density.LRCalculatethelikelihoodratiousingmultivariateKDEs DescriptionTakesacompitemobjectwhichrepresentssomecontrolitem,andacompitemobjectwhichrep-resentsarecovereditem,thenusesinformationfromacompcovarobject,whichrepresentstheinformationfromthepopulation,tocalculatealikelihoodratioasameasureoftheevidencegivenbytheobservationsforthesame/differentsourcepropositions.Usagetwo.level.density.LR(control,recovered,background)ArgumentscontrolacompitemobjectwiththecontroliteminformationrecoveredacompitemobjectwiththerecoverediteminformationbackgroundacompcovarobjectwiththepopulationinformationValueanestimateofthelikelihoodratio two.level.lindley.LR9ReferencesAitken,C.G.G.&Lucy,D.(2004)Evaluationoftraceevidenceintheformofmultivariatedata.AppliedStatistics:53(1);109-122.Exampleslibrary(comparison)#loadGregZadora'sglassdatadata(glass)#calculateacompcovarobjectbaseduponglass#usingK,CaandFe-warning-couldtaketime#onslowermachinesZ=two.level.components(glass,c(7,8,9),1)#calculateacompitemobjectrepresentingthecontrolitemcontrol=two.level.comparison.items(glass[1:6,],c(7,8,9))#calculateacompitemobjectrepresentingtherecovereditem#knowntobefromthesameitem(item1)recovered.1=two.level.comparison.items(glass[7:12,],c(7,8,9))#calculateacompitemobjectrepresentingtherecovereditem#knowntobefromadifferentitem(item2)recovered.2=two.level.comparison.items(glass[19:24,],c(7,8,9))#calculatethelikelihoodratioforaknown#samesourcecomparison-shouldbe20.59322#2020-08-01Boththisversionandthepreviousversionreturn20.58967lr.1=two.level.density.LR(control,recovered.1,Z)lr.1#calculatethelikelihoodratioforaknown#differentsourcecomparison-shouldbe0.02901532#2020-08-01Boththisversionandthepreviousversionreturn0.01161392lr.2=two.level.density.LR(control,recovered.2,Z)lr.2 two.level.lindley.LRLikelihoodratiocalculationusingLindley'sapproach DescriptionTakesacompitemobjectwhichrepresentssomecontrolitem,andacompitemobjectwhichrep-resentsarecovereditem,thenusesinformationfromacompcovarobject,whichrepresentstheinformationfromthepopulation,tocalculatealikelihoodratioasameasureoftheevidencegivenbytheobservationsforthesame/differentsourcepropositions. 10two.level.lindley.LRUsagetwo.level.lindley.LR(control,recovered,background)ArgumentscontrolacompitemobjectwiththecontroliteminformationrecoveredacompitemobjectwiththerecoverediteminformationbackgroundacompcovarobjectwiththepopulationinformationDetailsDoesthelikelihoodratiocalculationsforatwo-levelmodelassumingthatthebetweenitemdistri-butionisunivariatenormal.ThisfunctionistakenfromtheapproachdevisedbyDenisLindleyinhis1977paper(detailsbelow)andrepresentstheprogenitorofallthefunctionsinthispackage.ValueanestimateofthelikelihoodratioAuthor(s)DavidLucyReferencesLindley,D.(1977)AprobleminforensicScience.Biometrika:64;207-213.Examples#loadGregZadora'sglassdatadata(glass)#calculateacompcovarobjectbasedupondat#usingKZ=two.level.components(glass,7,1)#calculateacompitemobjectrepresentingthecontrolitemcontrol=two.level.comparison.items(glass[1:6,],7)#calculateacompitemobjectrepresentingtherecovereditem#knowntobefromthesameitem(item1)recovered.1=two.level.comparison.items(glass[7:12,],7)#calculateacompitemobjectrepresentingtherecovereditem#knowntobefromadifferentitem(item2)recovered.2=two.level.comparison.items(glass[19:24,],7)#calculatethelikelihoodratioforaknown#samesourcecomparison-shouldbe6.323941 two.level.normal.LR11#Thisvalueis6.323327inthisversionandinthelastversionwrittenbyDavid(1.0-4)lr.1=two.level.lindley.LR(control,recovered.1,Z)lr.1#calculatethelikelihoodratioforaknown#differentsourcecomparison-shouldbe0.004422907#Thisvalueis0.004421978inthisversionandthelastversionwrittenbyDavid(1.0-4)lr.2=two.level.lindley.LR(control,recovered.2,Z)lr.2 two.level.normal.LRLikelihoodratiocalculation-normal DescriptionTakesacompitemobjectwhichrepresentssomecontrolitem,andacompitemobjectwhichrep-resentsarecovereditem,thenusesinformationfromacompcovarobject,whichrepresentstheinformationfromthepopulation,tocalculatealikelihoodratioasameasureoftheevidencegivenbytheobservationsforthesame/differentsourcepropositions.Usagetwo.level.normal.LR(control,recovered,background)ArgumentscontrolacompitemobjectwiththecontroliteminformationrecoveredacompitemobjectwiththerecoverediteminformationbackgroundacompcovarobjectwiththepopulationinformationDetailsDoesthelikelihoodratiocalculationsforatwo-levelmodelassumingthatthebetweenitemdistri-butionisuni/multivariatenormal.ValueanestimateofthelikelihoodratioAuthor(s)AgnieszkaMartynaandDavidLucyReferencesAitken,C.G.G.&Lucy,D.(2004)Evaluationoftraceevidenceintheformofmultivariatedata.AppliedStatistics:53(1);109-122. 12two.level.normal.LRExamples#loadGregZadora'sglassdatadata(glass)#calculateacompcovarobjectbaseduponglass#usingK,CaandFe-warning-couldtaketime#onslowermachinesZtwo.level.components(glass,c(7,8,9),1)#calculateacompitemobjectrepresentingthecontrolitemcontroltwo.level.comparison.items(glass[1:6,],c(7,8,9))#calculateacompitemobjectrepresentingtherecovereditem#knowntobefromthesameitem(item1)recovered.1two.level.comparison.items(glass[7:12,],c(7,8,9))#calculateacompitemobjectrepresentingtherecovereditem#knowntobefromadifferentitem(item2)recovered.2two.level.comparison.items(glass[19:24,],c(7,8,9))#calculatethelikelihoodratioforaknown#samesourcecomparison-shouldbe51.16539#Thisvalueis51.14243inthisversionandthelastversionDavidwrote(1.0-4)lr.1two.level.normal.LR(control,recovered.1,Z)lr.1#calculatethelikelihoodratioforaknown#differentsourcecomparison-shouldbe0.02901532#Thisvsalueis0.02899908inthisversionandthelastversionDavidwrote(1.0-4)lr.2two.level.normal.LR(control,recovered.2,Z)lr.2 Indexdatasetsglass,5multivariatecomparison,4packagecomparison,4calc.ece,2calc.ece(),4,6calibrate.set,3calibrate.set(),3comparison,4glass,5isotone::gpava(),3,4plot.ece,6two.level.comparison.items,7two.level.components,7two.level.density.LR,8two.level.lindley.LR,9two.level.normal.LR,1113