% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/100_yltsim.R
\name{yltsim}
\alias{yltsim}
\title{Simulates a long YLT from a Poisson ELT}
\usage{
yltsim(nyearsinylt, elt, columns2copy = NULL, verbose = FALSE, secuncb = FALSE)
}
\arguments{
\item{nyearsinylt}{The number of years of simulation required.}

\item{elt}{A data frame containing the ELT.
Must contain \code{evid}, \code{mrate} and \code{mloss} columns, at least.}

\item{columns2copy}{Which extra columns to copy}

\item{verbose}{A logical.}

\item{secuncb}{A logical to indicate whether secondary uncertainty should be simulated.
Requires \code{sloss} and \code{expo} columns.}
}
\value{
A data frame containing a long YLT.
}
\description{
Simulates a long YLT (long format year loss table) from an ELT (event loss table)
using the Poisson distribution,
with or without secondary uncertainty.
Copies standard columns by default, and extra columns if asked to.
Previous versions included the short YLT, but now the idea is that this routine
just produces the longylt, and \code{ylt_long2short} can be used to generate
the shortylt if it is required.
}
\details{
Uses Poisson simulation.

The ELT data frame must contain the following two columns
\itemize{
\item \code{evid:  } The event ids
\item \code{mloss: } The mean losses by event
\item \code{mrate: } The mean rates by event (can be constant if appropriate).
}

If secondary uncertainty is required, the ELT data frame must also contain
the following two columns:
\itemize{
\item \code{sloss: } The standard deviation of losses by event
\item \code{expo: }  The exposure by event
}

The following columns will be passed through into the output YLT.
\itemize{
\item \code{evid: }
\item \code{mloss:}
}
Other columns can be passed thru if they are specified (see the example).

The whole issue of event ids is complicated. Here's what I do:
\itemize{
\item \code{evid: } 	The event id. This will have
whatever numbers it had in the ELT. They don't have to start from one.
This might end up
repeated in the YLT, if the simulations end up repeating that event.
\item \code{eltrow: } 	I number the events in the ELT from 1. This is that number.
This might end up
repeated in the YLT, if the simulations end up repeating that event.
\item \code{yltrow: } 	I number the events in the YLT from 1. This is that number.
This will not repeat in the YLT, even if two events are the same.
So this is just the row in the YLT.
}
}
\examples{
#
# create an elt with 3 rows
#
set.seed(1)
#
# essential parameters
evid=seq(1000,1002,1) 
mrate=seq(0.1,0.3,0.1)
mloss=seq(100,300,100)
#
# optional parameters
wspd=c(50,51,52) #testing copying extra columns
region=c("A","B","C")
#
# make the input elt
elt=data.frame(evid,mrate,mloss,wspd,region)
print(elt)
#
# and simulate a ylt with 5 years
#
longylt=yltsim(5,elt,columns2copy=c("wspd","region"))
#
message("Here's the simulated long ylt:")
print(longylt)
#
shortylt=ylt_long2short(longylt,nyearsinylt=5)
#
message("And here's a short ylt derived from it:")
print(shortylt)

}
\seealso{
\itemize{
\item \code{yltsim_inc: } 	YLT simulation, but incrementally.
\item \code{yltreduce: } 		YLT length reduction
\item \code{eltmerge: }  A routine for merging historical and model ELTs
\item \code{catxl: }  A routine for evaluating catxl towers.
}
}
\author{
Stephen Jewson \email{stephen.jewson@gmail.com}
}
