inst/examples/R/stat/Trend/Anzahl_Telefone.R

S = c(1355900, 1801100, 2371044, 2808900, 3353200, 4126900, 4932800, 6118578, 6483600, 6995700, 7635400, 8348700, 8729592, 9542500, 10046400, 10523500, 11241400, 11716520, 12077600, 12668500, 13411400, 13875200, 14347395, 15369500, 16208900, 16935900, 17746200, 18522767, 19341300, 20233000, 20201600, 19707600, 17424406, 16710900, 16968800, 17424000, 18433000, 19453401, 19953000, 20831000, 21928000, 23521000, 24919000, 26381000, 26859000, 27867000, 31611000, 34867000, 38205000, 40708000, 43003800, 45636400, 48056300, 50373000, 52813000, 56243200, 60190400, 63620900, 66629600, 70819000, 74341100, 77425400, 80971700, 84450300, 88787400, 93658800, 98785600, 103751900, 109255600, 115200700, 120221000);
tel = ts(S, start=1900, end=1970, fr=1)
par(mar=c(5, 7, 1, 2) + 0.1)
par(mgp = c(3, 1, 0))
plot(tel, lwd=3, col="blue", axes=F, xlab="Jahr", ylab="", ylim=c(0, 140000000))
axis(1, tck=-0.02)
options(scipen=5)
axis(2, at=seq(0, 140000000, by=20000000), label=seq(0, 140000, by=20000), las=2, tck=-0.02)
par(mgp = c(5, 1, 0))
title(ylab="Anzahl der Telefone in USA (1000)")
t = as.numeric(time(tel)-1900)
tel.lm = lm(log(tel)~t)
lines(exp(tel.lm$coef[1]+tel.lm$coef[2]*(time(tel)-1900)), col="red", lwd=3)
sigbertklinke/shinyExample documentation built on May 26, 2019, 4:32 a.m.