Commit 9f14562e authored by G. Jay Kerns's avatar G. Jay Kerns

small changes

parent 55b810be
...@@ -115,32 +115,8 @@ The place to get the latest version of ESS is [[http://stat.ethz.ch/ESS/index.ph ...@@ -115,32 +115,8 @@ The place to get the latest version of ESS is [[http://stat.ethz.ch/ESS/index.ph
(setq inferior-julia-program-name "/path/to/julia-release-basic") (setq inferior-julia-program-name "/path/to/julia-release-basic")
#+END_SRC #+END_SRC
* Fitting (generalized) linear models
#+BEGIN_SRC julia
using RDatasets, DataFrames, Distributions, GLM
trees = data("datasets", "trees");
treeslm = lm(:(Girth ~ Height + Volume), trees);
coef(treeslm)
coeftable(treeslm)
#+END_SRC
#+RESULTS:
#+begin_example
3-element Float64 Array:
10.8164
-0.0454835
0.19518
3x4 DataFrame:
Estimate Std.Error t value Pr(>|t|)
[1,] 10.8164 1.9732 5.48165 7.44691e-6
[2,] -0.0454835 0.0282621 -1.60935 0.118759
[3,] 0.19518 0.0109553 17.8161 8.2233e-17
#+end_example
* Prerequisites
* Installation prerequisites
** Org-mode ** Org-mode
...@@ -160,11 +136,19 @@ This is about ESS. ...@@ -160,11 +136,19 @@ This is about ESS.
* Graphics * Graphics
The most stable and fully featured of the =julia= graphics packages at the time of this writing appears to be the =Winston= package, among alternatives including =Gadfly=.
#+BEGIN_SRC julia :eval never
Pkg.add("Winston")
#+END_SRC
The Winston package has lots of dependencies and many of them must be built from source (on Ubuntu).
** Plotting with Winston ** Plotting with Winston
#+BEGIN_SRC julia :results graphics :file example1.png :eval no-export #+BEGIN_SRC julia :results graphics :file example1.png :eval no-export
using Winston using Winston
x = linspace( 0, 3pi, 100 ) x = linspace(0, 3pi, 100)
c = cos(x) c = cos(x)
s = sin(x) s = sin(x)
p = FramedPlot(); p = FramedPlot();
...@@ -192,7 +176,6 @@ p = plot(iris, {:x => "Sepal.Length", :y => "Sepal.Width"}, Geom.point); ...@@ -192,7 +176,6 @@ p = plot(iris, {:x => "Sepal.Length", :y => "Sepal.Width"}, Geom.point);
SVG("iris_plot.svg", 6inch, 4inch) SVG("iris_plot.svg", 6inch, 4inch)
#+END_SRC #+END_SRC
* Exporting to other formats * Exporting to other formats
** LaTeX ** LaTeX
...@@ -208,3 +191,26 @@ SVG("iris_plot.svg", 6inch, 4inch) ...@@ -208,3 +191,26 @@ SVG("iris_plot.svg", 6inch, 4inch)
- when :results value be careful because of readcsv - when :results value be careful because of readcsv
- characters - characters
- 1x1 matrix - 1x1 matrix
* Fitting (generalized) linear models
#+BEGIN_SRC julia
using RDatasets, DataFrames, Distributions, GLM
trees = data("datasets", "trees");
treeslm = lm(:(Girth ~ Height + Volume), trees);
coef(treeslm)
coeftable(treeslm)
#+END_SRC
#+RESULTS:
#+begin_example
3-element Float64 Array:
10.8164
-0.0454835
0.19518
3x4 DataFrame:
Estimate Std.Error t value Pr(>|t|)
[1,] 10.8164 1.9732 5.48165 7.44691e-6
[2,] -0.0454835 0.0282621 -1.60935 0.118759
[3,] 0.19518 0.0109553 17.8161 8.2233e-17
#+end_example
No preview for this file type
% Created 2013-02-27 Wed 22:41 % Created 2013-02-28 Thu 14:25
\documentclass[11pt]{article} \documentclass[11pt]{article}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
...@@ -22,15 +22,16 @@ ...@@ -22,15 +22,16 @@
\hypersetup{ \hypersetup{
pdfkeywords={}, pdfkeywords={},
pdfsubject={}, pdfsubject={},
pdfcreator={Generated by Org mode 7.9.3f in Emacs 24.3.50.1.}} pdfcreator={Generated by Org mode 7.9.3e in Emacs 24.3.50.1.}}
\begin{document} \begin{document}
\maketitle \maketitle
\tableofcontents \tableofcontents
\vspace*{1cm}
One of the reasons for this document is that I wanted to make it easier to get acquainted with \texttt{julia}. One of the reasons for this document is that I wanted to make it easier to get acquainted with \texttt{julia}.
\section[What you need to get started]{What you need to get started} \section{What you need to get started}
\label{sec-1} \label{sec-1}
This document assumes you have at least a passing familiarity with Org-mode and Emacs keybindings. This document assumes you have at least a passing familiarity with Org-mode and Emacs keybindings.
...@@ -44,13 +45,13 @@ This document assumes you have at least a passing familiarity with Org-mode and ...@@ -44,13 +45,13 @@ This document assumes you have at least a passing familiarity with Org-mode and
\item[Note:] a lot of the code blocks below have the header argument \texttt{:eval no-export} which means that the code block can be evaluated interactively in this session by \texttt{C-c C-c} with point in the code block but will \emph{not} be evaluated during export. The reason is that those blocks have settings which conflict with my current setup but would be useful for others going through this document. \item[Note:] a lot of the code blocks below have the header argument \texttt{:eval no-export} which means that the code block can be evaluated interactively in this session by \texttt{C-c C-c} with point in the code block but will \emph{not} be evaluated during export. The reason is that those blocks have settings which conflict with my current setup but would be useful for others going through this document.
\end{description} \end{description}
\subsection[Julia]{Julia} \subsection{Julia}
\label{sec-1-1} \label{sec-1-1}
\begin{itemize} \begin{itemize}
\item First install takes the longest, later updates not so bad. \item First install takes the longest, later updates not so bad.
\item all the dependencies \item all the dependencies
\end{itemize} \end{itemize}
\subsection[Add-on packages]{Add-on packages} \subsection{Add-on packages}
\label{sec-1-2} \label{sec-1-2}
Based on \href{http://www.johnmyleswhite.com/notebook/2012/12/02/the-state-of-statistics-in-julia/}{The State of Statistics in Julia} by John Myles White. Based on \href{http://www.johnmyleswhite.com/notebook/2012/12/02/the-state-of-statistics-in-julia/}{The State of Statistics in Julia} by John Myles White.
...@@ -87,7 +88,7 @@ Pkg.add("Gadfly") ...@@ -87,7 +88,7 @@ Pkg.add("Gadfly")
\item packages take a lot longer to load than R \item packages take a lot longer to load than R
\end{itemize} \end{itemize}
\end{enumerate} \end{enumerate}
\subsection[Org-mode]{Org-mode} \subsection{Org-mode}
\label{sec-1-3} \label{sec-1-3}
This document assumes that you have at least a passing familiarity with org-mode such that you likely have something like the following already in your \texttt{.emacs}: This document assumes that you have at least a passing familiarity with org-mode such that you likely have something like the following already in your \texttt{.emacs}:
...@@ -132,7 +133,7 @@ If you'd like to do \LaTeX{} export then put the following in your emacs. ...@@ -132,7 +133,7 @@ If you'd like to do \LaTeX{} export then put the following in your emacs.
(require 'ox-latex) (require 'ox-latex)
(require 'ox-beamer) (require 'ox-beamer)
\end{verbatim} \end{verbatim}
\subsection[ESS - Emacs Speaks Statistics]{ESS - Emacs Speaks Statistics} \subsection{ESS - Emacs Speaks Statistics}
\label{sec-1-4} \label{sec-1-4}
The place to get the latest version of ESS is \href{http://stat.ethz.ch/ESS/index.php?Section=download}{here}. The place to get the latest version of ESS is \href{http://stat.ethz.ch/ESS/index.php?Section=download}{here}.
...@@ -145,68 +146,48 @@ The place to get the latest version of ESS is \href{http://stat.ethz.ch/ESS/inde ...@@ -145,68 +146,48 @@ The place to get the latest version of ESS is \href{http://stat.ethz.ch/ESS/inde
\begin{verbatim} \begin{verbatim}
(setq inferior-julia-program-name "/path/to/julia-release-basic") (setq inferior-julia-program-name "/path/to/julia-release-basic")
\end{verbatim} \end{verbatim}
\section[Fitting (generalized) linear models]{Fitting (generalized) linear models}
\label{sec-2}
\begin{verbatim} \section{Prerequisites}
using RDatasets, DataFrames, Distributions, GLM \label{sec-2}
trees = data("datasets", "trees");
treeslm = lm(:(Girth ~ Height + Volume), trees);
coef(treeslm)
coeftable(treeslm)
\end{verbatim}
\begin{verbatim} \subsection{Org-mode}
Warning: New definition show(Any,LmMod) is ambiguous with show(IO,ANY) at show.jl:6. \label{sec-2-1}
Make sure show(IO,LmMod) is defined first.
Warning: New definition show(Any,GlmMod) is ambiguous with show(IO,ANY) at show.jl:6.
Make sure show(IO,GlmMod) is defined first.
WARNING: strcat is deprecated, use string instead.
WARNING: qrd is deprecated, use qrfact instead.
3-element Float64 Array:
10.8164
-0.0454835
0.19518
3x4 DataFrame:
Estimate Std.Error t value Pr(>|t|)
[1,] 10.8164 1.9732 5.48165 7.44691e-6
[2,] -0.0454835 0.0282621 -1.60935 0.118759
[3,] 0.19518 0.0109553 17.8161 8.2233e-17
\end{verbatim}
\subsection{ESS}
\label{sec-2-2}
\section[Installation prerequisites]{Installation prerequisites} \subsection{julia}
\label{sec-2-3}
\section{Interactive session evaluation}
\label{sec-3} \label{sec-3}
\subsection[Org-mode]{Org-mode} This is about ESS.
\label{sec-3-1} \section{Evaluation inside the Org buffer}
\subsection[ESS]{ESS}
\label{sec-3-2}
\subsection[julia]{julia}
\label{sec-3-3}
\section[Interactive session evaluation]{Interactive session evaluation}
\label{sec-4} \label{sec-4}
This is about ESS. \subsection{:results value}
\section[Evaluation inside the Org buffer]{Evaluation inside the Org buffer} \label{sec-4-1}
\subsection{:results output}
\label{sec-4-2}
\section{Graphics}
\label{sec-5} \label{sec-5}
\subsection[:results value]{:results value} The most stable and fully featured of the \texttt{julia} graphics packages at the time of this writing appears to be the \texttt{Winston} package, among alternatives including \texttt{Gadfly}.
\label{sec-5-1}
\subsection[:results output]{:results output} \begin{verbatim}
\label{sec-5-2} Pkg.add("Winston")
\section[Graphics]{Graphics} \end{verbatim}
\label{sec-6}
\subsection[Plotting with Winston]{Plotting with Winston} The Winston package has lots of dependencies and many of them must be built from source (on Ubuntu).
\label{sec-6-1}
\subsection{Plotting with Winston}
\label{sec-5-1}
\begin{verbatim} \begin{verbatim}
using Winston using Winston
x = linspace( 0, 3pi, 100 ) x = linspace(0, 3pi, 100)
c = cos(x) c = cos(x)
s = sin(x) s = sin(x)
p = FramedPlot(); p = FramedPlot();
...@@ -221,8 +202,8 @@ file(p, "example1.png") ...@@ -221,8 +202,8 @@ file(p, "example1.png")
\includegraphics[width=.9\linewidth]{example1.png} \includegraphics[width=.9\linewidth]{example1.png}
\subsection[Plotting with Gadfly]{Plotting with Gadfly} \subsection{Plotting with Gadfly}
\label{sec-6-2} \label{sec-5-2}
\begin{verbatim} \begin{verbatim}
using RDatasets using RDatasets
...@@ -232,20 +213,19 @@ iris = data("datasets", "iris") ...@@ -232,20 +213,19 @@ iris = data("datasets", "iris")
p = plot(iris, {:x => "Sepal.Length", :y => "Sepal.Width"}, Geom.point); p = plot(iris, {:x => "Sepal.Length", :y => "Sepal.Width"}, Geom.point);
SVG("iris_plot.svg", 6inch, 4inch) SVG("iris_plot.svg", 6inch, 4inch)
\end{verbatim} \end{verbatim}
\section{Exporting to other formats}
\label{sec-6}
\section[Exporting to other formats]{Exporting to other formats} \subsection{\LaTeX{}}
\label{sec-7} \label{sec-6-1}
\subsection[\LaTeX{}]{\LaTeX{}}
\label{sec-7-1}
\subsection[HTML]{HTML} \subsection{HTML}
\label{sec-7-2} \label{sec-6-2}
\subsection[Beamer]{Beamer} \subsection{Beamer}
\label{sec-7-3} \label{sec-6-3}
\section[Other things]{Other things} \section{Other things}
\label{sec-8} \label{sec-7}
\begin{itemize} \begin{itemize}
\item empty lines in output for semicoloned lines \item empty lines in output for semicoloned lines
...@@ -256,5 +236,33 @@ SVG("iris_plot.svg", 6inch, 4inch) ...@@ -256,5 +236,33 @@ SVG("iris_plot.svg", 6inch, 4inch)
\item 1x1 matrix \item 1x1 matrix
\end{itemize} \end{itemize}
\end{itemize} \end{itemize}
% Generated by Org mode 7.9.3f in Emacs 24.3.50.1. \section{Fitting (generalized) linear models}
\label{sec-8}
\begin{verbatim}
using RDatasets, DataFrames, Distributions, GLM
trees = data("datasets", "trees");
treeslm = lm(:(Girth ~ Height + Volume), trees);
coef(treeslm)
coeftable(treeslm)
\end{verbatim}
\begin{verbatim}
Warning: New definition show(Any,LmMod) is ambiguous with show(IO,ANY) at show.jl:6.
Make sure show(IO,LmMod) is defined first.
Warning: New definition show(Any,GlmMod) is ambiguous with show(IO,ANY) at show.jl:6.
Make sure show(IO,GlmMod) is defined first.
WARNING: strcat is deprecated, use string instead.
WARNING: qrd is deprecated, use qrfact instead.
3-element Float64 Array:
10.8164
-0.0454835
0.19518
3x4 DataFrame:
Estimate Std.Error t value Pr(>|t|)
[1,] 10.8164 1.9732 5.48165 7.44691e-6
[2,] -0.0454835 0.0282621 -1.60935 0.118759
[3,] 0.19518 0.0109553 17.8161 8.2233e-17
\end{verbatim}
% Generated by Org mode 7.9.3e in Emacs 24.3.50.1.
\end{document} \end{document}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment