asp net mvc show pdf in div : Break a pdf into parts software SDK project winforms wpf .net UWP oTree0-part1270

JournalofBehavioralandExperimentalFinance9(2016)88–97
ContentslistsavailableatScienceDirect
JournalofBehavioralandExperimentalFinance
journalhomepage:www.elsevier.com/locate/jbef
Fulllengtharticle
oTree—Anopen-sourceplatformforlaboratory,online,and
fieldexperiments
DanielL.Chen
a,b,
,MartinSchonger
a
,ChrisWickens
a
a
ToulouseSchoolofEconomics,InstituteforAdvancedStudies,21alléedeBrienne,31015Toulousecedex6,France
b
HarvardLawSchoolLaborandWorklifeProgram,8Mt.AuburnSt.,1stFloor,Cambridge,MA02138,USA
articl e e info
Articlehistory:
Received5August2015
Receivedinrevisedform21December2015
Accepted21December2015
Availableonline19January2016
JELclassification:
A20
C88
C90
Keywords:
Experimentaleconomics
Software
Laboratoryexperiments
Fieldexperiments
Onlineexperiments
Classroomexperiments
abstract
oTreeisanopen-sourceandonlinesoftwareforimplementinginteractiveexperimentsin
thelaboratory,online,thefieldorcombinationsthereof.oTreedoesnotrequireinstallation
ofsoftwareonsubjects’devices;itcanrunonanydevicethathasawebbrowser,bethat
adesktopcomputer,atabletorasmartphone.Deploymentcanbeinternet-basedwithout
asharedlocalnetwork,orlocal-network-basedevenwithoutinternetaccess.Forcoding,
Pythonisused,apopular,open-sourceprogramminglanguage.www.oTree.orgprovides
thesourcecode,alibraryofstandardgametemplatesanddemogameswhichcanbeplayed
byanyone.
©2016TheAuthors.PublishedbyElsevierB.V.ThisisanopenaccessarticleundertheCC
BY-NC-NDlicense(http://creativecommons.org/licenses/by-nc-nd/4.0/).
Experimental economics has s become e an n established
field.Thecommon procedureis to o conductincentivized
experimentsindedicateduniversitycomputerlabsusing
studentsassubjects.InthesesettingsFischbacher’sz-Tree
was and is s the dominant software e platform. z-Tree al-
lowstheinvestigationofstrategicinteractionusingdesk-
top computers running theWindows operating system.
Accordingto GoogleScholar,Fischbacher’sz-Tree(1999,
2007)hasbeenusedatleast4801times,whichisaproxy
forhowimportantapublicgoodFischbachercreated.
In homage e to o z-Tree our r platform is named oTree,1
wherethe‘‘o’’standsforopen-source,onlineandobject-
Corresponding author at:HarvardLaw School LaborandWorklife
Program,8Mt.AuburnSt.,1stFloor,Cambridge,MA02138,USA.
E-mailaddress:dchen@law.harvard.edu(D.L.Chen).
1
Thisfollowsthetraditionintheopensourcecommunityofnaming
open source e software projects after existing software. For example,
OpenOfficeisnamedafterMicrosoftOffice,LinuxisnamedafterUnix,and
MySQLisnamedaftermSQL.
oriented.Whyisanewsoftwareplatformevennecessary?
There are many y reasons, , including g these main three:
First,experimentaleconomicshasbeguntocomplement
laboratory experiments with h field experiments. . Field
settingsrangefromsportscardsshows(ListandLucking-
Reiley, 2000) to primary y schools s (Angerer et t al., , 2014)
to online labor r markets (Chen,2012) to o financial trade
fairs(Cohnetal.,2015).Thefieldprovidesexternalvalidity
andtapsasubjectpoolotherthanstudents.Itisdifficult
to take a a Windows-desktop networked environment to
fieldsettings.Thishasrequiredeitheradhocprogramming
solutionsandtherebyhinderedexperiments.Thesituation
for field experiments s is akin n to what t the e situation for
laboratoryexperimentswaspriortothereleaseofz-Tree.
Second, computing devices have e seen a a sea a change e in
thelastyears.Usagehasshiftedfromdesktopcomputers
to phones and tablet computers (Fig. 1). Graphics and
user interfaces s have e been revolutionized. This s calls s for
software that is platform-independent and d deployable
http://dx.doi.org/10.1016/j.jbef.2015.12.001
2214-6350/©2016TheAuthors.PublishedbyElsevierB.V.ThisisanopenaccessarticleundertheCCBY-NC-NDlicense(http://creativecommons.org/
licenses/by-nc-nd/4.0/).
Break a pdf into parts - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
break a pdf file into parts; add page break to pdf
Break a pdf into parts - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
pdf split file; break pdf documents
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
89
Fig.1. oTreeondifferentdevicesandoperatingsystems.
on thesedevices.Third,theprogrammingparadigm m has
shifted. It t is now w clear that t open-source and d industry-
standard compatible solutionsarea better fit t formany
scientificneeds.Experimentalsoftwareshoulduseexisting
industry-standards whereverpossible,beextensibleand
compatible withplug-insandallowusers toinspectthe
sourcecode.oTreeaddressesthesedesiderata.
oTreehasbeenusedinthelaboratorysettingwithover
athousandparticipantsinactualexperiments at labora-
toriesinZurich,Magdeburg,andHamburg.Papersusing
datagatheredbyoTreeinthelaboratorynowincludeChen
andSchonger (2014a,b)Chen (2015a,b). In addition to
thelaboratory,oTreehasalsobeenusedforexperiments
onAmazon’sMechanicalTurk.Thus,severalnewfeatures
havealready been successfully demonstrated: The flex-
ible and d easy implementation of graphical and experi-
mentalfeatures,suchasdifferentbackgroundcolorsand
randomizationofgraphicalelementsinthepresentation,
hasbeenshowntowork.Second,themobilityofthesetup
was shownby runningthesameorsimilarexperiments
acrossvariouslaboratories.Third,thesoftwareandhard-
warerequirementsofoTreewereshowntobeminimal.It
issufficienttohaveaninternetconnection(oralocalarea
network,botharenotnecessary).Thearchitectureenables
oTreetobeusedinalmostanyexperimentalscenario.
oTree is open-source, , licensed d under an adaptation
of the MIT license.We ask that peoplecite this paper
when using oTree for academic or other publications.
ThesourcecodeforoTreecanbedownloadedforfreeat
www.oTree.org.Contributions andimprovementstothe
source code are e welcome e and should be e submitted d via
GitHub.
1. Usage:lab,online,field,andclassroom
ThebasicexperimentalsetupinoTreeconsistsof(i)an
experimentwrittenwithinoTree,(ii)aservercomputer,
2
The MIT T license e is a a standard license e used d in the e open n source
community;oTreelicensinginformationisatoTree.org/license.
which can be a cloudserverora local laptopand (iii)
subjects’ devices witha web browser. oTree creates an
experimental session n on the server,as well as linksfor
all the participants s and the experimenter. . With h these
links, participants are sent t to individualized d web pages
displaying the experiment and recording theiranswers.
The experimenter accesses the Progress Monitor, where
real-timeinformationabouttheprogressandentriesofall
participantsisdisplayed.ThisarchitectureenablesoTreeto
beusedinalmostanyexperimentalscenario.Thesoftware
andhardwarerequirementsofthelaboratoryareminimal:
onlyaconnectiontotheserverandabrowserareneeded,
noothersoftwareneedstobeinstalled.Thereisa1-click
installerandgraphical launcher.Thearchitectureis also
robusttofailure;if,forexample,thereisahardwarefailure
on anything but t the e server, the link of that participant
orexperimenter canbe loadedimmediately y onanother
device.
Section2liststhemostusefuloTreefeatures.Thereare
manywaysinwhichoTreeisanimprovementoverexisting
instruments, many ofwhich might t only be appreciated
inactualusage.Aneasywayto getafirst feel foroTree
is to o play some games from the library of f dozens of
sample games. Not t only y is the code for r these sample
gamesavailable,butthesesamplesareonlineusingoTree’s
demo mode. . This means that t anyone can play them at
any time using a webbrowserwithout any installation
whatsoever.Thelibraryofsamplegamescanbefoundat
http://demo.otree.org.Oneexampleofasamplegameis
ourimplementationofBasu(1994)’s traveler’sdilemma.
Thisgamecanbeplayedonlineindemomodebyvisiting
thedemo pageofthewebsiteandclickingonTraveler’s
Dilemma.Onthatstartpagetherearetwostartlinks,one
foreachofthetwoplayersinthatgame.Onecanplayboth
playersusingdifferenttabsinabrowser,oropenthelinks
ondifferentdevices.
Section3elaboratesonprogramminginoTree.Almost
any graphical or design n feature e can be implemented
C# TWAIN - Install, Deploy and Distribute XImage.Twain Control
how to install XImage.Twain into visual studio RasterEdge.XDoc.PDF.dll. device. TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE
split pdf into individual pages; break apart pdf
C# TWAIN - Specify Size and Location to Scan
C# TWAIN image scanning size and location contains two parts. if (frame == TwainStaticFrameSizeType.LetterUS) { this.device.FrameSize = frame; break; } } }.
break apart a pdf file; break up pdf into individual pages
90
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
(i.e., visual l styles, , animations, dynamic c adaptation n to
screen sizes, and d multimedia). . oTree’s s user r interface e is
based on HTML5, which is supported in all modern
browsersandisfamiliartoeverywebdeveloperandde-
signer.TheprogramminglanguageusedinoTreeisPython,
aneasy-to-learn modern object-oriented computerlan-
guagewidelyusedinscienceforanalysisandmodeling.
Hence,many researchers already possess the necessary
programmingskillstouseoTree,andwillrequirelittletime
tolearntouseoTreeefficientlyandtoimplementexperi-
ments.oTreeiseasytouse,andevencomplexexperiments
arereasonablyeasytoprogrambytakingadvantageofthe
capabilitiesofPython.
oTreeisbasedontheDjangowebapplicationframe-
work;oTreeapplicationsarewebapplications.OnceoTree
isinstalledonawebserver,applicationscanbeplayedin-
stantlyfromanywebbrowserbyopeningthegame’sURL,
andexperimenterscanlogintotheadmindashboardfrom
anywheretomonitortheexperiment.oTreeworksonany
devicewithamodernwebbrowser,whetheritisadesk-
top,tablet,orsmartphone.Itworksonallmajoroperating
systems,includingWindows,MacOSX,iOS,Android,and
Linux.Theuserinterfaceautomaticallyadjuststotheap-
propriatescreenresolution,eliminatingtheneedforevery
applicationtohaveseparatedesignsfordesktopandmo-
bileplatforms.
oTreeisbuilttolast.Thesourcecodeishighlyorganized
and follows best practices, allowing g for r easy further
developmentandextension.Featuresareaddedsparingly
andwiththoughttolong-termneeds.Itisalsorobustto
changesinthemarketshareofvarioustechnologies.Some
softwaretool setsrequireaparticularsoftwareprogram
torunontheclientmachine,suchasWindows,Java,or
Flash. These tool l sets risk becoming obsoletewhen n the
marketshareofthatplatformdeclines.Incontrast,oTree
onlyrequiresawebbrowserontheclients’devices.
1.1. Dedicatedoradhoclaboratories
ResearchersusingoTreedonotrequirededicatedex-
perimentallaboratories; they canuse existingcomputer
laboratories orrely on tablets. Sincetouchinput works
with oTree, tablets can be e used without external key-
boards,ifdesired.oTreecanberunonlow-costdevices
suchas commodity tablets andmobiledevices,thereby
reducinghardwarecosts.Severaldozentabletscanbeeas-
ilytransportedtoanyspaceabletoaccommodatethepar-
ticipants(such as aclassroom m ormeetingroom)andbe
setupas atemporary laboratory. Anotheradvantage of
notrequiringadesktopoperatingsystemislesstimeand
moneyspentonmaintenanceandadministration.Desktop
operatingsystemsoffergreatflexibility,buttheyalsore-
quireinvestmentsinITtaskssuchassoftwareinstallation
(e.g.,applications,drivers,anti-virus,andupdatesthereof)
andconfiguration(e.g.,securitypermissionsandnetwork-
ing).Incontrast,tabletsandmobileoperatingsystemstend
torequirelessadministration,andcanoftenrun‘‘outofthe
box’’withminimal configuration.oTreeanditsgraphical
launchercanbeinstalledinoneclick.
1.2. Online
oTreeexperimentscanbeconductedonline.Theexperi-
menterprovideseachparticipantauniquestartURL.These
URLscontainarandomalphanumericcodesoevenifpar-
ticipantscommunicatedwithoneanother,thelinkwould
notallowparticipantstodeducetheidentityofplayersin
aparticularmatch.Thereisnosetlimitonthenumberof
simultaneousparticipants,thuslarge-scalemarketexper-
imentsarefeasible.Asisthecaseforwebsitesingeneral,
runninganexperimentwithmanyusersrequiresaserver
withsufficientresources(processor,RAM,anddatabase).
Totestwhetherhardwareresourcesaresufficientandfast
enough,werecommendtestingthesetupwithbots(see
Section2).Sincethecodeofexperiments(thoughpresum-
ablynotalltheinstructionsandpayouts)needsnochange
betweenonlineandlaboratorysettings,runninganexper-
imentonlinecancomplementrunningitinthelab.Itcan
serveasaninitialsettingforalow-costpilotandenable
authorstosecurefundingforamoreexpensivelabexper-
iment.Itcouldalsobeasettingforapre-publicationrepli-
cation,apracticesuggestedbyGelmanandLoken(2014).
Besides low costs, another advantage e of f online e experi-
mentsisthattheyaremorescalableintermsofparticipant
numbers.Itisevenpossibletorunshortexperimentswith
manyparticipants.Thisislikelyanadvantageoverusing
alabwhererecruitmentoflargenumbersofparticipants
canbechallengingduetothehighfixedopportunitycost
ofreachingthelaboratorysite.AmazonMechanicalTurk
(AMT)isapopularplatform
3
forconductingonlineexper-
iments,andthusoTreeintegrateswiththeAMTpayment
system.
1.3. Field
Fieldexperimentsareofcrucialimportancetoanswer
certain questions andcan serve as small-scale tests for
policy makers (Carpenter2005Gneezy and Rustichini,
2000).Both laboratoryandfieldexperimentshavetheir
advantagesandshortcomings(LevittandList,2007),but
fieldexperimentscanserveasbridgesbetweenlaboratory
dataandnaturally-occurringdata(LevittandList,2009).
Thefieldprovidesexternalvalidityandtapsasubject
poolotherthanstudents.ItisdifficulttotakeaWindows-
desktop networked environment t to field d settings. . This
hasrequiredeitheradhocprogrammingsolutionsorhas
limited the e range e of field d experiments. . If a a researcher
uses existing computers s in n the field, no administration
rights are necessary y on them. In laboratory y and many
fieldsettings,onewillwanttopreventparticipantsfrom
using the provideddevices forpurposesother than the
experiment.Thus,itisusefultolockdownthedevicesto
awebbrowserkioskmode,meaningthatausercannot
openotherwebpagesorleavethebrowserwithoutthe
kioskpassword.InternetExplorer,Chrome,andFirefoxall
havebuilt-inkioskmodes.Eveninkioskmode,ittypically
couldbeaproblemifauserpressesthebrowser’sreloador
backbuttonorthekeyboardshortcuts.InoTree,theseuser
3
SeeHortonetal.(2011)andMasonandSuri(2012).
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
91
actionssimplyresultinaredisplayofthecurrentpagein
theexperiment.
oTreecanbeusedinfieldsettingsandsubjectscanuse
theirownsmartphonesortablets.Anotherapproachisto
havearollingsuitcasefulloftablets.Inthisway,onecanset
uptemporarylaboratoriestoconductartefactualfieldex-
periments.Henrichetal.(2010)cautionedthatthepartici-
pantpoolinuniversitylaboratoriesisusually‘‘WEIRD’’—
Western,Educated,Industrialized,Rich,andDemocratic.
WithoTreeitbecomeseasytosetuptemporarylaborato-
riesinfieldsettingswherenon-studentsubjectsareeasier
torecruit.
For some research questions, it t is s difficult to o gather
enough data in n a a laboratory y setting. . Behavioral l experi-
mentsthatgobeyondexistenceofatreatmenteffectcan
requirehundredstothousandsofsubjects.Obtaininglarge
numbersofparticipantsisespeciallydifficultandcostlyif
theexperimentisshort.WithoTree,ateamofresearchas-
sistantscantakeasuitcasewith40tabletstoahighschool,
acorporation,atradefair,atrainstation,oranairportand
recruitconveniencesamplesofhundredsofsubjectsina
singleday.
1.4. Hybridsettings
Experimentscan be run in multiple labs in different
partsoftheworldsimultaneouslyandparticipantsneed
notbeatthesamelocationtointeractwitheachother.In
someexperiments–suchasthoseinvestigatingtheeffect
ofbeautyonpeereffectsandteamwork–itisnecessary
toshowaplayerthefaceofthecounterpart.Toeliminate
unobservedpost-gameinteraction,thecounterpartisina
labinadifferentcity.ForoTree,thisisnomorecomplicated
thanitwouldbeifthetwoplayerswereinthesameroom.
1.5. Classroom
Manysocialscientistsletstudentsplaygamestoteach
them game theory and d mechanism m design.
4
oTree can
makelecturesmorevividbyhavingstudentsplaygames
duringclassandhomework moreplayful butalso more
easilymonitored.Dynamicgraphics(seeSection2)canbe
projectedintheclassroomenablingdiscussionofthegame
played. The connection to o the server r occurs seamlessly
viatheinternet,sostudentscanusetheclassroomWiFi,
mobile cell coverage, or their r home e ISP. Mazur (2009)
suggeststo‘‘fliptheclassroom’’,whichrequireshardware-
orsoftware-basedclickers.oTreecanbeasoftware-based,
freeclicker,anditiseasytoaddfunctionalitythatgoesfar
beyondthatoftraditionalclickers.
To useoTreeintheclassroom,itiseasiesttousethe
demomodediscussedinSection2.Regardlessofwhether
thedemomodeortheregularsessionmodeisused,each
student is given a a unique URL L at the e beginning g of the
lecture or the course. . The e teacher r can n use e the e session
interfacetoprojectresultsintheclassroom,andopenthe
progressmonitoronadifferentmachinetoprivatelycheck
howstudentsaredoing.
4
SeeforexampleRubinstein’s(1999)recommendations.
2. Features
oTree experiments s are e web pages s using the e HTML5
standard.Tomakeiteasytoprogram visuallyappealing
experiments, oTree uses the open n source e web front-
end framework, Bootstrap.For details,seeSection 3on
programming.Sinceexperimentsarewebpages,allthat
isneededonparticipants’andtheexperimenters’devices
isawebbrowser.Oneachdevice,oneopensaURLthatis
uniquetotherespectiveparticipantandsession.
Paper-liketreatment-specificinstructions:Manyex-
perimenters hand d out instructions s on n paper, even n in
computer-basedlaborartefactualfieldexperiments.oTree
providesinstructionsthathaveapaper-likelook(Fig.2).
Typically,theywillbedisplayedbythemselvesonanin-
troductoryscreen,andthenredisplayedatthebottomof
allsubsequentscreens,afactwhichshouldbepointedout
inthelastsentenceoftheinstructions.Tominimizeexper-
imenterdemanditisdesirabletohidefromsubjectswhich
treatmentgroupsanddimensionsexist,whichismadeeas-
ierbyon-screeninstructions.
5
AMT integration: oTree provides integration with
Amazon Mechanical Turk (AMT). . oTree e authenticates
users visiting from the AMT service, and then sends
payments to o the e correct AMT account. Researchers can
now publish experiments and send payments s directly
to AMT. . Researchers, however, must t have an employer
accountwithAMT,whichcurrentlyrequiresaUSaddress
andbankaccount.
Debuginfo:Anyapplicationcanberunsothatdebug
information is displayed on the e bottom m of f all screens
(seeFig.2).The debuginformationconsists oftheID in
group, the group, the player, the participant t label, , and
thesessioncode.The sessioncodeandparticipantlabel
aretworandomlygeneratedalphanumericcodesuniquely
identifying the sessionandparticipant.The ID in group
identifiestheroleoftheplayer(e.g.,inaprincipal–agent
game,principalsmighthavetheIDingroup1,whileagents
have2).
Testingwithbots:Abotisanartificialplayerexecuting
a pre-determined strategy. The strategy canbepure or
mixed.Forexample,to stress testexperiments,devices,
orservers,botscanbeprogrammedtomakerandombut
validentries.Testswithhundredsofbotsarecompleted
withinsecondsandarethusabletotestifeverythingwas
programmed correctly. Sometimes s programmers might
also discover errors s in n the e logic c or the e economics s of
theirgame (e.g.,negativepayoffs that might violatelab
rulesorparticipationconstraints).AxelrodandHamilton
(1981)invitedsubmissionsofstrategiestoplayacomputer
tournamentofa repeatedPrisoners’Dilemma. In oTree,
suchanexercisebecomeseasy:eachsubmittedstrategy
correspondstoaparticularlyprogrammedbot.Thenbots
are instantiated d in the next round according to their
payoffsinthepreviousround.Abotcanalsobeusedfor
communicationandteachingpurposes.Ratherthanhaving
5
Onexperimenterdemandandnon-deceptiveobfuscationseeZizzo
(2010)andBardsleyetal.(2010), fn.39.
92
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
Fig.2. Participantscreen.
Fig.3. Progressmonitor.
astudentorreaderplayalltheplayersinann-playergame,
n
1botsmightbeused,andthenthplayerwouldbethe
human.
Progressmonitor:Theprogressmonitor(Fig.3)allows
theresearchertomonitortheprogressofanexperiment.
It featuresa display thatcan be filteredand d sorted,for
examplebycomputernameorgroup.Theexperimenter
can see the progress of all participants, the current
action a participant t is s taking, and decisions made by
participants.Updates are shown as they happen inreal
time and cells that change are e highlighted d in yellow.
Because the progress monitor is web-based, , multiple
collaboratorscansimultaneouslyopenitonseveraldevices
onpremisesoratremotelocations.Theadmindashboard
isautomaticallygeneratedforeachexperiment.Columns
includedare: the participant ID (the computernumber
in a laboratory y setting), , the participant code (a short
alphabeticcodeuniquelyidentifyingtheparticipant),and
thecurrentearningsoftheparticipant.Fig.3displaysa
principal–agentgame.
Session interface:While the progress monitorexists
in all l oTree experiments, , thesession interface is anop-
tional featurethatis convenienttohaveinsomeexper-
iments.Inmany experimental settings,inadditiontoan
experimentermonitoringprogressforwhichtheprogress
monitorisintended,anexperimenterneedstoreceivein-
structionsorprovide inputfortheexperiment.Theses-
sioninterfacecaninstructanexperimenteronwhattodo
nextandshowtexttobereadaloud.Anearlierversionof
oTreesupportedadditionalformsofexperimenterinput.
Thesessioninterfacecanalsorequestinputfromtheex-
perimenterataspecificpointinthesession.Forexample,
inanEllsbergexperiment,theexperimentermightfillan
opaqueurnpriortothesession;thesessioninterfacewill
remindtheexperimentertoshowtheurnto thepartici-
pants,andtelltheexperimenterwhenallparticipantshave
selectedtheirbetsandinstructtheexperimentertodrawa
ballfromtheurn.Itwillthenaskthecolorthatwasdrawn,
sothatoTreecancalculateparticipants’payoffs.
PaymentsPDF:Inalabsession,dozensofparticipants
must bepaidinashortamountoftimeaftertheendof
asession.Tominimizewaitingtimes forsubjects,oTree
automatically generatesaPDFwiththeearningsofeach
participant as soon as the earnings-relevant part t of f a
sessionisover(usuallybeforeanexitquestionnaire)(see
Fig.4).
Demo mode: Experiments can n be e put online using
the demo modewhichcreatesawebpagewithastatic
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
93
Fig.4. PaymentsPDF.
URL.Anyvisitortothatwebpagecanplaythegame.For
example,foranUltimatumGame,thatwebpagewould
havetwoparticipant links,oneforproposerandonefor
responder.Wheneversomeonenewvisitsthestaticdemo
URLofthegame,anewsessionisinstantiatedmeaningthat
newparticipantURLsarecreated.Ifthegamehasastudy-
interfaceanewURLforthatisalsocreated.Thedemomode
makesitpossibletoeasilyshareagamewithcolleagues,
referees, and other readers. For example, we use it for
ourcollection ofsamplegames.Notonlyisthe codeof
thesegamesavailable,butonecanalsoplaythematany
timeonline:demo.otree.org.Usingbots,evenmulti-player
games can be put t online e as supplementary, interactive
material.
User input and d validation: oTree supports s all l the
standardinputforms,suchasradiobuttons,checkboxes,
drop-down menus, numerical entry, free text entry,
date/currencyinput,email,fileupload,andimagefields.
Tosimplifyusageofinputforms,oTreereliesonDjango,
awidely usedPythonwebapplicationframework.Some
customformwidgets,suchasLikertscales,gobeyondwhat
Djangooffersbydefault,butareincludedinoTree.oTree
usersarenotlimitedtowhatDjangooroTreeincludes,and
cancreatetheirowninputforms.Fig.5givesexamplesof
inputformsavailable.
If a participant does not t fill out a a required form m or
submits an invalid value, the form is automatically re-
displayed,highlightingandexplainingtheuser’serror.The
experimentercanspecify what answersarevalid.Inthe
caseofanumericinputfield,theexperimentercould,for
example,specify that onlynumbers that are a negative
oddintegersbetween
51and
1shouldbevalid.Among
validanswers,theremaybesomethatarebetterormore
rational than others, but t the user can proceed d with a
chosenanswerandisnotheldbackonthatpage.Validation
isonlyintendedforcaseswheretheexperimenterwantsto
preventtheparticipantfromproceedingwithoutmaking
ananswersatisfyingsomespecifiedcriteria.
Auto-advancingparticipants:Sometimesasinglepar-
ticipantholdsupanentireexperiment.Theexperimenter
canforcethatparticipanttothenextpagebypressingthe
auto advancebutton.Thisfunctionalityisalsousefulfor
debuggingordemonstrationpurposes.
Customizablerandomization andmatching:Partici-
pantsinasessionareusuallypartitionedintogroups.First,
therearetreatmentgroupsthatallowparticipantsplaying
concurrentlytobeexposedtodifferentexperimentalpa-
rameters.Second,therearematchgroups,whicharefor
experimentsthatinvolveinteractionbetweentwoormore
participants (like a prisoner’s dilemma or public c goods
game).Ifagameistobeplayedformultiplerounds,par-
ticipantscaneitherplaywiththesamepartnersorwith
newpartners.Withinamatchparticipantsmayhavedif-
ferentrolessuchasprincipalandagent.oTreehandlesthis
byamatrixmodel,whereeachcellcorrespondstoapar-
ticipant,andtherowsaregroups,whilethecolumnsare
roles.Playerscanbegroupedrandomlyorbyarrivalorder.
Dynamicgraphics: Inmany y experiments it is useful
to have e visual content created and updated during the
experiment.Inamarketgame,forexample,participants
couldbeshownagraphicdepictingtheevolutionofprices.
Forthispurpose,oTreeintegratesHighCharts,aJavaScript-
basedservice.Fig.6isascreenshotofplayers’pointsafter
roundsixofa50-roundgame.Othergraphicalcapabilities
areillustratedatwww.highcharts.com.
94
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
Fig.5. oTreeonsmartphone.
Fig.6. Dynamicgraphics.
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
95
Sample games: oTree e includes a library y of f dozens
of standard economics games. To o see these games and
playthem,gotohttp://demo.otree.org.Incidentally,these
gamesareputonlineusingoTree’sdemomode.
Researcherscanusethecodeofthesesamplegamesas
templatesfortheirowngames.Thosewhoaredeveloping
completelynewgamesarealsoencouragedtoreviewthe
samplegamestolearnaboutrecommendedcodingstyles.
Authors are e invited d to send their codes, which will be
addedtoourlibrary.
Localization: Of f course, , oTree e applications can be
translated to o multiple e languages s and oTree has multi-
plefeaturesto easetranslationandlocalization.Asingle
switchcontrolsthelanguageinwhichtheapplicationis
currentlydisplayed.Thisisusefulinmanyscenarios.For
example,an experimentercan deploy the sameexperi-
mentintheUS,Germany,andChinawithallparticipants
readingintheirnativetongue.Or,onecandeployanex-
perimentinGermanbutsendEnglish-speakingcolleagues
ademolinkinEnglishandpublishEnglishscreenshotsin
apaperreportingtheexperiment.oTreeisabletodisplay
monetaryamountsinvariouscurrencyformats(compare
Fig.2).Inadditiontovariouscurrencies,thegamesmay
alsobeplayedforpoints.
Dataexport:Alldatainanexperimentissavedtothe
server.Datafromsubsequentsessionsisappended.Atany
pointintimethedatacanbedownloadedinstandardCSV
formatusingawebinterface.Inadditiontoparticipants’
choicesandanswers,thedatarecordedincludesthedate
andtimeaparticipantfirstaccessestheexperiment,time
spentoneachpage,thedevice’sIPaddress,andthecurrent
pageofeachparticipantorwhetherheorsheisfinished.
Data auto-documentation: : oTree auto-generates
human-readable documentation n from m the application’s
code.Itgivesthenameanddatatype(e.g.,positiveinteger,
string)ofallvariables.Ifthevariablecantakealistofspe-
cificvalue,thedocumentationwillprintthatlistshowing
boththeinternalnameandthedisplayednamethatthe
participantsees.Asmostprogrammerscommentintheir
code,oTreeintelligentlyextractsthesecommentsandadds
themtothedocumentation.
Open source:Sonnenburg et al. (2007) have argued
thatinscientificapplications,thesourcecodeshouldbe
available for inspection and available free of charge e to
enable replication and extension. Janssen et al. (2014)
pointoutthatbinarysoftwarecannotbecheckedbypeople
otherthanthesoftwareauthors.LernerandTirole(2005)
arguethat open-sourcesoftwarewillgrowstrongly,and
that academic economists couldboth learn and d benefit
from the model. . Thus s oTree is s open source, meaning
that the e source code e is freely y available e and anyone
can add to it t subject to o our r open-source license terms
(http://www.otree.org/license).TodevelopoTree,weuse
GitHub,awebservicefamiliartomostprogrammerswhich
hostsmanyopen-sourceprojectsandofferssourcecode
managementanddistributedrevisioncontrol.Researchers
canalso use the oTree spaceonGitHubto deposit their
applications in additionto doing so at journal archives.
Thisenablesfutureresearcherstofindnumerousprograms
andbuildonthem.Eachtimeanexperimentis run,the
serverrecordswhatversionofthecodewasusedtorun
theexperiment. Every versionofoTree is archived, and
aprogrammercanreverttoanoldversionusingtheGit
versioncontrolsystem.
3. Technologyandprogramming
ThissectiongivesanoverviewoftheoTreearchitecture
andprogramming.Fordetails,andtogetstarted,consult
the website, oTree.org, , download d the source e code e that
comeswithdozensofsamplegames,andconsultthewiki
atdocs.otree.org.oTree’sprogrammingmodelfollowsthe
Model-View-ControllerapproachasdiscussedinLeffand
Rayfield(2001)forthespecific caseofwebapplications.
The controllerresides s in n the core of oTree. Each oTree
application consists of a models.py y file, , a views.py y file
and several l html-templates—one e for r each screen. . The
models.py file e defines s the players, , variables, and their
datatypes;definesthevalidationlogic;andspecifiesthe
arithmeticoperationstobeperformed.Theviewisgiven
bytheviews.pyfileandthehtml-templates.Theviews.py
file defines s the sequence of pages s a a participant t sees,
referencesthetemplatestobeused,andwhichvariables
areinsertedintothetemplates.
3.1. SkillsrequiredtoprograminoTree
oTreeisbasedonPython,awidelyusedprogramming
languagethatisavailableasopen-sourcesoftwarefromthe
PythonSoftwareFoundation.Pythonisoftenthefirstlan-
guagetaughtinintroductorycomputersciencescourses.6
LearningPythonmightbeagoodinvestmentforempiri-
calandexperimentalresearchersasitisusefulnotonlyfor
oTree,butformanytaskssuchasautomaticdataextraction
andweb-scraping.oTreeisdesignedtobesimpleandtobe
accessibletopeoplewithbasicprogrammingexperience.
ResearcherswhoprefertohireaprogrammerforoTree,
ratherthancode themselves,should hire someonewho
knowsPython.For bestresults,theprogrammershould
alsobefamiliarwithDjango,whichisthemostpopular
Python-basedwebdevelopment framework.Aprogram-
merfamiliarwithPythonandDjangocanbeproductivein
oTreealmostimmediatelyandprogramhis/herfirstexper-
imentwithinhours.
3.2. Hardwarerequirements
Theonlyrequirementonparticipants’computersisa
webbrowsercapableofHTML5.Anythingthatworksin
HTML5canbeincludedinoTree,forexamplehyperlinks,
dialog boxes, tables, images, , audio, , and video. . Video
recordingisstillexperimentalinHTML5.JavaScript,Java,
and Flash are supported by oTree, but t programmers
should be aware of the e limitations s operating g systems
impose(e.g.,Flashdoes notrunoniOS devices).A good
recommendation for r oTree experiments – – and d for r any
website–istouseJavaScriptifnecessary,butnotJavaor
6
http://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-
the-most-popular-introductory-teaching-language-at-top-us-
universities/fulltext.
96
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
Fig.7. oTreecode.
Flash.Computerrequirementsfor the serverdependon
thenumberofparticipants andtheexperiment;oftena
standardlaptopwillsuffice.Ifreliableinternetisavailable,
theeasiestsolutionisoftentorentaserverinthecloud.
Suchserverscanberentedflexiblyforashorttime.This
makes particularly goodsense if the experiment t is s run
onlineorhashighdemandsintermsofgraphics.Priorto
anexperimentalsession,itisadvisabletotesttheserver
usingbots;usemorebotsthanthemaximumnumberof
subjectsplannedforthesessiontobeonthesafeside.
3.3. Front-end
Since working directly with HTML5 for the user in-
terface canbe cumbersome,oTreeusesa free,standard
front-endframeworkforwebsitescalledBootstrap.
7
Boot-
straporiginatesfromTwitter,aprivatecorporation,buthas
sincebeenreleasedasopensourceandbecomeubiquitous.
Thus, oTree users benefit t from thecontinuous develop-
mentofBootstrapindependentlyofanyupdatestooTree
itself.AllstandardHTML5elementscanbebeautifullyand
easilyimplementedinoTreethankstoBootstrap.But,per-
hapsmostimportantly,Bootstrapintelligentlyscalesthe
layoutofawebsiteincludingbuttons,tables,alerts,error
messages,andmenustodifferentscreenanddevicesizes.
Bydefault,oTreehasaneutrallayoutbutexperimenters
canchangethestylebyusingcascadingstylesheets(CSS).
3.4. Simplecode
oTree’scodeisremarkablysimpleasitbuildsonPython.
Comparedtoz-Tree,oTree islessspecificallytailoredto
someexperiments butarguably moregeneral.Inz-Tree,
users spendconsiderable time andeffort t implementing
solutionstoproblemsthathavenowbecomeeasyusing
modern programminglanguages. To o giveanidea a ofthe
simplicity ofoTree, consider r the standard experimental
requirement ofplaying arandom subset of rounds ina
game withmany rounds,the code forthis is shown in
Fig.7.
8
3.5. Programmingassistance
oTreeworks withstandardcode editors suchas Py-
Charm.Acodeeditormakesprogrammingeasierbypro-
vidingliveerrorchecking,syntaxhighlighting,interactive
debugging (to test the effect of each line of code), and
codereorganizationfunctionalities(suchastheabilityto
7
www.getbootstrap.com.
8
Tosolvethisprobleminz-Treeoneneedsalistoftraversalalgorithms
resultinginabout25linesofcode,compareBausch(2012).
9
PyCharmhasafreelicenseforclassroomuse.
easilyrenameavariable).oTreeintegrateswiththeauto-
completefunctionalityofPyCharm.Suggestionsofvariable
namesarepresentedascodeistyped.IfoTreeencounters
anerrorduringexecution,anerrorpagepinpointingthe
sourceoftheerrorisshown.
3.6. Collaborativedevelopment
oTree is developed using Git,a source-codeversion-
ing system. This encourages good backup and version-
ingpractices,andallowsdeveloperstosynchronizefiles
acrosscomputers,developcollaboratively,managesepa-
ratebranches,andmergesynchronizationconflicts.Wein-
viteotherresearcherstojoinusonGitHub,butthisisnot
arequirementforusingoTree.
4. Conclusion
oTree is an open-source, online,and object-oriented
softwareplatformforimplementingsocialscienceexper-
imentsinthelaboratory,online,inthefield,orcombina-
tionsthereof.oTreeisoperating-systemindependentand
deployableonanydevicethathasawebbrowser,includ-
ingtablets andsmartphones.Theservercanbeanordi-
narylaptop.OnceoTreeisinstalledonthatonemachine,
no furtherinstallationisnecessaryonparticipants’com-
putersandexperimentscanbestartedinstantlyfromany
webbrowserbyopeningthegame’sURL.Experimenters
canlogintotheweb-basedprogressmonitortomonitor
theexperiment.Thisflexibilityallowsforsubstantialcost
savingsinlaboratoryhardwareandmaintenance,andalso
makesiteasierforresearcherstorecruitlargenumbersor
particularkindsofsubjectsinadhoclaboratory orfield
settings.Using asinglesoftwareforbothonlineandlab
experimentsmakeslifeeasierforresearchers.Researchers
withlimitedfundscanfirstruntheirexperimentonline
(whereparticipationfeesaremeasuredincentsorsingle
digits)andthen–armedwiththedataandresults–ei-
therraisemorefundsordecidetoabandontheprojectas
unpromising.Runningthesameexperiment inbothon-
lineandlabsettingsalsotestsfortherobustnessofresults
andmaysupporttheexternalvalidityofresults.oTreeen-
ablesaquickandeasyreplicationofresearchresultsatlow
cost.WehopethatoTreewillindirectlycontributetofos-
teringtransparencyandreplicationintheexperimentalso-
cialsciences.Thedemomodeallowsanyresearcher,ref-
eree,orstudentto understandany experimenteasilyby
simplyplayingthegameinabrowser.Furthermore,the
demomodecanbeusedtoquicklyrunanddemonstrate
gamesintheclassroom.oTreeisbasedonasequenceof
pages,eachcontaininganoptionalformfortheparticipant
tofilloutandsubmit.Thisinteractivemodeldoesnotsuit
everyusecase.Itisnotreal-time,inthesensethattheuser
interfacedoesnotrespondwithinmillisecondstoactions
fromotherparticipants,ConG(Pettitetal.,2014)wouldbe
D.L.Chenetal./JournalofBehavioralandExperimentalFinance9(2016)88–97
97
moresuitablehere.Scientificadvancesareoftendrivenby
theavailabilityofnewandcheaperscientificinstruments—
oTreeaimstobesuchaninstrument.
Acknowledgments
ForcommentsontheoTreesoftwareorthepaper,we
thank the e people at the experimental econ laboratories
in Magdeburg, Hamburg and ETH Zurich, Juan Cabral,
DonjaDarai,SomDatye,GregorMuellegger,KellyReeve,
AlexanderSandukovskiy,andStefanWehrli.StefanBucher
providedsuperbresearchassistance.
References
Angerer, S., Glätzle-Rützler, D., Lergetporer, P., Sutter, M., 2014.
Third-partypunishmentincreasescooperationinchildrenthrough
(misaligned)expectations andconditional cooperation. Proc. Natl.
Acad.Sci.111,6916–6921.
Axelrod, R., Hamilton,W.,1981.Theevolutionof cooperation.Science
211,1390–1396.
Bardsley, N., Cubitt, R., , Loomes, G., , Moffatt, P., Starmer, C., , Sugden,
R.,2010. ExperimentalEconomics: RethinkingtheRules.Princeton
UniversityPress.
Basu,K.,1994.Thetraveler’sdilemma:Paradoxesofrationalityingame
theory.Amer.Econ.Rev.84,391–395.
Bausch,A.W.,2012.Introductiontoz-Tree:Day3.https://files.nyu.edu/
awb257/public/slides/Bausch-ztreeslides3.pdf.
Carpenter,J.P.,2005.Endogenoussocialpreferences.Rev.RadicalPolitical
Econ.37,63–84.
Chen,D.L., 2012.MarketsandMorality:HowDoes CompetitionAffect
MoralJudgment?WorkingPaper,DukeUniversitySchoolofLaw.
Chen, D.L., Schonger, M., , 2014a. . Social Preferences or SacredValues?
TheoryandEvidenceofDeontologicalMotivations.WorkingPaper,
ETHZurich.
Chen, D.L., Schonger, M., 2014b. ATheory of Experiments: Invariance
of Equilibrium to theStrategy MethodandImplications forSocial
Preferences.WorkingPaper,ETHZurich.Mimeo.
Chen, D.L., Schonger, M., 2015a.Testing Axiomatizations ofAmbiguity
Aversion.WorkingPaper,ETHZurich.
Chen,D.L.,Schonger,M.,2015b.AmbiguityAversionwithoutAsymmetric
Information.Workingpaper,ETHZurich.
Cohn,A.,Engelmann,J.,Fehr,E.,Maréchal,M.,2015.Evidenceforcoun-
tercyclicalriskaversion:Anexperimentwithfinancialprofessionals.
AmericanEconomicReview105,860–885.
Fischbacher,U.,1999.Z-Tree-ZurichToolboxforReadymadeEconomic
Experiments:Experimenter’sManual.Citeseer.
Fischbacher,U.,2007.z-Tree:Zurichtoolboxforready-madeeconomic
experiments.Exp.Econ.10,171–178.
Gelman,A.,Loken,E.,2014.Thestatisticalcrisisinscience.Am.Sci.102,
460.
Gneezy,U.,Rustichini,A.,2000.Afineisaprice.J.LegalStud.29,1–17.
Henrich,J.,Heine,S.J.,Norenzayan,A.,2010.Theweirdestpeopleinthe
world?Behav.BrainSci.33,61–83.
Horton, J.J., Rand, D.G., Zeckhauser, R.J., 2011. The online laboratory:
Conducting experiments in a real labor market. Exp. Econ. 14,
399–425.
Janssen, M.A., , Lee, A., , Waring, , T., Galafassi, D., 2014. Experimental
platforms forbehavioralexperimentsonsocial-ecologicalsystems.
Ecol.Soc.19.
Leff, A., , Rayfield, J.T., 2001. Web-Application developmentusing g the
model/view/controller design pattern. . In: Proceedings s of f the e 5th
IEEE International Conference e on n Enterprise Distributed d Object
Computing.EDOC’01.IEEEComputerSociety,Washington,DC,USA,
pp.118–127.
Lerner, J., Tirole, J.,2005. Theeconomics of technology sharing: Open
sourceandbeyond.J.Econ.Perspect.19,99–120.
Levitt,S.,List,J.,2007.Whatdolaboratoryexperimentstellusaboutthe
realworld?TheJournalofEconomicPerspectives21,153–174.
Levitt,S.D.,List,J.A.,2009.Fieldexperimentsineconomics:ThePast,the
present,andthefuture.EuropeanEcon.Rev.53,1–18.
List, J.A., Lucking-Reiley, , D., 2000. Demand d reduction in multi-unit
auctions:Evidencefromasportscardfieldexperiment.Amer.Econ.
Rev.90,961–972.
Mason,W.,Suri,S.,2012.Conductingbehavioralresearchonamazon’s
mechanicalturk.Behav.Res.Methods44,1–23.
Mazur,E.,2009.Farewell,lecture?Science323,50–51.
Pettit, J., Friedman, D., Kephart, C., , Oprea, , R., 2014. Software for
continuousgameexperiments.Exp.Econ.17,631–648.
Rubinstein,A.,1999.Experiencefromacourseingametheory:Pre-and
postclassproblemsetsasadidactic device.GamesEconom.Behav.
28,155–170.
Sonnenburg, S., Braun, , M.L., , Ong, C.S., , Bengio, S., Bottou, L., Holmes,
G.,LeCunn,Y.,Muller,K.-R.,Pereira, F.,Rasmussen,C.E., Ratsch,G.,
Scholkopf,B.,Smola,A.,Vincent,P.,Weston,J.,Williamson,R.C.,2007.
The need foropen sourcesoftware inmachine learning. J. Mach.
Learn.Res.8,2443–2466.
Zizzo,D.,2010.Experimenterdemandeffectsineconomicexperiments.
Exp.Econ.13,75–98.
Documents you may be interested
Documents you may be interested