display optionsDescription le ftjri ghtcomputeonesidedpvaluesdefaultistwosidedl evelsetcondenceleveldefaultislevel95noh eadersuppresstableheadernol egendsuppresstablelegendv erbosedisplayfu ID: 137243
Download Pdf The PPT/PDF document "2permuteMonteCarlopermutationtests" 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.
2permuteMonteCarlopermutationtests display optionsDescription le ftjri ghtcomputeone-sidedp-values;defaultistwo-sidedl evel(#)setcondencelevel;defaultislevel(95)noh eadersuppresstableheadernol egendsuppresstablelegendv erbosedisplayfulltablelegendti tle(text)usetextastitleforresultseps(#)numericaltolerance;seldomused exp listcontains(name:elist)elisteexpelistcontainsnewvar=(exp)(exp)eexpisspecname[eqno]specnamespecnameis b b[] se se[]eqnois##nameexpisastandardStataexpression;see[U]13Functionsandexpressions.Distinguishbetween[],whicharetobetyped,and,whichindicateoptionalarguments.MenuStatisticsResamplingPermutationtestsDescriptionpermuteestimatesp-valuesforpermutationtestsonthebasisofMonteCarlosimulations.Typing.permutepermvarexp list,reps(#):commandrandomlypermutesthevaluesinpermvar#times,eachtimeexecutingcommandandcollectingtheassociatedvaluesfromtheexpressioninexp list.Thesep-valueestimatescanbeone-sided:Pr(TT)orPr(TT).Thedefaultistwo-sided:Pr(jTjjTj).HereTdenotesthevalueofthestatisticfromarandomlypermuteddataset,andTdenotesthestatisticascomputedontheoriginaldata.permvaridentiesthevariablewhoseobservedvalueswillberandomlypermuted. 4permuteMonteCarlopermutationtests nodotssuppressesdisplayofthereplicationdots.Bydefault,onedotcharacterisdisplayedforeachsuccessfulreplication.Ared`x'isdisplayedifcommandreturnsanerrororifoneofthevaluesinexp listismissing.noisilyrequeststhatanyoutputfromcommandbedisplayed.Thisoptionimpliesthenodotsoption.tracecausesatraceoftheexecutionofcommandtobedisplayed.Thisoptionimpliesthenoisilyoption.title(text)speciesatitletobedisplayedabovethetableofpermutationresults;thedefaulttitleisMonteCarlopermutationresults. Advanced eps(#)speciesthenumericaltolerancefortestingjTjjTj,TT,orTT.Theseareconsideredtrueif,respectively,jTjjTj#,TT+#,orTT#.Thedefaultis1e-7.Youwillnothavetospecifyeps()undernormalcircumstances.nowarnsuppressestheprintingofawarningmessagewhencommanddoesnotsete(sample).forcesuppressestherestrictionthatcommandmaynotspecifyweightsorbeasvycommand.permuteisnotsuitedforweightedestimation,thuspermuteshouldnotbeusedwithweightsorsvy.permutereportsanerrorwhenitencountersweightsorsvyincommandiftheforceoptionisnotspecied.Thisisaseldomusedoption,souseitonlyifyouknowwhatyouaredoing!reject(exp)identiesanexpressionthatindicateswhenresultsshouldberejected.Whenexpistrue,theresultingvaluesareresettomissingvalues.seed(#)setstherandom-numberseed.Specifyingthisoptionisequivalenttotypingthefollowingcommandpriortocallingpermute:.setseed#Remarksandexamplesstata.comPermutationtestsdeterminethesignicanceoftheobservedvalueofateststatisticinlightofrearrangingtheorder(permuting)oftheobservedvaluesofavariable. Example1:Asimpletwo-sampletestSupposethatweconductedanexperimenttodeterminetheeffectofatreatmentonthedevelopmentofcells.Furthersupposethatwearerestrictedtosixexperimentalunitsbecauseoftheextremecostoftheexperiment.Thusthreeunitsaretobegivenaplacebo,andthreeunitsaregiventhetreatment.Themeasurementisthenumberofnewlydevelopedhealthycells.Thefollowinglistinggivesthehypotheticaldata,alongwithsomesummarystatistics..inputytreatmentytreatment1.702.903.1104.1015.1216.1417.end.sorttreatment permuteMonteCarlopermutationtests5 .summarizeyVariable ObsMeanStd.Dev.MinMax y 610.52.428992714.bytreatment:summarizey -treatment=0Variable ObsMeanStd.Dev.MinMax y 392711 -treatment=1Variable ObsMeanStd.Dev.MinMax y 31221014Clearly,therearemorecellsinthetreatmentgroupthanintheplacebogroup,butastatisticaltestisneededtoconcludethatthetreatmentdoesaffectthedevelopmentofcells.Ifthesumofthetreatmentmeasuresisourteststatistic,wecanusepermutetodeterminetheprobabilityofobserving36ormorecells,giventheobserveddataandassumingthatthereisnoeffectduetothetreatment..setseed1234.permuteysum=r(sum),saving(permdish)rightnodropnowarn:sumyiftreatment(runningsummarizeonestimationsample)Permutationreplications(100) 1 2 3 4 5..................................................50..................................................100MonteCarlopermutationresultsNumberofobs=6command:summarizeyiftreatmentsum:r(sum)permutevar:y T T(obs)cnp=c/nSE(p)[95%Conf.Interval] sum 36101000.10000.0300.0490047.1762226 Note:confidenceintervaliswithrespecttop=c/n.Note:c=#{T=T(obs)}Weseethat10ofthe100randomlypermuteddatasetsyieldedsumsfromthetreatmentgrouplargerthanorequaltotheobservedsumof36.Thustheevidenceisnotstrongenough,atthe5%level,torejectthenullhypothesisthatthereisnoeffectofthetreatment.Becauseofthesmallsizeofthisexperiment,wecouldhavecalculatedtheexactpermutationp-valuefromallpossiblepermutations.Therearesixunits,butwewantthesumofthetreatmentunits.Thusthereare63=20permutationsumsfromthepossibleuniquepermutations. 8permuteMonteCarlopermutationtests Example3:Wilcoxonrank-sumtestAsanalexample,let'sconsiderestimatingthep-valueoftheZstatisticreturnedbyranksum.Supposethatwecollecteddatafromsomeexperiment:yissomemeasurewetookon17individuals,andgroupidentiesthegroupthatanindividualbelongsto..usehttp://www.stata-press.com/data/r13/permute2.list groupy 1. 16 2. 111 3. 120 4. 12 5. 19 6. 15 7. 02 8. 01 9. 06 10. 00 11. 02 12. 03 13. 03 14. 012 15. 04 16. 01 17. 05 Nextweanalyzethedatausingranksumandnoticethattheobservedvalueoftheteststatistic(storedasr(z))is2.02withanapproximatep-valueof0.0434..ranksumy,by(group)Two-sampleWilcoxonrank-sum(Mann-Whitney)testgroup obsranksumexpected 0 1179991 67454 combined 17153153unadjustedvariance99.00adjustmentforties-0.97 adjustedvariance98.03Ho:y(group==0)=y(group==1)z=-2.020Prob|z|=0.0434Theobservedvalueoftherank-sumstatisticis79,withanexpectedvalue(underthenullhypothesisofnogroupeffect)of99.Thereare17observations,sothepermutationdistributioncontains176=12,376possiblevaluesoftherank-sumstatisticifweignoreties.Withties,wehavefewerpossiblevaluesbutstilltoomanytowanttocountthem.Thusweusepermutewith10,000replicationsandseethattheMonteCarlopermutationtestagreeswiththeresultofthetestbasedonthenormalapproximation.