﻿ Statistics - Cybersecurity - Topics in Statistics - Telematic support to students

Statistics
, Cybersecurity [Year 2021 - 22]

Topics on Statistics with intensive computer applications

$\int_0^t d S_u = \int_0^t \mu(S_u, u) du + \int_0^t\sigma(S_u, u) dW_u$

Supporto al corso e alla didattica telematica, by T. Gastaldi   #Sapienzanonsiferma  #Sapienzadoesnotstop

(Instructor: tommaso.gastaldi@gmail.com,
https://www.datatime.eu/public/cybersecurity/)

Whatsapp group for the students of this course
Invitation to join the Whatsapp group for this course: https://chat.whatsapp.com/Kk3wRGmmxWH9RNUo01zFdX

(work group for communication exchange about the course and exams. When first joining, send a message with your name and id ("matricola"))

each student will create his/her own free blog, eg. with any free blogging platform, to publish their hypertext essays [for the oral exam], and indicate the link in the google sheet we have prepared)

VOLUNTARY WORK GROUPS created by students

[to be filled]

________________________________________________________________________________________

- LESSON 01 -  [23 Sept 2021]

VIDEO LESSONS:

Course Introduction

Theory

Computer applications, and language fundamentals for statistical algos

Extra material (optional)

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: post your link within 3 Oct 2021 or -1 penalty on final grade may apply]

1_R. Give your best description of the many reaching out of statistics, in its various form, as a branch of math (Probability theory, etc.), as a set of methodologies used in many other disciplines, as an essential tool to deal with any sort of data, make reports and provide governance tools. Discuss whether it can be considered a "science" and what is the "scientific method" (what is a "theory" and what is a "hypothesis"). What is the role of Statistics in Math and Science ?

Applications / Practice (A)

1_A. Create - in both languages C# and VB.NET (and optionally in js) - a program which does the following simple tasks to get acquainted with the tool:

- when a button is pressed some text appears in a richtexbox on the startup form
- when another button is pressed animate one or more balls (possibly of different colors and sizes) within a rectangle

OPTIONAL (web version)

Do the same using plain js/html/css (simple examples in: https://www.datatime.eu/public/cybersecurity/JSTutorial/ )

REFERENCES / SOURCES  / USEFUL LINKS

Platform to publish your weekly homework:

Choose your free blogging platform: https://www.wpbeginner.com/beginners-guide/how-to-choose-the-best-blogging-platform/ ,   https://www.creativebloq.com/web-design/best-blogging-platforms-121413634
Always cite your sources and give proper credits (this is useful for both avoiding plagiarism, but also declining responsibility for possible errors in the sources): https://www.plagiarism.org/article/how-do-i-cite-sources

For Blogs:

Programming courses (link sent by company):
https://www.futurelearn.com/subjects/it-and-computer-science-courses/coding-programming

______________________________________________________________________________________

- LESSON 02 -  [30 Sept 2021]

VIDEO LESSONS:

Theory

Computer applications, and language fundamentals for statistical algos

Extra help to clean up code (optional material):

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: post your link within 10 Oct 2021 or -1 penalty on final grade may apply]

2_R. Describe the most common configuration of data repositories in the real world and corporate environment. Concepts such as Operational or Transactional systems (OLTP), Data Warehouse DW, Data Marts, Analytical and statistical systems (OLAP), etc. Try to draw a conceptual picture of how all these components may work together and how the flow of data and information is processed to extract useful knowledge from raw data.

3_R. Show how we can obtain an online algo for the arithmetic mean and explain the various possible reasons why it is preferable to the "naive" algo based on the definition.

Applications / Practice (A)

2_A. Create - in both languages C# and VB.NET - a demonstrative program which computes the online arithmetic mean (if it's a numeric variable) and your own algo to compute the distribution for a discrete variable and for a continuous variable (can use values simulated with RANDOM object).

3_A. Create an object providing a rectangular area which can be moved and resized using the mouse. This area will hold our future charts and graphics.

OPTIONAL

Do the last exercise 3_A as web app, in javascript/html/css.
(simple examples in: https://www.datatime.eu/public/cybersecurity/JSTutorial/ ))

1_RA. Understand how the floating point representation works and describe systematically (possibly using categories) all the possible problems that can happen. Try to classify the various issues and limitations (representation, comparison, rounding, propagation, approximation, loss of significance, cancellation, etc.) and provide simple examples for each of the categories you have identified (e.g.,, https://floating-point-gui.de/basic/ ,  https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html , http://indico.ictp.it/event/8344/session/50/contribution/207/material/slides/0.pdf , https://stackoverflow.com/questions/2100490/floating-point-inaccuracy-examples , etc.)

REFERENCES / SOURCES  / USEFUL LINKS:

Streaming Data: https://en.wikipedia.org/wiki/Streaming_data
Data Lake (Data Swamp): https://en.wikipedia.org/wiki/Data_lake
OLTP: https://en.wikipedia.org/wiki/Online_transaction_processing
Data Warehouse (DW): https://en.wikipedia.org/wiki/Data_warehouse
Data Mart: https://en.wikipedia.org/wiki/Data_mart
On Line Analytical Processing (OLAP): https://en.wikipedia.org/wiki/Online_analytical_processing
Data Analysis: https://en.wikipedia.org/wiki/Data_analysis
Data Mining: https://en.wikipedia.org/wiki/Data_mining
Data Reporting: https://en.wikipedia.org/wiki/Data_reporting
Predictive Analytics: https://en.wikipedia.org/wiki/Predictive_analytics
Streaming algorithms: https://en.wikipedia.org/wiki/Streaming_algorithm
Online algorithm: https://en.wikipedia.org/wiki/Online_algorithm
Online Vs Offline: https://stackoverflow.com/questions/11496013/what-is-the-difference-between-an-on-line-and-off-line-algorithm
One-pass algorithm: https://en.wikipedia.org/wiki/One-pass_algorithm#:~:text=In%20computing%2C%20a%20one%2Dpass,the%20size%20of%20the%20input ., https://stackoverflow.com/questions/26322007/what-is-a-single-pass-algorithm
One-pass Vs Online: https://stats.stackexchange.com/questions/396728/what-is-the-diffrences-between-online-and-one-pass-learning
One-pass Vs Multi-pass: https://stackoverflow.com/questions/58407978/difference-between-one-pass-and-multi-pass-computations
Stream Processing: https://en.wikipedia.org/wiki/Stream_processing, https://hazelcast.com/glossary/stream-processing/
Event Stream Processing: https://en.wikipedia.org/wiki/Event_stream_processing , https://hazelcast.com/glossary/event-stream-processing/
Data Buffer: https://en.wikipedia.org/wiki/Data_buffer
Batch / Micro Batch Processing: https://en.wikipedia.org/wiki/Batch_processing https://hazelcast.com/glossary/micro-batch-processing/
Pseudocode: https://en.wikipedia.org/wiki/Pseudocode

My quick summary of control structures (ita): StruttureControlloFlusso.txt    (send changes if you see inaccuracies, things to add/improve)

Murphy Law: https://en.wikipedia.org/wiki/Murphy%27s_law
Spaghetti code: https://en.wikipedia.org/wiki/Spaghetti_code

_______________________________________________________________________________________

- LESSON 03 -  [07 Oct 2021]

VIDEO LESSONS:

Note: "OPT"  indicates optional video material extra that can be skipped. Same for homework, "OPT" denotes homework that can be skipped.

Theory

Computer applications, and language fundamentals for statistical algos

OPT

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: post your link within 17 Oct 2021 or -1 penalty on final grade may apply]

4_R. Explain what are marginal, joint and conditional distributions and how we can explain the Bayes theorem using relative frequencies. Explain the concept of statistical independence and why, in case of independence, the relative joint frequencies are equal to the products of the corresponding marginal frequencies.

Applications / Practice (A)     [work on this at least 30' a day, all days]

4_A. Create a program - in both languages C# and VB.NET (and optionally in js) - to read data from a CSV file, and store it into suitably designed objects, for further processing. Compute mean and standard deviation and frequency distribution for at least one of the variable, and for one pair of variables.

5_A. Compute - in both languages C# and VB.NET (and optionally in js) - a frequency distribution of the meaningful words from any text file and create a personal graphical representation of the corresponding "word cloud" (in case, can use animation if you wish), keeping into account the frequencies of the words.

(A file of italian stop words, in case might be useful: https://datatime.eu/public/cybersecurity/jsTutorial/StopWords_Ita.txt: please suggest more)

OPTIONAL applications

Translate the last exercises 4_A, 5_A to web browser applications, in plain javascript (use canvas, etc., no "third part libraries",  see
https://www.datatime.eu/public/cybersecurity/JSTutorial/ for some progressive examples).  [+1 extra point for this optional part.]

2_RA. Do a review about charts useful for statistics and data presentation (example of some: StatCharts.txt ). What is the chart type that impressed you most and why ?

3_RA. Do a comprehensive research about the GRAPHICS object and all its members (to get ready to create any statistical chart.)

REFERENCES / SOURCES  / USEFUL LINKS:

Bivariate distribution: http://www.brainkart.com/article/Bivariate-Frequency-Distributions_35069/#:~:text=In%20other%20words%2C%20a%20bivariate,students%20in%20an%20intelligent%20test.&text=Each%20cell%20shows%20the%20frequency%20of%20the%20corresponding%20row%20and%20column%20values.

Contingency table: https://en.wikipedia.org/wiki/Contingency_table

Interface, Multiple inheritance: https://www.ict.social/vbnet/oop/interfaces-in-vbnet-course
Icomparable https://docs.microsoft.com/it-it/dotnet/api/system.icomparable?view=netcore-3.1

_______________________________________________________________________________________

- LESSON 04 -  [14 Oct 2021]

VIDEO LESSONS:

Note: "OPT"  indicates optional video material for extra help: it can be skipped. Same for homework, "OPT" denotes homework that can be skipped.

Theory

Computer applications, and language fundamentals for statistical algos

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: post your link within 24 Oct 2021, or -1 penalty on final grade may apply ]

5_R. Explain a possibly unified conceptual framework to obtain all most common measures of central tendency and of dispersion using the concept of distance (or "premetric", or similarity in general). Discuss why it is useful to discuss these concepts introducing the notion of distance. Finally, point out the difference between the mathematical definition of "distance" and the properties of the "premetrics" useful in statistics, pointing out trhe most important distances, indexes and similarity measures used in statistics, data analysis and machine learning (such as for instance; Mahalanobis distance, Euclidean distance, Minkowski distance, Manhattan distance, Hamming distance, Cosine distance, Chebishev distance, Jaccard index, Haversine distance, Sørensen-Dice index, etc.).

Applications / Practice (A)     [work on this at least 30' a day, all days]

6_A. (For this exercises use only 1 language chosen between C# or VB.NET, according to your preference)

Prepare separately the following charts: 1) Scatterplot, 2) Histogram/Column chart [in the histogram, within each class interval, draw also a vertical colored line where lies the true mean of the observations falling in that class] and 3) Contingency table, using the graphics object and its methods (Drawstring(), MeasureString(), DrawLine(), etc).
Use them to represent 2 numerical variables that you select from a CSV file. In particular, in the same picture box, you will make at least 2 separate charts: 1 dynamic rectangle will contain the contingency table, and 1 rectangle (chart) will contain the scatterplot, with the histograms/column charts and rug plots drawn respectively near the two axis (and oriented accordingly).

4_RA. Do a personal research about the real world window to viewport transformation, and note separately the formulas and code which can be useful for your present and future applications.

OPTIONAL applications

Translate the last exercises 6_A to web browser applications, in plain javascript (no "third party libraries",  check also
https://www.datatime.eu/public/cybersecurity/JSTutorial/ for some progressive examples)  [+1 extra point for this optional part.].

REFERENCES / SOURCES  / USEFUL LINKS:

Web scraping https://en.wikipedia.org/wiki/Web_scraping

_______________________________________________________________________________________

- LESSON 05 -  [21 Oct 2021]

VIDEO LESSONS:

Note: "OPT"  indicates optional video material for extra help: it can be skipped. Same for homework, " OPT" denotes homework that can be skipped.

Theory

Computer applications, and language fundamentals for statistical algos

(expand your library collection by refining and adding new functionalities for charting, eg. try 3D objects and shading)

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal   blog) :  [DATE DUE: send your link within 31 Oct 2021, or -1 on final grade penalty may apply]

6_R. Think and explain in your own words what is the role that probability plays in Statistics and the relation between the observed distribution and frequencies their "theoretical" counterparts. Do some practical examples where you explain how the concepts of an abstract probability space relate to more "concrete" and "real-world" objects when doing statistics.

7_R. Explain the Bayes Theorem and its key role in statistical induction. Describe the different paradigs that can be found within statistical inference (such as"bayesian", "frequentist" [Fisher, Neyman]).

Applications / Practice (A)     [work on this at least 30' a day, all days]

7_A. Given 2 variables taken from a CSV file compute and represent the statistical regression lines (X to Y and viceversa) and the scatterplot.
Optionally, represent also the histograms on the "sides" of the chart (one could be draw vertically and the other one horizontally, in the position that you prefer).
[Remember that all our charts must alway be done within "dynamic viewports" (movable/resizable rectangles). No third party libraries, to ensure ownership of creative process. May choose the language you prefer.].

5_RA. Do a web research about the various methods to generate, from a Uniform([0,1)), all the most important random variables (discrete and continuous). Collect all source code you think might be useful code of such algorithms (keep credits and attributions wherever applicable), as they will be useful for our next simulations.

https://www.cs.wm.edu/~va/software/park/park.html
https://www.johndcook.com/blog/2010/05/03/c-random-number-generation-code/
https://homeweb.csulb.edu/~tebert/teaching/lectures/552/variate/variate.pdf
https://www.jstor.org/stable/1402590
https://www.icosaedro.it/phplint/generating-statistical-distributions/index.html   etc...

REFERENCES / SOURCES  / USEFUL LINKS:

videos:

https://www.youtube.com/watch?v=ZJsOOCghQJ0 "Cumulative Distribution Function (1 of 3: Definition)"

For applications

Running Regression https://www.johndcook.com/blog/running_regression/
One pass skeweness and kurtosis https://www.johndcook.com/blog/skewness_kurtosis/

_______________________________________________________________________________________

- LESSON 06 -  [12 Nov 2020]

VIDEO LESSONS:

Note: "OPT"  indicates optional video material for extra help: it can be skipped. Same for homework, " OPT" denotes homework that can be skipped.

Theory

Computer applications, and language fundamentals for statistical algos

(revise and refine your previous programs and libraries)

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: send your link within 7 Nov 2021, or -1 on final grade penalty may apply]

8_R.

Do a research about the following topics:

- The law of large numbers LLN, the various definitions of convergence

- The convergence of the Binomial to the normal and Poisson distributions

- The central limit theorem [in anticipation of a topic we will study later]

Applications / Practice (A)     [work on this at least 30' a day, all days]

8_A. Exercise (also partially described in video 04)

Generate and represent m "sample paths" of n point each (m, n are program parameters), where each point represents a pair of:

time index t, and relative frequency of success f(t),

where f(t) is the sum of t Bernoulli random variables with distribution B(x, p) = p^x(1-p)^(1-x) observed at the various times up to t: j=1, ..., t..

At time n (last time) and one other chosen inner time 1<j<n (where j is a user parameter) represent with a histogram the distribution of f(t).

See also what happens if you replace the relative frequency f(t) with the absolute frequency n(t) or by standard relative frequency: (f(t)-p) / sqrt(p(1-p)/t) [ or some "normalized" sum of bernoulli r.v.'s, eg. n(t) / Math.sqrt(t) ].

Comment briefly on the convergence results you see.

(The general scheme of this exercise, will also be "reused" in next homeworks where we will consider other more interesting stochastic processes.)

(source: homework screenshot by student Lorenzo Zara, year 2020)

6_RA. Do a web research about the various methods proposed to compute the running median (one pass, online algorithms).
Store (cite all sources and attributions) the algorithm(s) that you think is(are) a good candidate, explaining briefly how it works and possibly try a quick demo.

REFERENCES / SOURCES  / USEFUL LINKS:

For applications

_______________________________________________________________________________________

- LESSON 07 -  [4 Nov 2020]

VIDEO LESSONS:

Note: "OPT"  indicates optional video material for extra help: it can be skipped. Same for homework, "OPT" denotes homework that can be skipped.

Theory

Computer applications, and language fundamentals for statistical algos

reorgarnize and clean up your previous code and applications

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: send your link within 14 Nov 2021, or -1 on final grade penalty may apply]

9_R.  History and derivation of the normal distribution. Touch, at least, the following three i mportant perspectives, putting them into an historical context to understand how  the idea developed:

1) as approximation of binomial (De Moivre)
2) as error curve (Gauss)
3) as limit of sum of independent r.v.'s (Laplace)

some video sources:

"The Evolution of the Normal Distribution" https://www.maa.org/sites/default/files/pdf/upload_library/22/Allendoerfer/stahl96.pdf
"The Normal Distribution: A derivation from basic principles" https://www.alternatievewiskunde.nl/QED/normal.pdf
"A Derivation of the Normal Distribution" https://web.sonoma.edu/users/w/wilsonst/papers/Normal/default.html
https://math.stackexchange.com/questions/384893/how-was-the-normal-distribution-derived
"Normal Distributions: The History of the Discovery of Normal Distributions" https://www.youtube.com/watch?v=BXof869EC68
"History of the Normal Distribution" https://www.youtube.com/watch?v=-ftS9UqdA-g
"Normal Distribution, Why is it "Normal"? " https://www.youtube.com/watch?v=nyibbuGFsr8
"Normal distribution's probability density function derived in 5min" https://www.youtube.com/watch?v=ebewBjZmZTw
"The Normal Distribution (1 of 3: Introductory definition)" https://www.youtube.com/watch?v=mHTp7azBhGs
etc.

Applications / Practice (A)     [work on this at least 30' a day, all days]

9_A_1. Create a simulation with graphics to convince yourself of the uniform convergence of the empirical CDF to the theoretical distribution (Glivenko-Cantelli theorem). You may use a simple random variable of your choice for such a demonstration.

https://www.datatime.eu/public/cybersecurity/jsTutorial/22_GlivenkoCantelli.html

9_A_2.  Generate sample paths of jump processes which at each time considered t = 1, ..., n perform jumps computed as:

σ R(t)  (and/or divide by sqrt(1/t) in case you want to make constant the variance at each time by "normalizing" the sum, or divide by sqrt(1/n) in order to obtain standard deviation = σ at last time [the so called "scaling limit"])
where R(t)  is a [-1,1] Rademacher random variable (

-  σ Z(t), where  Z(t) is a N(0,1) random variable (https://en.wikipedia.org/wiki/Normal_distribution)

(and/or divide by sqrt(1/t)  in case you want to make constant the variance at each time by "normalizing" the sum, or divide by sqrt(1/n) in order to obtain standard deviation = σ at last time )

and see what happens as n (simulation parameter, denoting the number of jumps, or subdivision in the "scaling limit") becomes larger.

[As before, at time n (last time) and one other chosen inner time 1<j<n (j is a program parameter) create and represent with histogram the distribution of the process ]

(source:
https://www.datatime.eu/public/StatApp2020/ )

7_RA Do a research about the random walk process and its properties. Compare your finding with your applications drawing your personal conclusions. Explain based on your exercise the beaviour of the distribution of the stochastic process (check out "Donsker's invariance principle"). What are, in particular, its mean and variance at time n ?

REFERENCES / SOURCES  / USEFUL LINKS:

For applications

Random Walk https://en.wikipedia.org/wiki/Random_walk , http://www.math.caltech.edu/~2016-17/2term/ma003/Notes/Lecture16.pdf

_______________________________________________________________________________________

LESSON 08 -  [11 Nov 2021]

STREAMING or VIDEOS LESSONS:

Note: "OPT"  indicates optional video material for extra help: it can be skipped. Same for homework, "OPT " denotes homework that can be skipped.

Theory

Computer applications, and language fundamentals for statistical algos

[revise you stochastic process simulator and your CSV parser and statistics application]

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: send your link within 21 Nov 2021, or -1 on final grade penalty may apply]

10_R. Distributions of the order statistics: look on the web for the most simple (but still rigorous) and clear derivations of the distributions, explaining in your own words the methods used.

11_R. Do a research about the general correlation coefficient for ranks and the most common indices that can be derived by it. Do one example of computation of these correlation coefficients for ranks.

Applications / Practice (A)     [work on this at least 30' a day, all days]

10_A. Given a random variable, extract m samples of size n and plot the empirical distribution of its mean (histogram), the first and the last order statistics. Comment on what you see.

11_A. Discover a new important stochastic process by yourself! Consider the general scheme we have used so far to simulate some stochastic processes (such as the relative frequency of success in a sequence of trials, the sample mean and the random walk) and now add this new process to our process simulator.

Same scheme as previous program (random walk), except changing the way to compute the values of the paths at each time. Starting from value 0 at time 0, for each of m paths, at each new time compute N(i) = N(i-1) + Random step(i), for i = 1, ..., n, where Random step(i) is now a Bernoulli random variable with success probability equal to λ * (1/n)  (where λ is a user parameter, eg. 50, 100, ...).

At time n (last time) and one (or more) other chosen inner time 1<j<n (j is a program parameter) create and represent with histogram the distribution of N(i).

Represent also the distributions of the following quantities (and any other quantity that you think of interest):
- Distance (time elapsed) of individual jumps from the origin
- Distance (time elapsed) between consecutive jumps (the so-called "holding times")

8_RA. Find out on the web what you have just generated in the previous application. Can you find out about all the well known distributions that "naturally arise" in this process ?

Hints:
https://www.probabilitycourse.com/chapter11/11_1_2_basic_concepts_of_the_poisson_process.php
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-262-discrete-stochastic-processes-spring-2011/course-notes/MIT6_262S11_chap02.pdf
https://towardsdatascience.com/the-poisson-distribution-and-poisson-process-explained-4e2cb17d459

REFERENCES / SOURCES  / USEFUL LINKS:

Almost surely https://en.wikipedia.org/wiki/Almost_surely

General correlation coefficient https://en.wikipedia.org/wiki/Rank_correlation
Ranking https://en.wikipedia.org/wiki/Ranking#Ranking_in_statistics
https://us.humankinetics.com/blogs/excerpt/what-is-rank-order-correlation

videos:
https://www.youtube.com/watch?v=DE58QuNKA-c   ("How To... Calculate Spearman's Rank Correlation Coefficient (By Hand)")
https://www.youtube.com/watch?v=gDNmhEBZAO8 ("Rank Correlations: Spearman's and Kendall's Tau")

Quantile function

Quantile function https://en.wikipedia.org/wiki/Quantile_function
Generalized Inverse https://math.stackexchange.com/questions/1801362/generalized-inverse-of-a-function
https://math.stackexchange.com/questions/210683/proof-that-quantile-function-characterizes-probability-distribution
https://math.stackexchange.com/questions/3378799/is-the-sample-quantile-unbiased-for-the-true-quantile

videos
https://www.youtube.com/watch?v=ASHPdWCPBXE ("Cumulative Distribution Function (3 of 3: Locating quantiles)")

For applications

_______________________________________________________________________________________

- LESSON 09 -  [18 Nov 2020]

STREAMING or VIDEOS LESSONS:

Note: "OPT"  indicates optional video material for extra help: it can be skipped. Same for homework, "OPT " denotes homework that can be skipped.

Theory

Computer applications, and language fundamentals for statistical algos

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: send your link within 28 Nov 2021, or -1 on final grade penalty may apply]

12_R.What is the "Brownian motion" and what is a Wiener process. History, importance, definition and applications (Bachelier, Wiener, Einstein, ...):

13_R. An "analog" of the CLT for stochastic process: the standard Wiener process as "scaling limit" of a random walk and the functional CLT (Donsker theorem) or invariance principle. Explain the intuitive meaning of this result and how you have already illustrated the result in your homework.

Applications / Practice (A)     [work on this at least 30' a day, all days]

12_A. Discover one of the most important stochastic process by yourself !

Consider the general scheme we have used so far to simulate stochastic processes (such as the relative frequency of success in a sequence of trials, the sample mean, the random walk, the Poisson point process, etc.) and now add this new process to our simulator.

Starting from value 0 at time 0, for each of m paths, at each new time compute P(t) = P(t-1) + Random step(t), for t = 1, ..., n,
where the Random step(t) is now:

σ * sqrt(1/n) * Z(t),

where  Z(t) is a N(0,1) random variable (the "diffusion" σ is a user parameter, to scale the process dispersion).

At time n (last time) and one (or more) other chosen inner time 1<j<n (j is a program parameter) create and represent with histogram the distribution of P(t). Observe the behavior of the process for large n.

13_A. Create the a distribution representation (histogram, or CDF ...) to represent the following:

- Realizations taken from a Normal(0,1)

- Realizations of the mean, obtained by averaging several times (say m times, m large) n of the above realizations
- Realizations of the variance, obtained by averaging several times (say m times, m large) n of the above realizations

- Realizations taken from exp(N(0,1)))

- Realizations taken from N(0,1) squared

- Realizations taken from a (squared N(0,1)) divided by another (squared N(0,1))

9_RA

Try to find on the web what are the names of the random variables that you just simulated in the applications, and see if the means and variances that you obtain in the simulation are compatible with the "theory". If not fix the possible bugs.

REFERENCES / SOURCES  / USEFUL LINKS::

Stochastic Process definition http://stat.math.uregina.ca/~kozdron/Teaching/Regina/862Winter06/Handouts/revised_lecture1.pdf , https://www.kent.ac.uk/smsas/personal/lb209/files/notes1.pdf

Prof. Steve Lalley course page https://galton.uchicago.edu/~lalley/Courses/    http://galton.uchicago.edu/~lalley/Courses/385/index.html

Stationary Independent Increments https://stats.stackexchange.com/questions/476740/what-is-a-random-process-with-stationary-independent-increments
Independent increments of Poisson process https://stats.stackexchange.com/questions/69498/how-to-prove-the-independent-and-stationary-increment-of-a-poisson-process

Videos:

https://www.youtube.com/watch?v=7mmeksMiXp4  "Brownian motion #1 (basic properties)

For applications

Simulating Brownian motion (BM) and geometric Brownian motion (GBM) http://www.columbia.edu/~ks20/4404-Sigman/4404-Notes-sim-BM.pdf

______________________________________________________________________________________

- LESSON 10 -  [2 Dic 2020]

STREAMING or VIDEOS LESSONS:

Theory

Computer applications, and language fundamentals for statistical algos

[revise and refine your applications and libraries, complete the mini thesis]

HOMEWORK / ASSIGNMENTS (to be published by the student on the personal  blog) :  [DATE DUE: send your link within 16 Dec 2020, or -1 on final grade penalty may apply]

-

Applications / Practice (A)     [work on this at least 30' a day, all days]

-

-

REFERENCES / SOURCES  / USEFUL LINKS:

Sampling from SDE https://quant.stackexchange.com/questions/54266/sampling-from-sde

Brownian motion http://www.math.unl.edu/~sdunbar1/MathematicalFinance/Lessons/StochasticCalculus/GeometricBrownianMotion/geometricbrownian.pdf , http://www-users.math.umn.edu/~grayx004/pdf/FM5002/BMandGBMdoc.pdf

Vasicek https://en.wikipedia.org/wiki/Vasicek_model
Ornstein–Uhlenbeck process https://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process

Stochastic Differential Equation solution for Geometric Brownian Motion https://math.stackexchange.com/questions/2288421/stochastic-differential-equation-solution-for-geometric-brownian-motion

Itô calculus https://en.wikipedia.org/wiki/It%C3%B4_calculus , https://quant.stackexchange.com/questions/23158/ito-formula-for-stochastic-integral

Videos:

https://www.youtube.com/watch?v=p_di4Zn4wz4  ["Differential equations, studying the unsolvable"]

https://www.youtube.com/watch?v=AShtIGjHOTQ    ["Arithmetic Brownian motion: solution ..."]
https://www.youtube.com/watch?v=qdbkvD4N-us   [" 21. Stochastic Differential Equations "]

For applications and exam

Euler–Maruyama method https://en.wikipedia.org/wiki/Euler%E2%80%93Maruyama_method , https://www.math.kit.edu/ianm3/lehre/nummathfin2012w/media/euler_maruyama.pdf
Numerical Simulation of SDE's https://epubs.siam.org/doi/pdf/10.1137/S0036144500378302
Basic affine jump diffusion https://en.wikipedia.org/wiki/Basic_affine_jump_diffusion
Compound Poisson process https://en.wikipedia.org/wiki/Compound_Poisson_process
"Merton’s Jump-Diffusion Model" https://www.csie.ntu.edu.tw/~lyuu/finance1/2015/20150513.pdf
Cox–Ingersoll–Ross model https://en.wikipedia.org/wiki/Cox%E2%80%93Ingersoll%E2%80%93Ross_modell
Heston model https://en.wikipedia.org/wiki/Heston_model
Hull–White model https://en.wikipedia.org/wiki/Hull%E2%80%93White_model

- LESSON 11 -  [9 Dic 2020]

[Skipped on students' request, to allow preparation for exam and completion of projects]

_____________________________________________________________________________________

FINAL EXAM

Written part: this year, instead of 2 midterms, we will simplify the procedure.
Each student will instead produce a detailed "mini thesis" on 1 topic chosen from the following list:

Collect all possible material from web sources about one single specific topic, carefully indicating all sources and attributions.
Your “creativity” must be directed not in “ creating” anything “new”, but in understanding, organizing the material in the most logic and understandable way, paying attention on the math proofs and details. Maximize simplicity and rigour at the same time, whenever possible.

Make sure to include:

1. Historical fact and motivation

2. Intuition

3. Full math details

4. Whatever additional material: demo, video, source code

(Make sure you check all main web sources and Q&A sites (YouTube, Khan academy, wikipedia, wikidata, wikimedia commons, wikisource, stackexchange, quora, reddit, ... specialized articles and sites, and quote all sources with the respective links ...)

Topics:

1. Normal: history, motivation, all proofs, all most important “derived” distributions (chi square, F Fisher, T Student)

2. Online algorithms (mean, variance, median, …): all details about numerical stability, floating point issues, etc.

3. Lebesgue-Stieltjes integral: history, motivation, intuition, usage in probability theory, all the math details

4. Central limit theorem: history, motivation, intuition, all the math details

5. Arithmetic Brownian Motion: history, motivation, intuition, usage, full math details about all most important results

6. Geometric Brownian Motion: history, motivation, intuition, usage, full math details about all most important results

7. Functional central limit theorem (invariance principle or Donsker’s theorem): history, motivation, intuition, full math details

8. Itô integral (Itô calculus): history, motivation, intuition, full math details about all most important results

______________________________________________________________________________________________________________

Final exam submission instructions:

1) Make sure you book the exam on Infostud
2) Send the following material at statisticssapienza@gmail.com in 1 unique email, before the official exam date (at least 3-7 days before)

-1 name, ID
-4 number of "discontinuity penalties" (homeworks not handed on time) accumulated, if any

-5 brief "defense" of your work and study during the course
-7 optional. Two words on: How did you find this course ? What did you like and how would you improve it ??

To speed things up, given the large number of students, if your grade proposal will appear comparatively fair - given your researches online and your final mini thesis - I will accept direcly that on the oral exam, otherwise we will go through a more detailed examination for accurate assessment. (The oral exam will be carried out in any case.)

When ready, send the email with the listed material and we will make an appointment to do thehe
oral exam via remote (will use whatsapp, as usual) (obviously this must happen before the official date exam, so that the exam can be verbalized on the due date.)

[A word of caution (just in case):):
1) If material are essentially identical, in the sense that apart superficial camuflages, they are obviously from the "same hand", they will all be nullified.
2) Please, do not book for the exam if you are not adequately prepared. For an instructor, there are few things less more irritating than students "trying" to pass exams without sufficient preparation or, even worse, trying to cheat using work done by others.]

________________________________________

Useful general purpose free tools

OBS Studio, open broadcaster software (to record video with screen and audio/cam)  https://obsproject.com/
Autodesk SketchBook (to make drawings) https://sketchbook.com/
MP4Tools (simple mp4 cut/join) https://www.mp4joiner.org/en/

JavaScript Tutorial for students https://www.datatime.eu/public/cybersecurity/jsTutorial/

Visual studio code  https://code.visualstudio.com/   [free]
WebStorm (Web dev) [not free]  https://www.jetbrains.com/webstorm/promo/?source=google&medium=cpc&campaign=9641686227&gclid=CjwKCAjwtfqKBhBoEiwAZuesiB05XZrJPP0mypXfXzxuRqaqbANGtnp9o_BSQ_t3bnl14aBGbRbDMBoCfmsQAvD_BwE

HTML Corrector: https://www.htmlcorrector.com/
HTML Validator: https://www.freeformatter.com/html-validator.html
Spell check: https://spellcheckplus.com/