%% -*- mode: LaTeX; coding: iso-8859-1; -*-
%%
%% Author:      Peter J. Acklam
%% Time-stamp:  2001-08-31 19:36:07 +0200
%% E-mail:      jacklam@math.uio.no
%% URL:         http://www.math.uio.no/~jacklam

\documentclass[%
a4paper,        % paper size
10pt,           % font size of running text
oneside,        % one or two-side layout
onecolumn,      % number of columns on each page
norsk,          % document language (for babel et al.)
draft,          % draft mode
%% dvips,          % driver for `graphics', `color', et al.
%% titlepage,      % put the title on a page of its own
]{article}       % document class

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Input encoding and output encoding.
%%
\usepackage[latin1]{inputenc}   % The input encoding
\usepackage[T1]{fontenc}        % The output encoding

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Enable other languages than english.  Use \selectlanguage to switch to
%% another language.  All languages used, that are not given as options
%% to the document class, must be given as options to the babel package.
%%
\usepackage{babel}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Enable more math macros, environments and fonts.
%%
\usepackage{amsmath}            % For extra math macros etc.
%%\usepackage{amssymb}            % For extra math symbols and fonts

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Enable certain special symbols for use in text.
%%
\usepackage{textcomp}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Show page layout.  To see page layout, uncomment this and put \layout
%% after \begin{document}.
%%
%%\usepackage{layout}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Needed for producing an index.  Put the \printindex command where you
%% want the index to be printed.
%%
%%\usepackage{makeidx}
%%\makeindex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Enable inclusion of graphics.  Use \includegraphics to include
%% a graphics image.
%%
%%\usepackage[dvips]{graphicx}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Fancy verbatim stuff.
%%
%%\usepackage{fancyvrb}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% To get PostScript fonts uncomment the following lines of code.
%% (There is no Post Script Bold Symbol font so we fake it with Poor
%% Man's Bold.)
%%
%%\usepackage{times}                      % PostScript text fonts
%%\usepackage{mathptmx}                   % PostScript math fonts
%%\renewcommand{\boldsymbol}[1]{\pmb{#1}} % Fake Bold Symbol font

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% To get fancy headers and footers.
%%
%%\usepackage{fancyhdr}

%% Headers and footers.
%%\lhead{\docdate}                % Left header.
%%\chead{}                        % Center header.
%%\rhead{\docauthor}              % Right header.
%%\lfoot{}                        % Left footer.
%%\cfoot{\thepage}                % Center footer.
%%\rfoot{}                        % Right footer.

%% No rulers below header and above footer.
%%\renewcommand{\headrulewidth}{0pt}
%%\renewcommand{\footrulewidth}{0pt}

%%\pagestyle{fancy}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Page layout.
%%
%% Set margins for odd and even pages.
\setlength{\oddsidemargin}{-1in}
\addtolength{\oddsidemargin}{3.5cm}
%%\setlength{\evensidemargin}{\oddsidemargin}

%% % Center the text on page horizontally.
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-2in}
\addtolength{\textwidth}{-2\oddsidemargin}

%% % Set the margins on the top of the paper.
%% \setlength{\topmargin}{0cm}
%% %\setlength{\headheight}{0cm}
%% %\setlength{\headsep}{0cm}
%%
%% % Calculate new height of text area.
%% \setlength{\textheight}{\paperheight}
%% \addtolength{\textheight}{-2in}
%% \addtolength{\textheight}{-2\topmargin}
%% \addtolength{\textheight}{-\headheight}
%% \addtolength{\textheight}{-\headsep}
%% \addtolength{\textheight}{-\footskip}
%%
%% % Calculate new margin width.
%% \setlength{\marginparwidth}{\paperwidth}
%% \addtolength{\marginparwidth}{-1in}
%% \addtolength{\marginparwidth}{-\oddsidemargin}
%% \addtolength{\marginparwidth}{-\textwidth}
%% \addtolength{\marginparwidth}{-\marginparsep}
%% \addtolength{\marginparwidth}{-1cm}

%% Use blank line, not indent, to separate paragraphs.
%%\setlength{\parindent}{0pt}
%%\setlength{\parskip}{0.7\baselineskip}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This is from `testmath.tex'.
%%
%%\makeatletter
%%
%% This turns on vertical rules at the right and left margins, to
%% better illustrate the spacing for certain multiple-line equation
%% structures.
%%\def\@makecol{\ifvoid\footins \setbox\@outputbox\box\@cclv
%%   \else\setbox\@outputbox
%%     \vbox{\boxmaxdepth \maxdepth
%%     \unvbox\@cclv\vskip\skip\footins\footnoterule\unvbox\footins}\fi
%%  \xdef\@freelist{\@freelist\@midlist}\gdef\@midlist{}\@combinefloats
%%  \setbox\@outputbox\hbox{\vrule width\marginrulewidth
%%        \vbox to\@colht{\boxmaxdepth\maxdepth
%%         \@texttop\dimen128=\dp\@outputbox\unvbox\@outputbox
%%         \vskip-\dimen128\@textbottom}%
%%        \vrule width\marginrulewidth}%
%%     \global\maxdepth\@maxdepth}
%%\newdimen\marginrulewidth
%%\setlength{\marginrulewidth}{.1pt}
%%\makeatother
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% New commands.
%%

%% Standard definitions
\newcommand{\Var}{\mathop{\mathrm{Var}}\nolimits}       % Variance
\newcommand{\VAR}{\mathop{\mathrm{VAR}}\nolimits}       % Variance
\newcommand{\Cov}{\mathop{\mathrm{Cov}}\nolimits}       % Covariance
\newcommand{\COV}{\mathop{\mathrm{COV}}\nolimits}       % Covariance
\newcommand{\Corr}{\mathop{\mathrm{Corr}}\nolimits}     % Correlation
\newcommand{\Sdev}{\mathop{\mathrm{Sdev}}\nolimits}     % Standard deviation
\newcommand{\Sdevhat}{\widehat{\Sdev}}                  % Estimated st. dev.
%%\newcommand{\Std}{\mathop{\mathrm{Std}}\nolimits}       % Standard deviation
%%\newcommand{\Stdhat}{\widehat{\Std}}                    % Estimated st. dev.
%%\newcommand{\Stan}{\mathop{\mathrm{Stan}}\nolimits}     % Standard deviation
%%\newcommand{\Stanhat}{\widehat{\Stan}}                  % Estimated st. dev.

%% Statistical distributions
\newcommand{\Bin}{\mathop{\mathrm{Bin}}\nolimits}           % Binomial
\newcommand{\Exp}{\mathop{\mathrm{Exp}}\nolimits}           % Exponential
\newcommand{\Poisson}{\mathop{\mathrm{Poisson}}\nolimits}   % Poisson

%% Standard error
\newcommand{\SE}{\mathop{\mathrm{SE}}\nolimits}

%% Mean standard error
\newcommand{\MSE}{\mathop{\mathrm{MSE}}\nolimits}

%% Bias
\newcommand{\bias}{\mathop{\mathrm{bias}}\nolimits}

%% Uavhengig og identisk fordelte
\newcommand{\uif}{\overset{\text{u.i.f.}}{\sim}}

%% Independent and identically distributed
\newcommand{\iid}{\overset{\text{i.i.d.}}{\sim}}

%% Convergence in probability
\newcommand{\cip}{\overset{\text{P}}{\rightarrow}}
\newcommand{\limp}{\mathop{\mathrm{lim\,p}}}

%% Convergence almost surely
\newcommand{\cas}{\overset{\text{a.s.}}{\rightarrow}}
\newcommand{\plim}{\mathop{\mathrm{p\,lim}}}

%% Konvergens nesten sikkert
\newcommand{\kns}{\overset{\text{n.s.}}{\rightarrow}}

%% Convergence in distribution
\newcommand{\cid}{\overset{\text{d}}{\rightarrow}}

%% Equality in distribution
\newcommand{\eid}{\overset{\text{d}}{=}}

%% Akaike's information criterion
\newcommand{\aic}{\mathop{\mathrm{AIC}}\nolimits}

%% Signum function
\newcommand{\sign}{\mathop{\mathrm{sign}}\nolimits}

%% Indicator function
\newcommand{\indicator}{\mathop{\mathrm{I}}\nolimits}

%% Equality by definition
\newcommand{\defeq}{\stackrel{\text{def}}{=}}

%% Miscellaneous other commands
\newcommand{\matlab}{\textsc{Matlab}}

%%
%% Hyphenation patterns.
%%
\hyphenation{}

%%
%%
%%
\usepackage{theorem}

\theoremheaderfont{\large\bfseries}
{\theorembodyfont{\upshape}
  \theoremstyle{break}\newtheorem{oppg}{Oppgave}
  \theoremstyle{break}\newtheorem{algo}{Algoritme}
}

%% Level one lists should use (a), (b), ...
\renewcommand{\theenumi}{\alph{enumi}}
\renewcommand{\labelenumi}{(\textit{\theenumi})}

%% Level two lists should use (i), (ii), ...
\renewcommand{\theenumii}{\roman{enumii}}
\renewcommand{\labelenumii}{(\textit{\theenumii})}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Display some information about how to process this document.
%%
\typeout{************************************************************}
\typeout{*}
\typeout{* First run latex (and maybe also bibtex and makeindex)}
\typeout{* as many times as necessary to create the DVI-file.}
\typeout{*}
\typeout{* Then convert from DVI to PS with something like}
\typeout{*}
\typeout{* \space\space dvips -D 600 \jobname.dvi -o}
\typeout{*}
\typeout{* Then convert from PS to PDF with either}
\typeout{*}
\typeout{* \space\space ps2pdf \jobname.ps \jobname.pdf}
\typeout{*}
\typeout{* or, if Adobe Distiller is available,}
\typeout{*}
\typeout{* \space\space distill \jobname.ps}
\typeout{*}
\typeout{************************************************************}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Set document title, author and date.
%%
\title{\matlab-oppgaver i ST100}
\author{Peter J. Acklam}
%%\date{2.~august 2001}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Now the actual contents of the document.
%%
\begin{document}

%%\layout                         % Show document layout.

%%\maketitle                      % Print document title

%%\begin{oppg}

\noindent
\textbf{\large Oppgave 2}\\[0.1cm]
Før du begynner på denne oppgaven må du ha skaffet deg notatet
«Introduksjon til\\  \matlab».  Du må også ha skaffet deg (og lest!)
notatet  «Beskrivende statistikk», hvor de statistiske metodene i punktene
(b)--(d) er nærmere omtalt. Både
MATLAB-introduksjonen og notatet om beskrivende statistikk finner du
på hjemmesiden til STK1100.

\begin{enumerate}

\item Et menneskes vitalkapasitet er den totale mengde luft en klarer å
  blåse ut etter å ha fylt lungene maksimalt.  I~en undersøkelse ble
  vitalkapasiteten målt for 12 voksne personer med følgende resultat (i
  liter):
  %%
  \begin{quotation}
    3.9 5.6 4.1 4.2 4.0 3.6 5.9 4.5 3.6 5.0 2.9 4.3
  \end{quotation}
  %%
  Les disse dataene inn i \matlab\, enten ved å skrive dem rett inn i
  en variabel, eller ved å skrive dataene inn i en tekstfil som leses
  inn i en variabel med kommandoen \texttt{load}; jf.\ avsnittene~3.1
  og 11 i heftet «Introduksjon til \matlab».

\item Beregn gjennomsnitt, empirisk median, empirisk standardavvik og
kvartildifferanse  til dataene i punkt (a); jf.\ avsnitt~9
  i heftet «Introduksjon til \matlab».   Pass på at du forstår hva
  \matlab\ har beregnet!

\item Lag et histogram av dataene i punkt (a).  Hvis du har dataene liggende
  i variabelen \texttt{x}, kan du lage histogram med \texttt{hist(x)}.

  \matlab\ bruker alltid ti (like brede) intervaller med mindre man selv
  spesifiserer et annet antall intervaller.  Man kan sette antall
  intervaller ved å bruke \texttt{hist(x,n)}, hvor \texttt{n} er
  antall intervaller.  Forsøk med forskjellige verdier for \texttt{n}
  og se hvordan histogrammet endrer seg.  Hvilken verdi for \texttt{n}
  synes du er best?

\item Enkelte ganger kan det være mer  hensiktsmessig å angi selve 
  intervallene framfor
  å angi antall intervaller.  Dette gjøres med \texttt{histc}. Siden
  \texttt{histc} kan ikke plotte selv, må vi først bruke \texttt{histc}
  for å beregne hvor mange observasjoner som faller i hvert intervall, og så
  bruke \texttt{bar} for å plotte.

  Her følger et eksempel hvor det er brukt to intervaller -- ett fra 2--4 og
  ett fra 4--6.
  %%
\begin{verbatim}
  edges = [2, 4, 6];          % definer intervallene
  k = histc(x, edges);        % teller opp antall i hvert intervall
  bar(edges, k, 'histc');     % plotter histogrammet
  figure(gcf);                % får fram figurvinduet 
\end{verbatim}
  %%
  (Den siste linjen kan brukes når figurvinduet er gjemt bak 
  et annet vindu.  Kommandoen \texttt{gcf} står for «get current figure», og
  den returnerer nummeret på figuren som det plottes i for øyeblikket, mens
  \texttt{figure} sørger for å bringe den angitte figuren fram.)

  Ta utganspunkt i eksemplet over. Bruk nå intervallene
  2--3, 3--4, 4--5 og 5--6, og plott histogrammet.

\item  Lag endelig et normert histogram.  At et histogram er normert vil si at
  arealet under histogrammet er lik én.  Skalér verdiene i \texttt{k}
  som nødvendig og plott på nytt.

\end{enumerate}

\end{document}

\pagebreak

\begin{oppg}
  test 2
\end{oppg}

\begin{oppg}[hallo]
  test 3
\end{oppg}

\begin{oppg}[bla bla]
  test 4
\end{oppg}

%%\addcontentsline{toc}{section}{\bibname}%
%%\bibliography{peter}

%%\addcontentsline{toc}{section}{\indexname}%
%%\printindex

\end{document}

3.9 5.6 4.1 4.2 4.0 3.6 5.9 4.5 3.6 5.0 2.9 4.3
