Download presentation
Presentation is loading. Please wait.
Published byOswald Duane Jennings Modified over 6 years ago
1
851-0585-04L – Modeling and Simulating Social Systems with MATLAB
L – 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 |
2
Schedule of the course Introduction to MATLAB
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
3
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 to and
4
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 to and remember to put [MATLAB] in the subject line!
5
Goals of Lecture 9: students will
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
6
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
7
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
8
The Hour Glass Structure
9
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.
10
Interpretation of Results
Interpretation of Results Remember: Correlation does not imply causation Do not over-interpret your results Propose an underlying mechanism xkcd.com/552
11
Correlation vs. Causality
Correlation: corrcoef(A,B) = Causality: A correlates with B, but how does the causality look like? A C A B B A B A B
12
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
13
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
14
Visualization of Results
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);
15
Visualization of Results (2)
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);
16
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];
17
plot(x,y(1,:))
18
xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)
plot(x,y(1,:)) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)
19
xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)
plot(x,y) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)
20
xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)
plot(x,y) set(gca,’FontSize’,16) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)
21
errorbar(x,mean(y),std(y)) set(gca,’FontSize’,16) xlabel(‘Time(days)’)
errorbar(x,mean(y),std(y)) set(gca,’FontSize’,16) xlabel(‘Time(days)’) ylabel(‘Fraction of happy agents’)
22
errorbar(x,mean(y),std(y),’k’,’LineWidth’,2) set(gca,’FontSize’,16)
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])
23
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]) add caption in LaTeX!
24
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])
25
Important Graphs semi-logarithmic plot (semilogx() or semilogy())
Important Graphs semi-logarithmic plot (semilogx() or semilogy()) α = y = exp(α x) α sets the slope of the curve
26
Important Graphs power law plot (loglog()) y = xα
Important Graphs power law plot (loglog()) α = -1.2 y = xα α sets the slope of the curve
27
Important Graphs power law plot with exponential cutoff (loglog())
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
28
Phase Diagrams To show how the result depend on two different parameters, phase diagrams can be used: D. Helbing and W. Yu, PNAS (2009)
29
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');
30
Phase Diagrams
31
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
32
Create Videos It is helpful to illustrate your simulations with videos during your presentation:
33
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!
34
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
35
Project Report References are very important:
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!
36
Project Report Documentation of your code is important
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 Please also pay attention to the MATLAB code style guidelines provided here to guarantee that your code is flawless and easy to understand
37
Final checklist A typical scientific report should include: Title
Abstract Introduction Materials / Methods Results Discussion References Appendix (if needed) ReportTemplate.zip
38
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)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.