<file_sep># Opgave 8
avit <- read.table("avit.txt", header=TRUE) # Indlæs datasættet

# Opgave 9
avitM <- subset(avit, sex==1)$avit # Udtag mændenes avit-indtag
length(avitM) # Tæl mændene
logavitM <- log(avitM)

# Opgave 10
pdf("graphs/analyse_1.pdf")
hist(avitM) # Histogram for avitM
dev.off()

pdf("graphs/analyse_2.pdf")
qqnorm(avitM) # QQ-plot for avitM
dev.off()

pdf("graphs/analyse_3.pdf")
hist(logavitM) # Histogram for logavitM
dev.off()

pdf("graphs/analyse_4.pdf")
qqnorm(logavitM) # QQ-plot for logavitM
dev.off()

# Opgave 11
mean(logavitM) # Gennemsnittet af logavitM
var(logavitM) # Stikprøvevariansen af logavitM
sd(logavitM) # Stikprøvespredningen af ligavitM

# Opgave 12
pdf("graphs/analyse_5.pdf")
hist(logavitM, prob=T, nclass=25)
f = function(x) dnorm(x, mean(logavitM), sd(logavitM))
plot(f, 0,9, add=T)
dev.off()

lnorm = function(y, mu, sigma) 1/(y*sqrt(2*pi*sigma^2)) * exp(-((log(y) - mu)^2) / (2*sigma^2))
pdf("graphs/analyse_6.pdf")
hist(avitM, prob=T, nclass=25)
g = function(x) lnorm(x, mean(logavitM), sd(logavitM))
plot(g, 0, 8000, add=T)
dev.off()
<file_sep>GRAPHS=
TARGET=aflevering.pdf
TEXFILES=*.tex
HELPFILES=

all: $(TARGET)

$(TARGET): $(GRAPHS) $(TEXFILES) $(HELPFILES) Makefile

clean:
	rm -rf *.aux *.log *.out *.toc *.eps *.data *.o *.hi *~ $(GRAPHS) $(TARGET)

%.svg: %.dot
	dot $*.dot -Tsvg -o $*.svg

%.png: %.dot
	dot $*.dot -Tpng -o $*.png

%.ps: %.dot
	dot $*.dot -Tps -o $*.ps

%_dot.pdf: %.dot
	dot $*.dot -Tpdf -o $*_dot.pdf

%_neato.pdf: %.dot
	neato $*.dot -Tpdf -o $*_neato.pdf

%_circo.pdf: %.dot
	circo $*.dot -Tpdf -o $*_circo.pdf

%.mapleout: %.maple
	$(HOME)/bin/maple $*.maple > $*.mapleout

%_guimaple.ps: %.maple
	mwrapper $*.maple

%_maple.ps: %.maple
	$(HOME)/bin/maple $*.maple


%_dia.eps: %.dia
	dia $*.dia -e $*_dia.eps

%_eps.pdf: %.eps
	epstopdf $*.eps -o $*_eps.pdf

%.pdf: %.tex
	pdflatex $*.tex
	pdflatex $*.tex
	pdflatex $*.tex

print: $(TARGET)
	cat $(TARGET) | ssh <EMAIL> lp -d m1b
<file_sep>#!/bin/sh

if [ `whoami` != root ]; then
	sudo $0
	exit 0
fi

apt-get install texlive-full graphviz dia

TMPDIR=`mktemp -d`
cd $TMPDIR

# fjern eksisterende install
find /usr/local/share/texmf -name '*ku-forside*' | xargs rm -rf
find /usr/local/share/texmf -name '*oberdiek*' | xargs rm -rf

# Download listingsutf8
wget http://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip
unzip oberdiek.tds.zip -d /usr/local/share/texmf

# Download ku-forside
wget http://www.math.ku.dk/~m00cha/ku-forside.zip
unzip ku-forside.zip -d /usr/local/share/texmf/tex/latex

KUFIL=/usr/local/share/texmf/tex/latex/ku-forside/ku-forside.sty
iconv -f iso-8859-1 -t utf-8 $KUFIL -o ku-forside.sty
mv -f ku-forside.sty $KUFIL

# opdater tex
texhash

# ryd op
cd /
rm -rf $TMPDIR
<file_sep>sim <- exp(rnorm(5000,5,0.5))
f <- function(y,mu,sigma)
1/(y*sqrt(2*pi*sigma^2))*exp(-((log(y)-mu)^2)/(2*sigma^2))
yval <- seq(0,1000,1)
fval <- f(yval,5,0.5)
pdf("graphs/simulation_1.pdf")
hist(sim,prob=T,nclass=50)
lines(yval,fval)
dev.off()
results <- c(mean(sim),var(sim),sd(sim))
