/
Package endorse February   Version Package endorse February   Version

Package endorse February Version - PDF document

lindy-dunigan
lindy-dunigan . @lindy-dunigan
Follow
389 views
Uploaded On 2015-06-09

Package endorse February Version - PPT Presentation

41 Date 20140503 Title R Package for Analyzing Endorsement Experiments Author Yuki Shiraito Kosuke Imai Maintainer Yuki Shiraito Depends coda utils Description This R package implements the statistical model proposed by Bul lock Imai and Shapiro 201 ID: 83136

Date 20140503 Title

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Package endorse 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`endorse'November6,2018Version1.6.1Date2018-11-4TitleBayesianMeasurementModelsforAnalyzingEndorsementExperimentsAuthorYukiShiraito[aut,cre],KosukeImai[aut],BrynRosenfeld[ctb]MaintainerYukiShiraito&#xshir; ito;&#x@umi; h.e; u00;Dependscoda,utilsDescriptionFitthehierarchicalandnon-hierarchicalBayesianmeasurementmodelsproposedbyBul-lock,Imai,andShapiro(2011) OI:;.1;“/;&#xpan/;&#xmpr0;ã„€toanalyzeendorsementexperi-ments.Endorsementexperimentsareasurveymethodologyforelicitingtruthfulresponsestosen-sitivequestions.Thismethodologyishelpfulwhenmeasuringsupportforsociallysensitivepo-liticalactorssuchasmilitantgroups.ThemodelisttedwithaMarkovchainMonteCarloalgo-rithmandproducestheoutputcontainingdrawsfromtheposteriordistribution.LazyLoadyesLazyDatayesLicenseGPL OI:;.1;“/;&#xpan/;&#xmpr0;ã„€(=2)URLhttps://github.com/SensitiveQuestions/endorse/NeedsCompilationyesRepositoryCRANDate/Publication2018-11-0615:40:03UTCRtopicsdocumented:endorse...........................................2endorse.plot.........................................11GeoCount..........................................12GeoId............................................13pakistan...........................................14predict.endorse.......................................15Index171 2endorse endorseFittingtheMeasurementModelofPoliticalSupportviaMarkovChainMonteCarlo DescriptionThisfunctiongeneratesasamplefromtheposteriordistributionofthemeasurementmodelofpo-liticalsupport.Individual-levelcovariatesmaybeincludedinthemodel.Thedetailsofthemodelaregivenunder`Details'.SeealsoBullocketal.(2011).Usageendorse(Y,data,data.village=NA,village=NA,treat=NA,na.strings=99,identical.lambda=TRUE,covariates=FALSE,formula.indiv=NA,hierarchical=FALSE,formula.village=NA,h=NULL,group=NULL,x.start=0,s.start=0,beta.start=1,tau.start=NA,lambda.start=0,omega2.start=.1,theta.start=0,phi2.start=.1,kappa.start=0,psi2.start=1,delta.start=0,zeta.start=0,rho2.start=1,mu.beta=0,mu.x=0,mu.theta=0,mu.kappa=0,mu.delta=0,mu.zeta=0,precision.beta=0.04,precision.x=1,precision.theta=0.04,precision.kappa=0.04,precision.delta=0.04,precision.zeta=0.04,s0.omega2=1,nu0.omega2=10,s0.phi2=1,nu0.phi2=10,s0.psi2=1,nu0.psi2=10,s0.sig2=1,nu0.sig2=400,s0.rho2=1,nu0.rho2=10,MCMC=20000,burn=1000,thin=1,mh=TRUE,prop=0.001,x.sd=TRUE,tau.out=FALSE,s.out=FALSE,omega2.out=TRUE,phi2.out=TRUE,psi2.out=TRUE,verbose=TRUE,seed.store=FALSE,update=FALSE,update.start=NULL)ArgumentsYalistofthevariablenamesfortheresponses.Itshouldtakethefollowingform:list(Q1=c("varnameQ1.1","varnameQ1.2",...),...).IftreatisNA,therstvariableforeachquestionshouldbetheresponsesofthecontrolobservationswhileeachoftheothervariablesshouldcorrespondtoeachendorser.treatshouldbesuppliedifonlyonevariablenameisprovidedforaquestioninthisargument.Ifauxiliaryinformationisincluded,itisassumedthatYiscodedsuchthathighervaluesindicatemoreofthesensitivetrait.datadataframecontainingtheindividual-levelvariables.Thecasesmustbecom-plete,i.e.,noNA'sareallowed. endorse3data.villagedataframecontainingthevillage-levelvariables.Thecasesmustbecomplete,i.e.,noNA'sareallowed.Ifauxiliaryinformationisincluded,thedataframeshouldincludeonlytheuniquegroupidentierandtheuniqueidentierfortheunitsatwhichpredictionisdesired.Thepackagedoesnotcurrentlysupporttheinclusionofcovariatesinmodelswithauxiliaryinformation.villagecharacter.Thevariablenameofthevillageindicatorintheindividual-leveldata.Ifauxiliaryinformationisincluded,thisshouldcorrespondtothevariablenameoftheunitsatwhichpredictionisdesired.treatAnoptionalmatrixofnonnegativeintegersindicatingthetreatmentstatusofeachobservationandeachquestion.Rowsareobservationsandcolumnsarequestions.0representsthecontrolstatuswhilepositiveintegersindicatetreat-mentstatuses.IftreatissettoNA,thefunctiongeneratesthetreatmentmatrixusingY.ThedefaultisNA.na.stringsascalaroravectorindicatingthevaluesoftheresponsevariablethataretobeinterpretedas“Don'tKnow”or“RefusedtoAnswer.”ThevalueshouldnotbeNAunlesstreatisprovided,becauseNA'sareinterpretedastheresponsetothequestionwithanotherendorsement.Defaultis99.identical.lambdalogical.IfTRUE,themodelwithacommonlambdaacrossquestionswillbetted.ThedefaultisTRUE.covariateslogical.IfTRUE,themodelincludesindividual-levelcovariates.ThedefaultisFALSE.formula.indivasymbolicdescriptionspecifyingtheindividuallevelcovariatesforthesup-portparameterandtheidealpoints.Theformulashouldbeone-sided,e.g.~Z1+Z2.hierarchicallogical.IFTRUE,thehierarchicalmodelwithvillagelevelpredictorswillbetted.ThedefaultisFALSE.formula.villageasymbolicdescriptionspecifyingthevillagelevelcovariatesforthesupportparameterandtheidealpoints.Theformulashouldbeone-sided.hAuxiliarydatafunctionality.Optionalnamednumericvectorwithlengthequaltonumberofgroups.Namescorrespondtogrouplabelsandvaluescorrespondtoauxiliarymoments(i.e.totheknownshareofthesensitivetraitatthegrouplevel).groupAuxiliarydatafunctionality.Optionalcharacterstring.Thevariablenameofthegroupindicatorintheindividual-leveldata(e.g.group="county").x.startstartingvaluesfortheidealpointsvectorx.Ifx.startissettoascalar,thestartingvaluesfortheidealpointsofallrespondentswillbesettothescalar.Ifx.startisavectorofthesamelengthasthenumberofobservations,thenthisvectorwillbeusedasthestartingvalues.Thedefaultis0.s.startstartingvaluesforthesupportparameter,sijk.Ifs.startissettoascalar,thestartingvaluesforthesupportparameterofallrespondentsandallquestionswillbethescalar.Ifs.startissettoamatrix,itshouldhavethesamenumberofrowsasthenumberofobservationsandthesamenumberofcolumnsasthenumberofquestions.Also,thevalueshouldbezeroforthecontrolcondition.Thedefaultis0. 4endorsebeta.startstartingvaluesforthequestionrelatedparameters, jand j.Ifbeta.startissettoascalar,thestartingvaluesforthesupportparameterofallrespondentsandallquestionswillbethescalar.Ifbeta.startissettoamatrix,thenumberofrowsshouldbethenumberofquestionsandthenumberofcolumnsshouldbe2.Therstcolumnwillbethestartingvaluesfor jandthesecondcolumnwillbethestartingvaluesfor j.Sincetheparametervaluesareconstrainedtobepositive,thestartingvaluesshouldbealsopositive.Thedefaultis1.tau.startstartingvaluesforthecutpointsintheresponsemodel.IfNA,thefunctiongeneratesthestartingvaluessothateachintervalbetweenthecutpointsis0.5.Iftau.startissettoamatrix,thenumberofrowsshouldbethesameasthenumberofquestionsandthenumberofcolumnsshouldbethemaximumvalueofthenumberofcategoriesintheresponses.Therstcutpointforeachquestionshouldbesetto0whilethelastonesettothepreviouscutpointplus1000.ThedefaultisNA.lambda.startstartingvaluesforthecoefcientsinthesupportparametermodel,jk.Iflambda.startissettoascalar,thestartingvaluesforallcoefcientswillbethescalar.Iflambda.startissettoamatrix,thenumberofrowsshouldbethenumberoftheindividuallevelcovariates(plusthenumberofvillages,ifthemodelishierarchical),andthenumberofcolumnsshouldbethenumberofen-dorsers(timesthenumberofquestions,ifthemodeliswithvaryinglambdas).Thedefaultis0.omega2.startstartingvaluesforthevarianceofthesupportparameters,!2jk.Ifsettoascalar,thestartingvaluesforomega2jkwillbethediagonalmatrixwiththediagonalelementssettothescalar.Ifomega2.startissettoamatrix,thenumberofrowsshouldbethenumberofquestions,whilethenumberofcolumnsshouldbethesameasthenumberofendorsers.Thedefaultis.1.theta.startstartingvaluesforthemeansofthejkforeachendorser.Iftheta.startissettoascalar,thestartingvaluesforallparameterswillbethescalar.Iftheta.startissettoamatrix,thenumberofrowsshouldbethenumberofendorsersandthenumberofcolumnsshouldbethedimensionofcovariates.Thedefaultis0.phi2.startstartingvaluesforthecovariancematricesofthecoefcientsofthesupportpa-rameters,k.kisassumedtobeadiagonalmatrix.Ifphi2.startissettoascalar,thestartingvaluesforallcovariancematriceswillbethesamediago-nalmatrixwiththediagonalelementssettothescalar.Ifphi2.startissettoavector,thelengthshouldbethenumberofendorserstimesthedimensionofcovariates.Thedefaultis.1.kappa.startstartingvaluesforthecoefcientsonvillagelevelcovariatesinthesupportpa-rametermodel,k.Ifkappa.startissettoascalar,thestartingvaluesforallcoefcientswillbethescalar.Ifkappa.startissettoamatrix,thenumberofrowsshouldbethenumberofthevillagelevelcovariates,andthenumberofcolumnsshouldbethenumberofendorsers(timesthenumberofquestions,ifthevarying-lambdamodelistted).Thedefaultis0.psi2.startstartingvaluesforthevarianceofthevillagerandominterceptsinthesupportparametermodel, 2k.Ifpsi2.startissettoascalar,thestartingvaluesfor 2kwillbethediagonalmatrixwiththediagonalelementssettothescalar.If endorse5psi2.startissettoavector,itslengthshouldbethenumberofendorsers(timesthenumberofquestions,ifthevarying-lambdamodelistted).Thedefaultis.1.delta.startstartingvaluesforthecoefcientsonindividuallevelcovariatesintheidealpointmodel.Willbeusedonlyifcovariates=TRUE.Ifdelta.startissettoascalar,thestartingvaluesforallcoefcientswillbethescalar.Ifdelta.startissettoavector,thelengthshouldbethedimensionofcovariates.Thedefaultis0.zeta.startstartingvaluesforthecoefcientsonvillagelevelcovariatesintheidealpointmodel.Willbeusedonlyifcovariates=TRUE.Ifzeta.startissettoascalar,thestartingvaluesforallcoefcientswillbethescalar.Ifzeta.startissettoavector,thelengthshouldbethedimensionofcovariates.Thedefaultis0.rho2.startnumeric.startingvaluesforthevarianceofthevillagerandominterceptsintheidealpointmodel,2.Thedefaultis1.mu.betathemeanoftheindependentNormalprioronthequestionrelatedparameters.Canbeeitherascalaroramatrixofdimensionthenumberofquestionstimes2.Thedefaultis0.mu.xthemeanoftheindependentNormalprioronthequestionrelatedparameters.Canbeeitherascalaroravectorofthesamelengthasthenumberofobserva-tions.Thedefaultis0.mu.thetathemeanoftheindependentNormalprioronthemeanofthecoefcientsinthesupportparametermodel.Canbeeitherascalaroravectorofthesamelengthasthedimensionofcovariates.Thedefaultis0.mu.kappathemeanoftheindependentNormalprioronthecoefcientsofvillagelevelcovariates.Canbeeitherascalaroramatrixofdimensionthenumberofco-variatestimesthenumberofendorsers.Ifauxiliaryinformationisincluded,thevalueofmu.kappawillbecomputedforeachgroupsuchthatthepriorprobabil-ityofthesupportparametertakingapositivevalueisequaltotheknownvalueofh.Thedefaultis0.mu.deltathemeanoftheindependentNormalprioronthethecoefcientsintheidealpointmodel.Canbeeitherascalaroravectorofthesamelengthasthedimen-sionofcovariates.Thedefaultis0.mu.zetathemeanoftheindependentNormalprioronthethecoefcientsofvillagelevelcovariatesintheidealpointmodel.Canbeeitherascalaroravectorofthesamelengthasthedimensionofcovariates.Thedefaultis0.precision.betatheprecisions(inversevariances)oftheindependentNormalpriorontheques-tionrelatedparameters.Canbeeitherascalarora22diagonalmatrix.Thedefaultis0.04.precision.xscalar.TheknownprecisionoftheindependentNormaldistributionontheidealpoints.Thedefaultis1.precision.thetatheprecisionsoftheindependentNormalprioronthemeansofthecoefcientsinthesupportparametermodel.Canbeeitherascalaroravectorofthesamelengthasthedimensionofcovariates.Thedefaultis0.04. 6endorseprecision.kappatheprecisionsoftheindependentNormalprioronthecoefcientsofvillagelevelcovariatesinthesupportparametermodel.Canbeeitherascalaroravectorofthesamelengthasthedimensionofcovariates.Ifauxiliaryinformationisincluded,thevalueofprecision.kappawillbexedto100000.Thedefaultis0.04.precision.deltatheprecisionsoftheindependentNormalprioronthethecoefcientsintheidealpointmodel.Canbeeitherascalarorasquarematrixofthesamedimensionasthedimensionofcovariates.Thedefaultis0.04.precision.zetatheprecisionsoftheindependentNormalprioronthethecoefcientsofvillagelevelcovariatesintheidealpointmodel.Canbeeitherascalarorasquarematrixofthesamedimensionasthedimensionofcovariates.Thedefaultis0.04.s0.omega2scalar.Thescaleoftheindependentscaledinverse-chi-squaredpriorforthevarianceparameterinthesupportparametermodel.Ifauxiliaryinformationisincluded,thevalueofs0.omega2willbexedtothedefault.Thedefaultis1.nu0.omega2scalar.Thedegreesoffreedomoftheindependentscaledinverse-chi-squaredpriorforthevarianceparameterinthesupportparametermodel.Ifauxiliaryinformationisincluded,thevalueofnu0.omega2willbexedtothedefault.Thedefaultis10.s0.phi2scalar.Thescaleoftheindependentscaledinverse-chi-squaredpriorforthevariancesofthecoefcientsinthesupportparametermodel.Thedefaultis1.nu0.phi2scalar.Thedegreesoffreedomoftheindependentscaledinverse-chi-squaredpriorforthevariancesofthecoefcientsinthesupportparametermodel.Thedefaultis10.s0.psi2scalar.Thescaleoftheindependentscaledinverse-chi-squaredpriorforthevariancesofthevillagerandominterceptsinthesupportparametermodel.Thedefaultis1.nu0.psi2scalar.Thedegreesoffreedomoftheindependentscaledinverse-chi-squaredpriorforthevariancesofthevillagerandominterceptsinthesupportparametermodel.Thedefaultis10.s0.sig2scalar.Thescaleoftheindependentscaledinverse-chi-squaredpriorforthevarianceparameterintheidealpointmodel.Thedefaultis1.nu0.sig2scalar.Thedegreesoffreedomoftheindependentscaledinverse-chi-squaredpriorforthevarianceparameterintheidealpointmodel.Thedefaultis400.s0.rho2scalar.Thescaleoftheindependentscaledinverse-chi-squaredpriorforthevariancesofthevillagerandominterceptsintheidealpointmodel.Thedefaultis1.nu0.rho2scalar.Thedegreesoffreedomoftheindependentscaledinverse-chi-squaredpriorforthevariancesofthevillagerandominterceptsintheidealpointmodel.Thedefaultis10.MCMCthenumberofiterationsforthesampler.Thedefaultis20000.burnthenumberofburn-initerationsforthesampler.Thedefaultis1000.thinthethinningintervalusedinthesimulation.Thedefaultis1. endorse7mhlogical.IfTRUE,theMetropolis-Hastingsalgorithmisusedtosamplethecutpointsintheresponsemodel.ThedefaultisTRUE.propapositivenumberoravectorconsistingofpositivenumbers.Thelengthofthevectorshouldbethesameasthenumberofquestions.ThisargumentsetsproposalvariancefortheMetropolis-Hastingsalgorithminsamplingthecutpointsoftheresponsemodel.Thedefaultis0.001.x.sdlogical.IfTRUE,thestandarddeviationoftheidealpointsineachdrawwillbestored.IfFALSE,asampleoftheidealpointswillbestored.NOTE:Becausestoringasampletakesanenormousamountofmemory,thisoptionshouldbeselectedonlyifthechainisthinnedheavilyorthedatahaveasmallnumberofobservations.tau.outlogical.Aswitchthatdetermineswhetherornottostorethecutpointsintheresponsemodel.ThedefaultisFALSE.s.outlogical.IfTRUE,thesupportparameterforeachrespondentandeachquestionwillbestored.ThedefaultisFALSE.NOTE:Becausestoringasampletakesanenormousamountofmemory,thisoptionshouldbeselectedonlyifthechainisthinnedheavilyorthedatahaveasmallnumberofobservations.omega2.outlogical.IfTRUE,thevariannceparameterofthesupportparametermodelwillbestored.ThedefaultisTRUE.phi2.outlogical.IfTRUE,thevariannceparameterofthemodelforthecoefcientsinthesupportparametermodelwillbestored.ThedefaultisTRUE.psi2.outlogical.IfTRUE,thevarianceofthevillagerandominterceptsinthesupportparametermodelwillbestored.ThedefaultisTRUE.verboselogical.AswitchthatdetermineswhetherornottoprinttheprogressofthechainandMetropolisacceptanceratiosforthecutpointsoftheresponsemodel.ThedefaultisTRUE.seed.storelogical.IfTRUE,theseedwillbestoredinordertoupdatethechainlater.ThedefaultisFALSE.updatelogical.IfTURE,thefunctionisruntoupdateachain.ThedefaultisFALSE.update.startlist.Ifthefunctionisruntoupdateachain,theoutputobjectofthepreviousrunshouldbesupplied.ThedefaultisNULL.DetailsThemodeltakesthefollowingform:ConsideranendorsementexperimentwherewewishtomeasurethelevelofsupportforKpoliticalactors.Inthesurvey,respondentsareaskedwhetherornottheysupporteachofJpolicieschosenbyresearchers.LetYijrepresentrespondenti'sanswertothesurveyquestionregardingpolicyj.SupposethattheresponsevariableYijistheorderedfactorvariabletakingoneofLjlevels,i.e.,Yij2f0;1;:::;Lj�1gwhereLj�1.WeassumethatagreatervalueofYijindicatesagreaterlevelofsupportforpolicyj.WedenoteanMdimensionalvectoroftheobservedcharacteristicsofrespondentibyZi.Intheexperiment,werandomlyassignoneofKpoliticalactorsasanendorsertorespondenti'squestionregardingpolicyjanddenotethistreatmentvariablebyTij2f0;1;:::;Kg.Weuse 8endorseTij=0torepresentthecontrolobservationswherenopoliticalendorsementisattachedtothequestion.Alternatively,onemayusetheendorsementbyaneutralactorasthecontrolgroup.Themodelfortheresponsevariable,Yij,isgivenby,Yij=liflYijl+1;YijjTij=kN(� j+ j(xi+sijk);I)wherel2f0;1;:::;Ljg;0=�11=02:::Lj=1. j'sareassumedtobepositive.Themodelforthesupportparameter,sijk,isgivenbyifTij6=0,sijkN(ZTijk;!2jk)withcovariates,andsijkN(jk;!2jk);withoutcovariates,forj=1;:::;J;k=1;:::;K,andifTij=0;sijk=0.The'sinthesupportparametermodelaremodeledinthefollowinghierarchicalmanner,jkN(k;k)fork=1;:::;K.Ifyousetidentical.lambda=FALSEandhierarchical=TRUE,themodelforsijkisifTij6=0,sijkN(0jk;village[i]+ZTijk;!2jk)and0jk;village[i]N(VTvillage[i]jk; 2jk)fork=1;:::;Kandj=1;:::;J.Inaddition,andaremodeledinthefollowinghierarchicalmanner,jkN(k;k)fork=1;:::;K,wherejk=(Tjk;Tjk)T.Ifyousetidentical.lambda=TRUEandhierarchical=TRUE,themodelforsijkisifTij6=0,sijkN(0k;village[i]+ZTik;!2k)and0k;village[i]N(VTvillage[i]k; 2k)fork=1;:::;K.Ifthecovariatesareincludedinthemodel,themodelfortheidealpointsisgivenbyxiN(ZTi;2x)fori=1;:::;Nwhere2xisaknownpriorvariance.Ifyousethierarchical=TRUE,themodelisxiN(0village[i]+ZTi;2) endorse9and0village[i]N(VTvillage[i];2)fork=1;:::;K.Finally,thefollowingindependentpriordistributionsareplacedonunknownparameters, jN( ;2 )forj=1;:::;J, jTN j�0( ;2 )forj=1;:::;J,N(;);kN(;)fork=1;:::;K,!2jkInv�2(0!;s0!)forj=1;:::;Jandk=1;:::;K,anddiag(k)Inv�2(0;s0)fork=1;:::;K,wherekisassumedtobeadiagonalmatrix.ValueAnobjectofclass"endorse",whichisalistcontainingthefollowingelements:betaan"mcmc"object.Asamplefromtheposteriordistributionof and .xIfx.sd=TRUE,avectorofthestandarddeviationoftheidealpointsineachdraw.Ifx.sd=FALSE,anmcmcobjectthatcontainsasamplefromtheposte-riordistributionoftheidealpoints.sIfs.out=TRUE,anmcmcobjectthatcontainsasamplefromtheposteriordistributionofsijk.Variablenamesare:s(observationid)(questionid).deltaIfcovariates=TRUE,anmcmcobjectthatcontainsasamplefromtheposte-riordistributionof.tauIftau.out=TRUE,anmcmcobjectthatcontainsasamplefromtheposteriordistributionof.lambdaanmcmcobject.Asamplefromtheposteriordistributionof.Variablenamesare:lambda(questionid)(groupid).(covariateid).thetaanmcmcobject.Asamplefromtheposteriordistributionof.kappaanmcmcobject.zetaanmcmcobject. 10endorseNotethattheposteriorsampleofallparametersareNOTstandardized.Inmakingposteriorinfer-ence,eachparametershouldbedividedbythestandarddeviationofx(inthedefaultsetting,itisgivenas"x")orby2(inthedefaultsetting,itisgivenas"sigma2").Alsonotethat andtheinterceptin(or,ifthemodelishierarchical,theinterceptin)arenotidentied.Instead,� + 0or,ifthemodelishierarchical,� + 0isidentiedaftereitheroftheabovestandardization,where0and0denotetheintercepts.Whenusingtheauxiliarydatafunctionality,thefollowingobjectsareincluded:auxlogicalvalueindicatingwhetherestimationincorporatesauxiliarymomentsnhintegercountofthenumberofauxiliarymomentsAuthor(s)Shiraito,Y.andImai,K.ReferencesBullock,Will,KosukeImai,andJacobN.Shapiro.(2011)“StatisticalAnalysisofEndorsementExperiments:MeasuringSupportforMilitantGroupsinPakistan,”PoliticalAnalysis,Vol.19,No.4(Autumn),pp.363-384.Examples##Notrun:data(pakistan)Ylist(Q1=c("Polio.a","Polio.b","Polio.c","Polio.d","Polio.e"),Q2=c("FCR.a","FCR.b","FCR.c","FCR.d","FCR.e"),Q3=c("Durand.a","Durand.b","Durand.c","Durand.d","Durand.e"),Q4=c("Curriculum.a","Curriculum.b","Curriculum.c","Curriculum.d","Curriculum.e"))##Varying-lambdanon-hierarchicalmodelwithoutcovariatesendorse.outendorse(Y=Y,data=pakistan,identical.lambda=FALSE,covariates=FALSE,hierarchical=FALSE)##Varying-lambdanon-hierarchicalmodelwithcovariatesindiv.covariatesformula(~female+rural)endorse.outendorse(Y=Y,data=pakistan,identical.lambda=FALSE,covariates=TRUE,formula.indiv=indiv.covariates,hierarchical=FALSE) endorse.plot11##Common-lambdanon-hierarchicalmodelwithcovariatesindiv.covariatesformula(~female+rural)endorse.outendorse(Y=Y,data=pakistan,identical.lambda=TRUE,covariates=TRUE,formula.indiv=indiv.covariates,hierarchical=FALSE)##Varying-lambdahierarchicalmodelwithoutcovariatesdiv.datadata.frame(division=sort(unique(pakistan$division)))div.formulaformula(~1)endorse.outendorse(Y=Y,data=pakistan,data.village=div.data,village="division",identical.lambda=FALSE,covariates=FALSE,hierarchical=TRUE,formula.village=div.formula)##Varying-lambdahierarchicalmodelwithcovariatesendorse.outendorse(Y=Y,data=pakistan,data.village=div.data,village="division",identical.lambda=FALSE,covariates=TRUE,formula.indiv=indiv.covariates,hierarchical=TRUE,formula.village=div.formula)##Common-lambdahierarchicalmodelwithoutcovariatesendorse.outendorse(Y=Y,data=pakistan,data.village=div.data,village="division",identical.lambda=TRUE,covariates=FALSE,hierarchical=TRUE,formula.village=div.formula)##Common-lambdahierarchicalmodelwithcovariatesendorse.outendorse(Y=Y,data=pakistan,data.village=div.data,village="division",identical.lambda=TRUE,covariates=TRUE,formula.indiv=indiv.covariates,hierarchical=TRUE,formula.village=div.formula)##End(Notrun) endorse.plotDescriptivePlotofEndorsementExperimentData DescriptionThisfunctioncreatesadescriptiveplotforaquestioninanendorsementexperiment.Usageendorse.plot(Y,data,scale,dk=98,ra=99,yaxis=NULL,col.seq=NA) 12GeoCountArgumentsYacharactervector.Listofthevariablenamesfortheresponsestoaquestion.Eachvariablenamecorrespondstoeachtreatmentstatus.datadataframecontainingthevariables.scaleaninteger.Thescaleoftheresponses.Thefunctionassumesthattheresponsesarecodedsothat1indicatesthelowestsupportwhiletheintegerspeciedinthisargumentrepresentsthehighestsupport.dkanintegerindicatingthevalueoftheresponsevariablethatistobeinterpretedas“Don'tKnow.”Defaultis98.raanintegerindicatingthevalueoftheresponsevariablethatistobeinterpretedas“Refused.”Defaultis99.yaxisacharactervectorofthesamelengthasY.Theargumentwillbeusedforthelabelofthehorizontalaxis.TheordershouldbethesameasY.col.seqavectorofcolorsforthebarsorbarcomponents.Bydefault,agradationofgraywherethedarkestindicatesthehighestsupportlevel.ValueAdescriptiveplotfortheresponsestoaquestion.Author(s)Shiraito,Y.andImai,K.Examples##Notrun:data(pakistan)Yc("Polio.a","Polio.b","Polio.c","Polio.d","Polio.e")yaxisc("Control","Kashmir","Afghan","Al-Qaida","Tanzeems")endorse.plot(Y=Y,data=pakistan,scale=5)##End(Notrun) GeoCountCountingIncidentsaroundPoints DescriptionThisfunctioncalculatesthenumberofincidents(e.g.,violentevents)withinaspecieddistancearoundspeciedpoints(e.g.,villages). GeoId13UsageGeoCount(x,y,distance,x.latitude="latitude",x.longitude="longitude",y.latitude="latitude",y.longitude="longitude")Argumentsxdataframecontainingthelongitudeandthelatitudeofpoints.ydataframecontainingthelongitudeandthelatitudeofincidents.distancenumeric.Thedistancefrompointsinkilometers.x.latitudecharacter.Thevariablenameforthelatitudeinx.x.longitudecharacter.Thevariablenameforthelongitudeinx.y.latitudecharacter.Thevariablenameforthelatitudeiny.y.longitudecharacter.Thevariablenameforthelongitudeiny.Author(s)Shiraito,Y. GeoIdGettingIndicesofIncidentsaroundaspeciedpoint DescriptionThisfunctionobtainstheindicesofincidentswithinaspecieddistancearoundaspeciedpoint.UsageGeoId(x,y,distance,x.latitude="latitude",x.longitude="longitude",y.latitude="latitude",y.longitude="longitude")Argumentsxdataframecontainingthelongitudeandthelatitudeofapoint.ydataframecontainingthelongitudeandthelatitudeofincidents.distancenumeric.Thedistancefromvillagesinkilometers.x.latitudecharacter.Thevariablenameforthelatitudeinx.x.longitudecharacter.Thevariablenameforthelongitudeinx.y.latitudecharacter.Thevariablenameforthelatitudeiny.y.longitudecharacter.Thevariablenameforthelongitudeiny. 14pakistanValueAvectorcontainingtheindicesofythatarewithindistancekilometersaroundthepointspeciedbyx.Iftherearemultipleobservationsinx,therstrowisusedasthepoint.Author(s)Shiraito,Y. pakistanPakistanSurveyExperimentonSupportforMilitantGroups DescriptionThisdatasetisasubsetofthedatafromtheendorsementexperimentconductedinPakistantostudysupportformilitantgroups.ThesurveywasimplementedbyFairetal.(2009).ItisalsousedbyBullocketal.(2011).Usagedata(pakistan)FormatAdataframecontaining5212observations.Thevariablesare:•division:divisionnumber.•edu:education.1if“illiterate”;2if“primary”;3if“middle”;4if“matric”;5if“intermediate(f.a/f.sc),”“graduate(b.a/b.sc.),”or“professionals(m.a/orotherprofessionaldegree).”•inc:approximatemonthlyincome.1iflessthan3000rupees;2if3000to10,000rupees;3if10,001to15,000rupees;4ifmorethan15,000rupees.•female:0ifmale;1iffemale•rural:0ifrural;1ifurban•Polio.a-e:supportforWorldHealthOrganization'splanofuniversalpoliovaccinationsinPakistan.5indicatesthehighestsupportwhile1indicatesthelowestsupport.•FCR.a-e:supportforthereformoftheFrontierCrimesRegulation(FCR)governingthetribalareas.5indicatesthehighestsupportwhile1indicatesthelowestsupport.•Durand.a-e:supportforusingpeacejirgastoresolvedisputesovertheAfghanborder,theDurandLine.5indicatesthehighestsupportwhile1indicatesthelowestsupport.•Curriculum.a-e:supportfortheGovernmentofPakistan'splanofcurriculumreformsinreligiousschoolsormadaris.5indicatesthehighestsupportwhile1indicatesthelowestsupport.Fortheresponsevariables,endorsersare:•varname.a:control(noendorsement). predict.endorse15•varname.b:PakistanimilitantgroupsinKashmir.•varname.c:MilitantsghtinginAfghanistan.•varname.d:Al-Qaida.•varname.e:FirqavaranaTanzeems.SourceBullock,Will,KosukeImai,andJacobN.Shapiro.2011.Replicationdatafor:Statisticalanalysisofendorsementexperiments:MeasuringsupportformilitantgroupsinPakistan.hdl:1902.1/14840.TheDataverseNetwork.ReferencesBullock,Will,KosukeImai,andJacobN.Shapiro.(2011)“StatisticalAnalysisofEndorsementExperiments:MeasuringSupportforMilitantGroupsinPakistan,”PoliticalAnalysis,Vol.19,No.4(Autumn),pp.363-384.Fair,ChristinC.,NeilMalhotra,andJacobN.Shapiro.(2009)“TheRootsofMilitancy:ExplainingSupportforPoliticalViolenceinPakistan,”WorkingPaper,PrincetonUniversity. predict.endorsePredictMethodfortheMeasurementModelofPoliticalSupport DescriptionFunctiontocalculatepredictionsfromameasurementmodelttedtoanendorsementexperimentdata.Usage##S3methodforclass'endorse'predict(object,newdata,type=c("prob.support","linear.s"),standardize=TRUE,...)Argumentsobjectattedobjectofclassinheritingfrom"endorse"newdataanoptionaldataframecontainingdatathatwillbeusedtomakepredictionsfrom.Ifomitted,thedatausedtottheregressionareused.typethetypeofpredictionrequired.Thedefaultisonthescaleofthepredictedprobabilityofpositivesupport;thealternative"linear.s"isonthescaleofsijk.standardizelogicalswitchindicatingifthepredictedvaluesonthescaleofsijkarestandard-izedsothatitsvarianceisone....furtherargumentstobepassedtoorfromothermethods. 16predict.endorseDetailspredict.endorseproducespredictedsupportforpoliticalactorsfromatted"endorse"object.Ifnewdataisomittedthepredictionsarebasedonthedateusedforthet.Settingtypespeciesthetypeofpredictions.Thedefaultis"prob.support",inwhichcasethefunctioncomputestheaveragepredictedprobabilityofpositivesupport:P(sijk�0jZi;j;!j)=ZTij !jforeachpoliticalgroupk.Iftypeissettobe"linear.s",theoutputisthepredictedmeanofsupportparameters:E(sijkjZi;j)=ZTij:IfthelogicalstandardizeisTRUE,thepredictedmeanofsupportisstandardizedbydividingby!j.ValueA"mcmc"objectforpredictedvalues.Author(s)Shiraito,Y.SeeAlsoendorseformodeltting IndexTopicdatasetpakistan,14endorse,2,16endorse.plot,11GeoCount,12GeoId,13pakistan,14predict.endorse,1517