# -*- mode: org -*- # -*- coding: utf-8 -*- #+STARTUP: overview indent inlineimages logdrawer #+TITLE: Journal #+AUTHOR: Put your name here #+LANGUAGE: en #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+LATEX_HEADER: \usepackage[utf8]{inputenc} #+LATEX_HEADER: \usepackage[T1]{fontenc} #+LATEX_HEADER: \usepackage[a4paper,margin=.8in]{geometry} #+LATEX_HEADER: \usepackage[french]{babel} #+TAGS: LIG(L) HOME(H) Europe(E) Blog(B) noexport(n) Stats(S) #+TAGS: Epistemology(E) Vulgarization(V) Teaching(T) R(R) OrgMode(O) Python(P) #+EXPORT_SELECT_TAGS: Blog #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+COLUMNS: %25ITEM %TODO %3PRIORITY %TAGS #+SEQ_TODO: TODO(t!) STARTED(s!) WAITING(w@) APPT(a!) | DONE(d!) CANCELLED(c!) DEFERRED(f!) * 2021 ** 2021-03 mars *** 2021-03-02 mardi **** Premier pas avec org mode -note1 -note2 #+begin_src R :results output :session *R* :exports both summary(cars) #+end_src #+RESULTS: : speed dist : Min. : 4.0 Min. : 2.00 : 1st Qu.:12.0 1st Qu.: 26.00 : Median :15.0 Median : 36.00 : Mean :15.4 Mean : 42.98 : 3rd Qu.:19.0 3rd Qu.: 56.00 : Max. :25.0 Max. :120.00 #+begin_src R :results output graphics :file (org-babel-temp-file "figure" ".png") :exports both :width 600 :height 400 :session *R* plot(cars) #+end_src #+RESULTS: #+begin_src R :results output graphics :file (org-babel-temp-file "figure" ".png") :exports both :width 600 :height 400 :session *R* plot(cars) #+end_src #+RESULTS: [[file:/tmp/babel-cFH86o/figureNFJuq7.png]] #+begin_src python :results output :exports both print("hello word") #+end_src #+RESULTS: : hello word #+begin_src python :results output :session :exports both x=10 #+end_src #+RESULTS: #+begin_src python :results file :session :var matplot_lib_filename="foo.png") :exports both import matplotlib.pyplot as plt import numpy x=numpy.linspace(-15,15) plt.figure(figsize=(10,5)) plt.plot(x,numpy.cos(x)/x) plt.tight_layout() plt.savefig(matplot_lib_filename) matplot_lib_filename #+end_src #+RESULTS: [[file:foo.png]] Entered on [2021-03-02 mar. 14:09] [[file:~/org/journal.org::*Org-mode Babel (for literate programming)][Org-mode Babel (for literate programming)]] *** 2021-03-03 mercredi **** FUN MOOC reproductibility ***** Exercice 2.4 I worked on the Cars data from R, i trained myself on the usage of orgmode en the realisation of a journal following the Mooc recommendation. Firts I create a csv file in R with the Cars data #+begin_src R :results output :session *R* :exports both data <- cars write.csv(data, 'data_cars_exercice2_3.csv') #+end_src Then i load to make statistic on it, the goal here is to see if the distance cross by a car is influenced by its speed. #+begin_src R :results output graphics :file data_cars_graph.png :exports both :width 600 :height 400 :session *R* data <- read.csv('data_cars_exercice2_3.csv') scatter.smooth(x=data$speed, y=data$dist, main="Dist ~ Speed") #+end_src #+RESULTS: file:data_cars_graph Here the graph is almost a line, so it will be insteresting to made a correlation analasys of this data #+begin_src R :results output :session *R* :exports both cor(data$speed, data$dist) #+end_src #+RESULTS: : [1] 0.8068949 The correlation between speed and distance is high ( < 0.5) and positive, which mean higher is the speed, higher will be the distance. Now to be sure that my hypthesis is good i will apply a the linear regression. #+begin_src R :results output :session *R* :exports both linearMod <- lm(dist ~ speed, data=data) summary(linearMod) #+end_src #+RESULTS: #+begin_example Call: lm(formula = dist ~ speed, data = data) Residuals: Min 1Q Median 3Q Max -29.069 -9.525 -2.272 9.215 43.201 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -17.5791 6.7584 -2.601 0.0123 * speed 3.9324 0.4155 9.464 1.49e-12 *** --- codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 15.38 on 48 degrees of freedom Multiple R-squared: 0.6511, Adjusted R-squared: 0.6438 F-statistic: 89.57 on 1 and 48 DF, p-value: 1.49e-12 #+end_example LinearMod, both these p-Values are well below the 0.05 threshold, so I can conclude our model is indeed statistically significant, which mean, now i'm sure that the speed influence the distance