-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathkin.Rd
More file actions
78 lines (68 loc) · 3.12 KB
/
kin.Rd
File metadata and controls
78 lines (68 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/kin.R
\name{kin}
\alias{kin}
\title{Estimate kin counts in a one-sex framework.}
\usage{
kin(
p = NULL,
f = NULL,
time_invariant = TRUE,
pi = NULL,
n = NULL,
output_cohort = NULL,
output_period = NULL,
output_kin = NULL,
output_age_focal = NULL,
birth_female = 1/2.04,
summary_kin = TRUE
)
}
\arguments{
\item{p}{numeric. A vector (atomic) or matrix with probabilities (or survival ratios, or transition between age class
in a more general perspective) with rows as ages (and columns as years in case of matrix, being the name of each col the year).}
\item{f}{numeric. Same as \code{p} but for fertility rates.}
\item{time_invariant}{logical. Constant assumption for a given \code{year} rates. Default \code{TRUE}.}
\item{pi}{numeric. Same as \code{U} but for childbearing distribution (sum to 1). Optional.}
\item{n}{numeric. Only for \code{time_invariant = FALSE}. Same as \code{p} but for population distribution (counts or \verb{\%}). Optional.}
\item{output_cohort}{integer. Vector of year cohorts for returning results. Should be within input data years range.}
\item{output_period}{integer. Vector of period years for returning results. Should be within input data years range.}
\item{output_kin}{character. kin types to return: "m" for mother, "d" for daughter,...}
\item{output_age_focal}{integer. Vector of ages to select (and make faster the run).}
\item{birth_female}{numeric. Female portion at birth. This multiplies \code{f} argument. If \code{f} is already for female offspring,}
\item{summary_kin}{logical. Whether or not include \code{kin_summary} table (see output details). Default \code{TRUE}.
this needs to be set as 1.}
}
\value{
A list with:
\itemize{
\item{kin_full}{ a data frame with year, cohort, Focal´s age, related ages and type of kin (for example \code{d} is daughter,
\code{oa} is older aunts, etc.), including living and dead kin at that age.}
\item{kin_summary}{ a data frame with Focal´s age, related ages and type of kin, with indicators obtained processing \code{kin_full},
grouping by cohort or period (depending on the given arguments):}
{\itemize{
\item{\code{count_living}}{: count of living kin at actual age of Focal}
\item{\code{mean_age}}{: mean age of each type of living kin.}
\item{\code{sd_age}}{: standard deviation of age of each type of living kin.}
\item{\code{count_death}}{: count of dead kin at specific age of Focal.}
\item{\code{count_cum_death}}{: cumulated count of dead kin until specific age of Focal.}
\item{\code{mean_age_lost}}{: mean age where Focal lost her relative.}
}
}
}
}
\description{
Implementation of Goodman-Keyfitz-Pullum equations in a matrix framework. This produce a matrilineal (or patrilineal)
kin count distribution by kin and age.
}
\details{
See Caswell (2019) and Caswell (2021) for details on formulas. One sex only (female by default).
}
\examples{
# Kin expected matrilineal count for a Swedish female based on 2015 rates.
swe_surv_2015 <- swe_px[,"2015"]
swe_asfr_2015 <- swe_asfr[,"2015"]
# Run kinship models
swe_2015 <- kin(p = swe_surv_2015, f = swe_asfr_2015)
head(swe_2015$kin_summary)
}