L – Modeling and Simulating Social Systems with MATLAB

Slides:



Advertisements
Similar presentations
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
Advertisements

Writing Skills Improvement Guide Dr. Zubair A. Baig Computer Engineering Department KFUPM, Dhahran.
An introduction to Plotting in MATLAB Rikard Johansson Department of Biomedical Engineering (IMT) Linköping University
How to read a scientific paper
L – Modelling and Simulating Social Systems with MATLAB Lesson 8 – Thesis Writing and Presentation of Results Wenjian Yu © ETH Zürich.
TABLE OF CONTENTS 2014 BasmahAlQadheeb. What is a report? A report is a clearly structured document that presents information as clearly as possible.
L – Modeling and Simulating Social Systems with MATLAB Lecture 2 – Statistics and plotting © ETH Zürich | Giovanni Luca Ciampaglia,
Title of your Poster Presentation Student Presenter’s Name(s), Major(s) or Course Name · Mentor’s Name and Title, Department Insert Text Here… (replace.
ASSET Independent Research Slide Presentation Template (replace this title with the title of your work!) Authors’ names, affiliations, funding sources,
Poster Title Author Name(s) PRINTING INFORMATION
Mazetool Analytics Project 2 IMGD 2905.
Understanding Standards: Advanced Higher Physics
Title of your Poster Presentation
PowerPoint Best Practices
L – Modeling and Simulating Social Systems with MATLAB
Please put the title here
Center for Undergraduate Research Fall 2017 Panther Pipelines: Discovery Day Poster Submission Guidelines The Virginia Union University (VUU) Center for.
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Research Methods for Computer Science
SHORT TITLE GOES HERE CTP Participant Name1 & CTP Participant Name2
L – Modeling and Simulating Social Systems with MATLAB
Template for a 40”x 32” poster (title goes here)
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Preparing a Logic Model and Gantt Chart:
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Aylin AKÇA OKAN METU, Ankara Fall
REPLACE TEXT WITH TITLE
Template for a 24”x 36” poster (title goes here)
Template for a 36”x 24” poster (title goes here)
BASIC ESSAY STRUCTURE.
BASIC ESSAY STRUCTURE.
Mazetool Analytics Project 2 IMGD 2905.
Lecture 10 2D plotting & curve fitting
Please put the title here
Title of your Poster Presentation
Title of your Poster Presentation
Winners eligible for cash prizes!!!
Title of your Poster Presentation
Research Seminar Session 7 Presenting a Research proposal By: Dr
Poster Title Author Name(s) PRINTING INFORMATION
Template for a 32”x 40” poster (title goes here)
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
BASIC ESSAY STRUCTURE.
Title of your Poster Presentation
Mazetool Analytics Project 2 IMGD 2905.
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Title of your Poster Presentation
Descriptive title of design project here
Title of your Poster Presentation
Title of your Poster Presentation
Introduction to Excel 2007 Part 1: Basics and Descriptive Statistics Psych 209.
CS 232 Geometric Algorithms: Lecture 1
Presentation transcript:

851-0585-04L – Modeling and Simulating Social Systems with MATLAB 27.04.2018 851-0585-04L – Modeling and Simulating Social Systems with MATLAB Lecture 9 – Scientific Writing and Presentation of Results Karsten Donnay and Stefano Balietti Chair of Sociology, in particular of Modeling and Simulation © ETH Zürich | © ETH Zürich |

Schedule of the course Introduction to MATLAB 27.04.2018 Schedule of the course Introduction to MATLAB 21.02. 28.02. 07.03. 14.03. 21.03. 28.03. 04.04. 18.04. 02.05. 09.05. 16.05. 23.05. 30.05. Introduction to social-science modeling and simulation Working on projects (seminar theses) Handing in seminar thesis and giving a presentation

Final presentation schedule Project presentation 15’ + 5’ (for Q&A) 3 days available: Thu May 26th 10 a.m. – 1 p.m. (9 slots) Mon May 30th 5 – 7 p.m. (6 slots) Wed Jun 1st 4 p.m. – 7 p.m. (9 slots) Registration for final presentation is binding; if you do not want to obtain credits, do not register! Sign up for slot this and next week in class or per email to sbalietti@ethz.ch and kdonnay@ethz.ch

Final presentation schedule due date of reports: midnight of 2 days before your slot submission deadlines then are: Tue May 24th at midnight (if presenting on Thu May 26th) Sat May 28th at midnight (if presenting on Mon May 30th) Mon May 30th at midnight (if presenting on Wed Jun 1st) Submission of report & program code by email to sbalietti@ethz.ch and kdonnay@ethz.ch remember to put [MATLAB] in the subject line!

Goals of Lecture 9: students will 27.04.2018 Goals of Lecture 9: students will Refresh knowledge on optimization in MATLAB acquired in lecture 8, through a brief repetition of important points. Receive a quick introduction to scientific writing* and practical advice on the framing of the final report. Get some specific instructions on the expected format of the final report and a content “checklist” to follow when writing up the report. See an example of the level of sophistication we expect in visualizing your model results. * thanks to Heiko Rauhut and Volker Grimm for providing content

Repetition the structure and simplicity of your code is the most important factor for the performance of your program make use of the MATLAB specific techniques to improve performance when writing routines; use functions over scripts and compartmentalize test your program for performance, in particular the parts of your code that carry the main computational load; MATLAB’s profiler is very useful for that! example of vectorizing: can be faster than looping but not necessarily; the only way to know is to test your program under the expected load of the simulation. parallelization very easy and useful for parameter sweeps

Scientific Writing Clear, easy to read, concise, and precise. avoid metaphors; use examples instead keep sentences short Main purpose: communicate your work so that others can replicate it, modify it and object to it. It is still a form of creative writing! create a narrative guide the reader through your project and results

The Hour Glass Structure

What are your research questions? In the introduction of your reports, clearly specify the research questions, e.g.: How does crime influence population growth? Will the outcome change if mechanism A is changed to mechanism B in the model? How? Are the results of the model reproducible if the complicated function f(x)=exp(x+y)+y2 is replaced by the simpler g(x)=x+y ? In the “Results” section come back to your research questions.

Interpretation of Results 27.04.2018 Interpretation of Results Remember: Correlation does not imply causation Do not over-interpret your results Propose an underlying mechanism xkcd.com/552

Correlation vs. Causality Correlation: corrcoef(A,B) = 1.0000 0.8390 0.8390 1.0000 Causality: A correlates with B, but how does the causality look like? A C A B B A B A B

Reproducibility of Results It is an important criterion for the quality of scientific work that your results are fully reproducible Make sure to set and store the random seed of every simulation run to ensure reproducibility STREAM = RandStream.getDefaultStream returns default random number stream with its seed value RandStream.setDefaultStream(RandStream('mt19 937ar','seed',SeedValue) sets the random seed with the (new) value SeedValue

Data Dump – storing your results Make sure that the results of your simulations are stored at the end of a simulation run You can for example simply save the results in form of the array structure (matrix, cell array) of your simulation using MATLAB’s save() command Or you may export them to comma separated files using csvwrite() (and csvread() to recover data) Documentation on csvwrite() may be found here

Visualization of Results 27.04.2018 Visualization of Results Graphical formats: use PDF or EPS in the print version. JPG (better PNG) just for quick visualizations Increase the font sizes for readability: set(gca, ‘FontSize’, 16); ALWAYS use labels on axes: xlabel(‘Time (s)’, ‘FontSize’, 16); ylabel(‘Number of Agents’, ‘FontSize’, 16);

Visualization of Results (2) 27.04.2018 Visualization of Results (2) Put a box around the figure: box on Show grid: grid on Use thicker lines: plot(x, y, ‘LineWidth’, 2); Set axis limits: xlim(x0, x0); ylim(y0, y0);

27.04.2018 Example As an example: Let us say that we have a project about simulating happiness of agents. We have the result of 10 different simulation runs in y, and the corresponding time vector in x. x = t0:dt:t1; y = [happiness values from simulation 1; happiness values from simulation 2; ... happiness values from simulation 10];

27.04.2018 plot(x,y(1,:))

xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’) 27.04.2018 plot(x,y(1,:)) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)

xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’) 27.04.2018 plot(x,y) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)

xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’) 27.04.2018 plot(x,y) set(gca,’FontSize’,16) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)

errorbar(x,mean(y),std(y)) set(gca,’FontSize’,16) xlabel(‘Time(days)’) 27.04.2018 errorbar(x,mean(y),std(y)) set(gca,’FontSize’,16) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)

errorbar(x,mean(y),std(y),’k’,’LineWidth’,2) set(gca,’FontSize’,16) 27.04.2018 errorbar(x,mean(y),std(y),’k’,’LineWidth’,2) set(gca,’FontSize’,16) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’) xlim([0 10]) ylim([0 .5])

add caption in LaTeX! errorbar(x,mean(y),std(y),’k’,’LineWidth’,2) set(gca,’FontSize’,16) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’) xlim([0 10]) ylim([0 .5]) 27.04.2018 add caption in LaTeX!

27.04.2018 errorbar(x,mean(y),std(y),’k’,’LineWidth’,2) set(gca,’FontSize’,16) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’) xlim([0 10]) ylim([0 .5])

Important Graphs semi-logarithmic plot (semilogx() or semilogy()) 27.04.2018 Important Graphs semi-logarithmic plot (semilogx() or semilogy()) α = -0.001 y = exp(α x) α sets the slope of the curve

Important Graphs power law plot (loglog()) y = xα 27.04.2018 Important Graphs power law plot (loglog()) α = -1.2 y = xα α sets the slope of the curve

Important Graphs power law plot with exponential cutoff (loglog()) 27.04.2018 Important Graphs power law plot with exponential cutoff (loglog()) α = -1.2 y = xα exp(β x) α sets the slope of the curve β sets the exponential cutoff

Phase Diagrams To show how the result depend on two different parameters, phase diagrams can be used: D. Helbing and W. Yu, PNAS (2009)

Phase Diagrams code snippet that uses surf(); here matrix M has as entry (i,j) the model fit for every combination of two parameters (here: a, b) [a,b]=meshgrid(0:0.01:1); hold on; view(0,90); surf(a,b,M,'EdgeColor','none'); colorbar; set(gca,'FontSize',14) xlabel('parameter a'); ylabel('parameter b');

Phase Diagrams

Normalized Parameters It is usually advantageous to rescale any parameter in your model to a uniform range, for example [0,1] Normalized parameters simplify the visualization and analysis of the model results Ideally, the parameter range of model parameters and their scaling to the uniform range is chosen such that all relevant variations of the model are visible within that range

27.04.2018 Create Videos It is helpful to illustrate your simulations with videos during your presentation:

27.04.2018 Project Report Have a look at last year’s projects to make sure that you don’t repeat the same results! Use the report template. Try to explain your results well, as well as explaining your motivation behind the project. Include your MATLAB code in the appendix If you have any problems or concerns with your projects, we are here to help you!

27.04.2018 Project Report There are a number of things that will certainly negatively affect your grade: no clearly stated research question no conclusion regarding the work you have completed and how it relates to your research question graphs which have no legend, axis labels or caption, are not properly readable or the labels are too small no references to the literature to validate and back-up your statements/model etc. submitting you report late or incomplete

Project Report References are very important: 27.04.2018 Project Report References are very important: cite the sources you are using be aware that plagiarism is taken very seriously at ETH, if you are unsure how to cite properly follow ETH’s plagiarism guidelines we accept both natural science and social science citation conventions but please use them consistently it is important that your references are correct and correctly formatted!

Project Report Documentation of your code is important 27.04.2018 Project Report Documentation of your code is important You can, for example, use the following tool to automatically generate html files from comments in your code http://www.artefact.tk/software/matlab/m2html/ Please also pay attention to the MATLAB code style guidelines provided here to guarantee that your code is flawless and easy to understand

Final checklist A typical scientific report should include: Title Abstract Introduction Materials / Methods Results Discussion References Appendix (if needed) ReportTemplate.zip

References MATLAB documentation on plotting MATLAB code style guidelines Tool to convert comments to html files J.-L. Dumont. “Trees, maps and theorems”. Principiae (2009). Russey, Ebel, Bliefert. “How to Write a Successful Science Thesis”. Wiley (2006). R. Murray. “How to Write a Thesis”. Open University Press (2006)