Package bdynsys. February 19, 2015

Similar documents
Spoka Meet Audio Calls Rates Dial-In UK

Digital EAGLEs. Outlook and perspectives

Carrier Services. Intelligent telephony. for over COUNTRIES DID NUMBERS. All IP

PLEASE NOTE: firms may submit one set of research questionnaires covering both China and Hong Kong or separate sets for each jurisdiction

Dashboard. Feb 18, Feb 18, 2008 Comparing to: Site. 13,318 Visits 28,414 Pageviews 2.13 Pages/Visit

No Purchase needed

Cisco Aironet In-Building Wireless Solutions International Power Compliance Chart

MANUAL VOICE/DATA SIMCARD CANADA

VOICE/DATA SIMCARD USA UNLIMITED

iclass SE multiclass SE 125kHz, 13.56MHz 125kHz, 13.56MHz

Patent Portfolio Overview May The data in this presentation is current as of this date.

Access Code and Phone Number

EE Pay Monthly Add-Ons & Commitment Packs. Version

EventBuilder.com. International Audio Conferencing Access Guide. This guide contains: :: International Toll-Free Access Dialing Instructions

Overcoming the Compliance Challenges of VAT Remittance. 12 April :55 to 16:30 (CEST)

For: Ministry of Education From Date: 19 November 18-2 December 18 Venue: M1 Shops

OnAudience.com I Report 2017 Ad blocking in the Internet

Turquoise Terminal Returns User Guide for Creating & Uploading a Turquoise Terminal Return

COCAINE (unless otherwise noted) amongst young people (ordered alphabetically by regions)

Out of Bundle Vodafone

CUSTOMER GUIDE Interoute One Bridge Outlook Plugin Meeting Invite Example Guide

END-OF-SALE AND END-OF-LIFE ANNOUNCEMENT FOR THE CISCO MEDIA CONVERGENCE SERVER 7845H-2400

Automation DriveServer

Moving Professionals Forward. World Leader In Competence Based Certification

GW-WN150M 11b/g/n USB Wireless User Manual

Instructions. (For 6180 Industrial Computers) Applications. Overview & Safety

Vodafone Usage Manager R2.0

Enterprise price plan guide Vodafone One Net Business

International Roaming Critical Information Summaries JULY 2017

STANDARD BROADBAND & FIBRE BROADBAND PLANS

Dataliner Message Displays Using DL50 Slaves with a DL40 Master

A Guide to our Tariffs

Traffic Offload. Cisco 7200/Cisco 7500 APPLICATION NOTE

CRYPTO CLOUD SIM UNLIMITED DATA NO TRACEABILITY NO THIRD-PARTIES

DATA APPENDIX. Real Exchange Rate Movements and the Relative Price of Nontraded Goods Caroline M. Betts and Timothy J. Kehoe

PIRLS International Report PIRLS. Appendix B

Field Terminal Assembly (FTA)

Appendix G. Percentiles and Standard Deviations of Science Achievement TIMSS 2011 INTERNATIONAL RESULTS IN SCIENCE APPENDIX G 495

Service withdrawal: Selected IBM ServicePac offerings

Payphone Origination Service Charge Rate Per Min. Mobile Origination Service Charge. MLB Switched Rate Per Min. MLB Dedicated Rate Per Min

Cisco Voice Services Provisioning Tool 2.6(1)

A Guide to our Tariffs

Cisco Extensible Provisioning and Operations Manager 4.5

Cisco CallManager 4.0-PBX Interoperability: Lucent/Avaya Definity G3 MV1.3 PBX using 6608-T1 PRI NI2 with MGCP

Alternative phone number: Credit card/debit card number Expiry date: / / DD MM YYYY

Global entertainment and media outlook Explore the content and tools

Digital Context Pacific Alliance

Ibis SIM PARTNERSHIP PROGRAM. June 2016

Home Resources for Learning Scale, Fourth Grade

Quintiles vdesk Welcome Guide

MINUTES AND TEXTS CUSTOMER MOBILE BOLT-ON GUIDE JUNE 2018 BOLT-ON WILL KEEP YOU IN CONTROL OF YOUR COSTS. INTERNATIONAL NUMBERS FROM YOUR MOBILE, THIS

DataKom Vodafone Mobile Tariff Minimum 30 day end of month notice cancellation - Subject to contract. DataKom O2 Mobile Tariff. All prices exclude VAT

Updates to Plastic Molding and Co-injection Modules (Catalog Numbers 1771-QDC and 1771-QI)

Instructions. (For 6180 Industrial Computers) Installing a Processor Upgrade

Patent Portfolio Overview July The data in this presentation is current as of this date.

Key Features. VZ-IP-2MLPRB 2MP ANPR Low Light Bullet Camera.

MOBILE PRICE LIST. All prices include VAT at 20%. Rates are correct as at 1 October 2018 BUNDLES OTHER CHARGES

Cisco HCS Country Dial Plans

ThinkPad carrying cases offer protection and convenience for your mobile requirements

Student Bullying Scale, Fourth Grade

ITU Plenipotentiary 2018

Improving digital infrastructure for a better connected Thailand

CISCO IP PHONE 7970G NEW! CISCO IP PHONE 7905G AND 7912G XML

L-force Controller 3200 C. Control and visualisation compactly combined

Products.

Shell Global Helpline - Telephone Numbers

ENHANCED INTERIOR GATEWAY ROUTING PROTOCOL STUB ROUTER FUNCTIONALITY

Collaborative Regulation in the APP Economy

Teacher Job Satisfaction Scale, Fourth Grade

PAY MONTHLY ADDITIONAL SERVICES TERMS AND CONDITIONS

ETSI Governance and Decision Making

International Business Mail Rate Card

Depending on the customer. Mobile Internet in Switzerland. 4G+ network (high speed) 300 Mbit/s (download) and 150 Mbit/s (upload)

ID Reader for Hotels

Griffin Training Manual Address Maintenance

Map Reconfiguration User Guide

Achievement by Gender in the Mathematics Cognitive Domains at the Fourth and Eighth Grades

Navigation System Digital Maps Portable Electronics. NAVITEL s.r.o., U Habrovky 247/11, Praha 4, Czech Republic

Welcome to Baker McKenzie Stockholm Fifth Annual Trade Day. 7 November 2017

NEW METHOD FOR ORDERING CISCO 1700 SERIES MODULAR ACCESS ROUTERS AND CISCO 1800 SERIES INTEGRATED SERVICES ROUTERS SOFTWARE SPARE IMAGES

RT-AX95U Wireless-AX11000 Tri Band Gigabit Router

ThinkPad carrying cases offer protection and convenience for your mobile requirements

PIRLS 2016 INTERNATIONAL RESULTS IN READING

NANOELECTRONICS AND DIGITAL TECHNOLOGY ENABLING DISRUPTIVE INNOVATION LUC VAN DEN HOVE - PRESIDENT AND CEO

Allianz SE Reinsurance Branch Asia Pacific Systems Requirements & Developments. Dr. Lutz Füllgraf

We have solid distributors in over 120 countries China China China Healthcare Equipment Medical Equipment Healthcare Equipment

CLOUD BASE PHONE SYSTEM

Home Resources for Learning Scale

Map Reconfiguration Dealer Guide

NEW CISCO IOS SOFTWARE RELEASE 12.2(25)EY FOR CISCO CATALYST 3750 METRO SERIES SWITCHES

DS-2CD4026FWD/P-L 2 MP ANPR Low Light Box Camera with Housing

ID READER FOR RMS CLOUD PROPERTY MANAGEMENT SYSTEM.

International Packets

AdaptaScan Reader to a PLC-5 Using DH-485 Protocol with the 2760 RB Module and the 2760-SFC2 Protocol Cartridge

Unique variety. Circular connectors for data, signals, and power

8510 AC Spindle Drive Hardware/Firmware Replacement

Items exceeding one or more of the maximum weight and dimensions of a flat. For maximum dimensions please see the service user guide.

CISCO 7304 SERIES ROUTER PORT ADAPTER CARRIER CARD

AdaptaScan Reader to a PLC-5 Using RS-232/ASCII Protocol with the 2760 RB Module and the 2760-SFC1 and -SFC2 Protocol Cartridge

Business Mobile Plans

Transcription:

Type Package Title Bayesian Dynamical System Model Version 1.3 Date 2014-12-09 Package bdynsys February 19, 2015 Author Shyam Ranganathan, Viktoria Spaiser, Richard P. Mann, David J.T. Sumpter Maintainer Viktoria Spaiser <viktoria.sp@web.de> Depends R (>= 2.10), stats, graphics, grdevices Imports plm, Formula, MASS, Hmisc, desolve, pracma, catools, matrixstats LazyData yes The package bdynsys for panel/longitudinal data combines methods to model changes in up to four indicators over times as a function of the indicators themselves and up to three predictors using ordinary differential equations (ODEs) with polynomial terms that allow to model complex and nonlinear effects. A Bayesian model selection approach is implemented. The package provides also visualisation tools to plot phase portraits of the dynamic system, showing the complex co-evolution of two indicators over time with the possibility to highlight trajectories for specified entities (e.g. countries, individuals). Furthermore the visualisation tools allow for making predictions of the trajectories of specified entities with respect to the indicators. License GNU General Public License (>= 2) NeedsCompilation no Repository CRAN Date/Publication 2014-12-08 07:01:51 R topics documented: bayesfac........................................... 2 bayfacfig.......................................... 2 bdynsys........................................... 3 1

2 bayfacfig bestfitmod.......................................... 4 datap............................................. 5 dysymod........................................... 5 errorcorr........................................... 6 findindexm......................................... 7 phaseportdat......................................... 7 phaseportmod........................................ 8 plot_data.......................................... 9 polyfitbayes......................................... 10 polyfitreg.......................................... 11 preprocess_data....................................... 11 selectterm.......................................... 12 Index 13 bayesfac Bayesian Model Selection with Bayesian Factor Computation (Internal Function) bayesfac is the core code of the bayesian model selection in the bdynsys package. It is internally called in the main code bdynsys. It calls the functions polyfitbayes, selectterms and findindexm. It uses the Sum Square Errors from the previous model fitting step in dysymod to identify the best models for each number of modelparameters and computes then the Bayesian factor using a Monte Carlo Simulation for integration for these models, which may be then compared to find the overall best model. It prints the Bayesian factors for the best models for each number of modelparameters.it requires the package catools. Viktoria Spaiser, viktoria.sp@web.de bayfacfig Bayes Factors Plot bayfacfig plot the Bayes Factors to visualy display the selected and the overall best model. It requires the packages Hmisc and graphics. Usage bayfacfig(indnr, modelnr, BF, markmod)

bdynsys 3 Arguments indnr modelnr BF markmod an integer number indicating number of indicators, to be included in the modeling procedure number of models for which Bayes factors were obtained, and are to be compared now in the plot double numbers giving the Bayes factors for the models, to be compared, stored in a vector. the number of the model (index of the Bayes factor in the vector), which is the overall best. Examples ## Bayes Factor plot for five models with two indicators to be compared in the ## bayesian fitting, with forth model being highlighted as the overall best model bayfacfig(2, 5, c(-5.4534, -5.3955, -5.235, -4.99948, -5.321), 4) bdynsys Bayesian Dynamic System Modeling bdynsys is a package for panel/longitudinal data that combines methods to model changes in up to four indicators over time as a function of the indicators itself and up to four predictors using ordinary differential equations (ODEs) with polynomial terms that allow to model complex and nonlinear effects. A Bayesian model selection approach is implemented. The package provides also visualisation tools to plot phase portraits of the dynamic system, showing the complex co-evolution of two indicators over time with the possibility to highlight trajectories for specified entities (e.g. countries, individuals). bdynsys is also the name of the main function in the bdynsys package, that performs the bayesian dynamic systems modeling. Usage bdynsys(dataset, indnr, paramnr, x, y, z, v) Arguments dataset indnr paramnr a plm pdata.frame panel data frame. an integer number indicating number of indicators, to be included in the modeling procedure an integer number indicating number of modelparameters, this is the maximum number of polynomial terms included.

4 bestfitmod x y z v a reference to variable from the paneldata to be included as indicator 1 in the a reference to variable from the paneldata to be included as indicator 2 in the a reference to variable from the paneldata to be included as indicator 3 in the a reference to variable from the paneldata to be included as indicator 4 in the References Ranganathan, S./Spaiser, V./Mann, R.P./Sumpter, D.J.T. (2014) Bayesian Dynamical Systems Modelling in the Social Sciences. PLoS ONE, 9(1):e86468. Examples ## Bayesian Dynamic System Modeling with two variables and one modelparameter bdynsys(datap, 2, 1, datap$loggdp, datap$emanzv) bestfitmod Fitting of Dynamic System Models (Internal Function) bestfitmod is a model fitting function internally called in the code bdynsysdysymod. It calls the functions polyfitreg. It creates the testing and training datasubsets for model fitting, passes them on to polyfitreg and receives back the Sum Square of Errors which are then stored in matrix for each indicator. It returns internally the Sum Square of Error matrices to bdynsysdysymod. It requires the package catools.

datap 5 datap Test Panel Data Set: Cultural Values, GDP and Democracy from 1981-2012 in 74 countries Format datap is a panel data frame, that was produced with plmpdata.frame. It is used as testdataset for the R package bdynsys. It contains 7 variables. The first is the panel_id variable with year and country specification. The six other variables are: EmanzV (emancipative values, based on WorldValueSurvey), SeculTradV (secular_vs_traditional values, based on WorldValueSurvey), SurvSelfV (survival_vs_selfexpression values, based on WorldValueSurvez), DemocrH (human-rights weighted democracy index, based on Freedom House data), GDP (GDP per capita, based on World Bank data) and loggdp (logged and rescaled (0-1) GDP per capita). The countries IDs in the data are as follows: 1: Albania, 2: Argentina, 3: Armenia, 4: Australia, 5: Austria, 6: Azerbaijan, 7: Bangladesh, 8: Belarus, 9: Belgium, 10: Bosnia and Herzigowina, 11: Brazil, 12: Bulgaria, 13: Canada, 14: Chile, 15: China, 16: Colombia, 17: Croatia, 18: Cyprus, 19: Czech Republik, 20: Denmark, 21: Egypt, 22: Estonia, 23: Finland, 24: France, 25: Georgia, 26: Germany, 27: Greece, 28: Hungary, 29: Iceland, 30: India, 31: Indonesia, 32: Iran, 33: Iraq, 34: Ireland, 35: Israel, 36: Italy, 37: Japan, 38: Jordan, 39: South Korea, 40: Latvia, 41: Lithunia, 42: Luxembourg, 43: Macedonia, 44: Malta, 45: Mexico, 46: Moldova, 47: Montenegro, 48: Morocco, 49: Netherlands, 50: New Zealand, 51: Nigeria, 52: Norway, 53: Pakistan, 54: Peru, 55: Philippines, 56: Poland, 57: Portugal, 58: Puerto Rico, 59: Romania, 60: Russian Federation, 61: Serbia, 62: Slovak Republic, 63: Slovenia, 64: South Africa, 65: Spain, 66: Sweden, 67: Switzerland, 68: Turkey, 69: Ukraine, 70: United Kingdom, 71: USA, 72: Uruguay, 73: Venezuela, 74: Vietnam panel data frame References Wezel, C. (2013) Freedom Rising. Cambridge: Cambridge University Press. dysymod Modeling Dynamic Complex Systems with Ordinary Differential Equations (Internal Function) dysymod is the core code of the dynamic system modeling in the bdynsys package. It is internally called in the main code bdynsys. It calls the functions polyfitreg and bestfitmod. It defines the polynomial terms, that are used to build the models and creates all possible model combinations and fits them. The best three models for each number of modelparameters are then selected. It prints the three selected models for each number of modelparameters and their Log Likelihood and R-squares. It requires the package catools.

6 errorcorr errorcorr Controlling Error Correlations in Models with Panel Data errorcorr is an additional function in the bdynsys package. It calls functions preprocess_data. It computes the errors in the models (differential equations) and the covariances of the errors. It then uses the covarinaces to re-estimate the Betas of the models. The covarinace matrix is printed and the re-estimated Betas saved in a file. It requires the package MASS Usage errorcorr(dataset, indnr, x, y, f, xterms, yterms, nrterms, z, zterms, v, vterms) Arguments dataset indnr x y f xterms yterms nrterms z zterms v vterms a plm pdata.frame panel data frame. an integer number indicating number of indicators, to be included in the modeling procedure a reference to variable from the paneldata to be included as indicator 1 in the a reference to variable from the paneldata to be included as indicator 2 in the a function that contains the models of the indicators. a vector that contains the terms from the model dx/dt. a vector that contains the terms from the model dy/dt. total number of in all equations, e.g. sum of terms in equation for dx/dt and terms in equation for dy/dt, if the number of variables is two. a reference to variable from the paneldata to be included as indicator 3 in the a vector that contains the terms from the model dz/dt. a reference to variable from the paneldata to be included as indicator 4 in the a vector that contains the terms from the model dv/dt.

findindexm 7 Examples ## Controlling Error Correlations with two indicators and with the following two models: ## dx/dt = + 0.0012 /x^2 and dy/dt = + 0.0071 x^3 errorcorr(datap, 2, datap$loggdp, datap$emanzv, f <- function(y=c()) rbind(0.0012/y[1]^2, + 0.0071*Y[1]^3), c(11), c(14), 2) findindexm Finding Indexes of Polynomial Modelterms (Internal Function) findindexm finds indexs of modelterms to be processed in selectterms if the user wishes to compare Bayes factors of models with two vs. model with three indicators or models with three vs. models with four indicators. The function is internally called in the code bdynsysbayesfacselectterms. It returns internally the indexes of modelterms to bdynsysbayesfacselectterms. phaseportdat Phase Potrait with Data Trajectories for Specified Entities Usage phaseportdat creates a phase portrait (velocity plot, vectorfield) based on the two differential equations that were considered to be the overall best models for indicator 1 and indicator 2. The user may specify entities for which he/she wants to plot the data trajectories over the phase portrait. It calls the function preprocess_data. It requires the packages plm, pracma, desolve and graphics. phaseportdat(dataset, xv, yv, rangex, rangey, f, entidx1, entidx2, entidx3, entidx4, entidx5, entidx6) Arguments dataset xv yv a plm pdata.frame panel data frame. a reference to variable from the paneldata to be included as indicator 1 in the a reference to variable from the paneldata to be included as indicator 2 in the rangex defines the range of the indicator 1.

8 phaseportmod rangey defines the range of the indicator 2. f entidx1 entidx2 entidx3 entidx4 entidx5 entidx6 a function that contains the models of the two indicators. Examples ## Phase Portrait with Data Trajectories with the following two models: ## dx/dt = + 0.0012 /x^2 and dy/dt = + 0.0071 x^3 phaseportdat(datap, datap$loggdp, datap$emanzv, seq(0, 1, by = 0.1), seq(0, 1, by = 0.1), f <- function(t,y=c()) rbind(0.0012/y[1]^2, + 0.0071*Y[1]^3), 1, 2, 4, 5, 7, 9) phaseportmod Phase Potrait with Modeled Trajectories for Specified Entities phaseportmod creates a phase portrait (velocity plot, vectorfield) based on the two differential equations that were considered to be the overall best models for indicator 1 and indicator 2. The user may specify entities for which he/she wants to obtain the predicted (modeled) trajectories over the phase portrait. The user may extend the period of time for the modeling to get future-predicted trjectories of the entities based on the models. It calls the function preprocess_data. It requires the packages plm, pracma, desolve and graphics. The function produces graphs by some default settings. For specific requirements the user might want to modify the code according to his/her needs. Usage phaseportmod(dataset, yearnr, xv, yv, rangex, rangey, param, f, entidx1, entidx2, entidx3, entidx4, entidx5, entidx6)

plot_data 9 Arguments dataset yearnr xv yv a plm pdata.frame panel data frame. number of years for which the user wants to produce the phase portrait and obtain the modeled trajectories of the specified entities. a reference to variable from the paneldata to be included as indicator 1 in the a reference to variable from the paneldata to be included as indicator 2 in the rangex defines the range of the indicator 1. rangey defines the range of the indicator 2. param a vector with parameters from the two models in f. f entidx1 entidx2 entidx3 entidx4 entidx5 entidx6 a function that contains the models of the two indicators. Examples ## Phase Portrait with Model Trajectories over 30 years with the following two models: ## dx/dt = 0.014 + 0.0064*x*y - 0.02*x and dy/dt = 0.106*x^3-0.062*y/x phaseportmod(datap, 30, datap$loggdp, datap$democrh, seq(0, 1, by = 0.01), seq(0, 1, by = 0.01), param <- c(0.014, -0.0064, -0.02, 0.106, -0.062), f <- function(t,y=c()) rbind(0.014 + 0.0064*Y[1]*Y[2] - 0.02*Y[1], 0.106*Y[1]^3-0.062*(Y[2]/Y[1])), 1, 2, 4, 5, 7, 9) plot_data Plotting Data in Phase Plane with Data Trajectories for Specified Entities plot_data plots data form indicator 1 and indicator 2 in phase plane. The user may specify entities for which he/she wants to plot the data trajectories over the plotted data. It calls the function preprocess_data. It requires the packages plm and graphics.

10 polyfitbayes Usage plot_data(dataset, xvar, yvar, rangex, rangey, entidx1, entidx2, entidx3, entidx4, entidx5, entidx6) Arguments dataset xvar yvar a plm pdata.frame panel data frame. a reference to variable from the paneldata to be included as indicator 1 in the a reference to variable from the paneldata to be included as indicator 2 in the rangex defines the range of the indicator 1. rangey defines the range of the indicator 2. entidx1 entidx2 entidx3 entidx4 entidx5 entidx6 Examples ## Plot Data in a Phase Plane with Data Trajectories for Specified Entities plot_data(datap, datap$loggdp, datap$emanzv, seq(0, 12, by = 0.5), seq(0, 1, by = 0.1), 1, 2, 3, 4, 5, 6) polyfitbayes Bayesian Model Fitting with Polynomial Terms als Predictors and Changes as Dependent Variable (Internal Function) polyfitbayes is a modeling function internally called in the code bdynsysbayesfac. It computes the values for the independed variables, based on polynomial terms and a coefficient parameter space. The function then performs a Monte Carlo simulation to compute/integrate the log Bayes Factor. It returns internally the log Bayes factors for the best models and the modelindexes of those best models to bdynsysbayesfac.

polyfitreg 11 polyfitreg Least Square Regression with Polynomial Terms als Predictors and Changes as Dependent Variable (Internal Function) polyfitreg is a modeling function internally called in the code bdynsysdysymod as well as in bdynsysdysymodbestfitmod. It computes the values for the independed variables, based on polynomial terms and computes all possible regression models with all possible combinations of these independ variables (all possible combinations of polynimal terms) and the changes in the dependent variables which are to be predicted. The function estimates the Betas, computes the Sum Square of Error of all possible models as well as their Log Likelihood and R-squares. It returns internally the Sum Square of Error matrices to bdynsysdysymodbestfit and Betas to bdynsysdysymod.log Likelihood and R-square are printed. preprocess_data Data Processing for Bayesian Dynamic System Modeling (Internal Function) preprocess_data is a core code in the bdynsys package to prepare the data for the bayesian dynamic system modeling. It is internally called in the main code bdynsys. It creates wide format matrixes for the indicators based on time and entity-id. It also reshapes the indicators into single columns ordered by time, computes the changes in the indicators at each timestep, reshapes them also into single colums ordered by time and stores them in variables. It furthermore removes missing values and scales the variables with their means. It returnes the processed variables to bdynsys and that way makes them availabe for usage in bdynsysdysymod and bdynsysbayesfac.it requires the package plm and matrixstats.

12 selectterm selectterm Deriving Best Models and their Polynomial Terms for Bayesian Model Fitting (Internal Function) selectterms selects/indexes terms which are part of the models to be fitted in the Bayesian fitting procedure. The function is internally called in the code bdynsysbayesfac. The model selections is based on the Sum of Square Errors which were computed in the previous model fitting step in bdynsysdysymod. It returns internally the indexes of the best models polynomial terms to bdynsysbayesfac.

Index Topic datasets datap, 5 Topic graphics bayfacfig, 2 phaseportdat, 7 phaseportmod, 8 plot_data, 9 Topic stats bdynsys, 3 errorcorr, 6 bayesfac, 2 bayfacfig, 2 bdynsys, 3 bestfitmod, 4 datap, 5 dysymod, 5 errorcorr, 6 findindexm, 7 phaseportdat, 7 phaseportmod, 8 plot_data, 9 polyfitbayes, 10 polyfitreg, 11 preprocess_data, 11 selectterm, 12 selectterms (selectterm), 12 13