% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/563_ylt_rate_adjustments_catreg_2_row.R
\name{ylt_rate_adjustments_catreg_2_row}
\alias{ylt_rate_adjustments_catreg_2_row}
\title{Makes rates adjustments by event, for events in a YLT}
\usage{
ylt_rate_adjustments_catreg_2_row(longylt, ratesbycatreg)
}
\arguments{
\item{longylt}{A data frame containing the long YLT}

\item{ratesbycatreg}{A list containing the mean and sd adjustments, each of which is a
matrix with dimensions nregions x ncat.}
}
\value{
A matrix with the adjustments by event
column 1 is the mean of the adjustments.
column 2 is the sd of the adjustments.
}
\description{
Maps rate adjustments by cat and region to rate adjustments by event, which
is what \code{yltsurgery} needs as input.
}
\examples{
#
# 1 create a 10 year YLT
# -2 regions
# -7 cats
#
cat("1. longylt:\n")
year	=c(1,1,1,2,2,3,3,4,4,4)
cat		=c(-1,0,1,2,3,4,5,5,5,5)
region=c(1,1,1,1,1,2,2,2,2,2)
longylt=data.frame(year,cat,region)
print(head(longylt))
#
# 2 make adjustments
#
mn=matrix(0,2,7)
for (i in 1:2){
	for (j in 1:7){
		mn[i,j]=(i-1)*cat[j]+cat[j]
	}
}
sd=matrix(0,2,7)
ratesbycatreg=list(mn=mn,sd=sd)
# 3 convert adjustments
#
adj=ylt_rate_adjustments_catreg_2_row(longylt,ratesbycatreg)
print(head(adj))
}
\author{
Stephen Jewson \email{stephen.jewson@gmail.com}
}
