Title: | Functions for Medical Statistics Book with some Demographic Data |
---|---|
Description: | Several utility functions for the book entitled "Practices of Medical and Health Data Analysis using R" (Pearson Education Japan, 2007) with Japanese demographic data and some demographic analysis related functions. |
Authors: | Minato Nakazawa <[email protected]> |
Maintainer: | Minato Nakazawa <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.7.6 |
Built: | 2024-11-15 06:25:16 UTC |
Source: | CRAN |
Caretaker ratio. Defined as the ratio of the aged population who may need care to caretaking females population.
CaretakerRatio(PM, PF)
CaretakerRatio(PM, PF)
PM |
The integer vector to give age-specific population from age 0 to more than 80 for males. |
PF |
The integer vector to give age-specific population from age 0 to more than 80 for females. |
CR |
Caretaker Ratio. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Preston SH, Heuveline P, Guillot M (2001) Demography: Measuring and Modeling Population Processes. Blackwell Publishing, Oxford.
Newell C (1988) Methods and Models in Demography. The Guilford Press, New York.
Rowland DT (2003) Demographic methods and concepts. Oxford Univ. Press, Oxford.
# Caretaker Ratio in Japan in 2015. The value 81.72 is much higher than # 46 observed in UK in 1990. CaretakerRatio(PM=Jpop$M2015, PF=Jpop$F2015)
# Caretaker Ratio in Japan in 2015. The value 81.72 is much higher than # 46 observed in UK in 1990. CaretakerRatio(PM=Jpop$M2015, PF=Jpop$F2015)
Implementing Coale and McNeil's model (1972) for the age-specific probability of first marriage and fitting the model to actual data.
CM(scale=0.8, a0=18, k=2) fitCM(initialpar=c(0.8, 18, 2), data, ages=10:60, mode=1, Method="Nelder-Mead", ...)
CM(scale=0.8, a0=18, k=2) fitCM(initialpar=c(0.8, 18, 2), data, ages=10:60, mode=1, Method="Nelder-Mead", ...)
scale |
The parameter C of the Coale-McNeil model, the scale parameter for total nupitiality. Almost same as 1-(probability of never marring for whole life) |
a0 |
The parameter a0 of the Coale-McNeil model, the age of the beginning of first marriage. The beginning means about 1% of the population having ever married. |
k |
The parameter k of the Coale-McNeil model, how fast the population marry after a0. |
initialpar |
Initial value for the parameters to be estimated. If not given, c(0.8, 18, 2) is used. |
data |
Actual vector of the age-specific probability of first marriage when the mode is 1, otherwise the proportion ever married by each age. |
ages |
The age ranges for the data. It must be within the range from 10 to 60. Default is 10:60. It must have the same lengths as data. |
mode |
The mode of fitting, 1 means fitting for the probability of first marriage, otherwise fitting for the proportion ever married. Default is 1. |
Method |
The method to be used in optim() function. Default is "Nelder-Mead". |
... |
Other options to be passed to optim(). |
CM() returns model schedule of nupitiality for ages from 10 to 60 as a list, composed of g (the numeric vector for the probability of first marriage happening for each age), G (the numeric vector for the proportion ever married by each age), mu (mean age of first marriage among total population), and sigma (standard deviation of the ages of first marriage). fitCM() returns the numeric vector of fitted parameters C, a0 and k, RMSE for those values, and the flag of convergence.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Coale AJ, McNeil DR (1972) The distribution by age of the frequency of first marriage in a female cohort. Journal of the American Statistical Association, 67(340): 743-749.doi:10.1080/01621459.1972.10481287
Newell C (1988) Methods and Models in Demography. The Guilford Press, New York.
# The data of Japanese population census 2010 for the whole country # The proportion of ever married females for ages from 15 to 60. # https://www.e-stat.go.jp/SG1/estat/List.do?bid=000001034991&cycode=0 Ages <- 15:60 EverMarriedFemales <- c(0.003081039, 0.003203058, 0.006502558, 0.014261608, 0.028378604, 0.048903318, 0.07596101, 0.110311095, 0.153365573, 0.2090648, 0.273819118, 0.342672073, 0.41259517, 0.479789489, 0.536291775, 0.589919881, 0.631937609, 0.663719195, 0.691411757, 0.71775138, 0.740807817, 0.760155848, 0.775400475, 0.788445244, 0.799522713, 0.81108241, 0.821591503, 0.830695486, 0.840776283, 0.846773585, 0.85921777, 0.867991763, 0.876908992, 0.886388747, 0.894302114, 0.902385961, 0.909329207, 0.914662575, 0.920327092, 0.925013244, 0.929551158, 0.933150578, 0.935851652, 0.938421122, 0.940089719, 0.943223398) res <- fitCM(initialpar=c(0.8, 18, 2), data=EverMarriedFemales, ages=Ages, mode=2) print(res) plot(Ages, EverMarriedFemales, main="Proportion ever married by each age\n for 2010 Japanese females") fitted <- CM(res[1], res[2], res[3]) lines(Ages, fitted$G[6:51], col="red") NoteForm <- "C=%3.1f, a0=%3.1f, k=%3.1f\n mu=%3.1f, sd=%3.1f" text(40, 0.2, sprintf(NoteForm, res[1], res[2], res[3], fitted$mu, fitted$sigma)) # mean age of first marriage happening print(sum(Ages*fitted$g[Ages-9]/sum(fitted$g[Ages-9])))
# The data of Japanese population census 2010 for the whole country # The proportion of ever married females for ages from 15 to 60. # https://www.e-stat.go.jp/SG1/estat/List.do?bid=000001034991&cycode=0 Ages <- 15:60 EverMarriedFemales <- c(0.003081039, 0.003203058, 0.006502558, 0.014261608, 0.028378604, 0.048903318, 0.07596101, 0.110311095, 0.153365573, 0.2090648, 0.273819118, 0.342672073, 0.41259517, 0.479789489, 0.536291775, 0.589919881, 0.631937609, 0.663719195, 0.691411757, 0.71775138, 0.740807817, 0.760155848, 0.775400475, 0.788445244, 0.799522713, 0.81108241, 0.821591503, 0.830695486, 0.840776283, 0.846773585, 0.85921777, 0.867991763, 0.876908992, 0.886388747, 0.894302114, 0.902385961, 0.909329207, 0.914662575, 0.920327092, 0.925013244, 0.929551158, 0.933150578, 0.935851652, 0.938421122, 0.940089719, 0.943223398) res <- fitCM(initialpar=c(0.8, 18, 2), data=EverMarriedFemales, ages=Ages, mode=2) print(res) plot(Ages, EverMarriedFemales, main="Proportion ever married by each age\n for 2010 Japanese females") fitted <- CM(res[1], res[2], res[3]) lines(Ages, fitted$G[6:51], col="red") NoteForm <- "C=%3.1f, a0=%3.1f, k=%3.1f\n mu=%3.1f, sd=%3.1f" text(40, 0.2, sprintf(NoteForm, res[1], res[2], res[3], fitted$mu, fitted$sigma)) # mean age of first marriage happening print(sum(Ages*fitted$g[Ages-9]/sum(fitted$g[Ages-9])))
Calculate Cronbach's alpha coefficient from a matrix or data.frame with more than 2 columns.
CronbachAlpha(X)
CronbachAlpha(X)
X |
A matrix or data.frame with more than 2 columns. |
Single numeric value of Cronbach's alpha.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Bland JM, Altman DG (1997) Statistics notes: Cronbach's alpha. BMJ, 314: 572.
QUEST <- data.frame( Q1=c(1, 5, 2, 3, 4, 2, 3, 4, 3, 2), Q2=c(2, 4, 1, 2, 4, 1, 2, 5, 2, 1), Q3=c(2, 5, 1, 3, 3, 2, 2, 4, 2, 2)) CronbachAlpha(QUEST)
QUEST <- data.frame( Q1=c(1, 5, 2, 3, 4, 2, 3, 4, 3, 2), Q2=c(2, 4, 1, 2, 4, 1, 2, 5, 2, 1), Q3=c(2, 5, 1, 3, 3, 2, 2, 4, 2, 2)) CronbachAlpha(QUEST)
Implementing Coale and Trussell's model of age-specific marital fertility rates and fitting the model to actual ASMFR.
CT(M=1, m=0) fitCT(initialpar=c(1.0, 1.0), data, Method="Nelder-Mead", ...)
CT(M=1, m=0) fitCT(initialpar=c(1.0, 1.0), data, Method="Nelder-Mead", ...)
M |
The parameter M of the CT model, the scale (peak height) parameter of fertility |
m |
The parameter m of the CT model, the strength of downward discordance from natural fertility with aging |
initialpar |
Initial value for the parameters to be estimated. If not given, c(1.0, 1.0) is used. |
data |
Actual vector of ASMFR (which must be given for from age 12 to age 49 for each age) to be used to obtain the best-fit parameters of the CT's model. |
Method |
The method to be used in optim() function. Default is "Nelder-Mead". |
... |
Other options to be passed to optim(). |
CT() returns model ASMFR for ages from 12 to 49. fitCT() returns the numeric vector of fitted parameters M and m, RMSE for those values, and the flag of convergence.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Coale AJ, Trussell TJ (1978) Technical Note: Finding the Two Parameters That Specify a Model Schedule of Marital Fertility. Population Index, 44(2): 203-213.
ASMFR <- c(0, 0, 0, Jfert$ASMFR2000[1:35]) # Jfert's ASMFR should be rearranged to 12:49 res <- fitCT(,ASMFR) FLAG <- res[4] while (FLAG>0) { res <- fitCT(res[1:2], ASMFR) FLAG <- res[4] } print(res)
ASMFR <- c(0, 0, 0, Jfert$ASMFR2000[1:35]) # Jfert's ASMFR should be rearranged to 12:49 res <- fitCT(,ASMFR) FLAG <- res[4] while (FLAG>0) { res <- fitCT(res[1:2], ASMFR) FLAG <- res[4] } print(res)
Implementing Denny's model mortality function of lx and fitting the model to actual lx of given lifetable.
Denny(a, b, c, t) fitDenny(initialpar=rep(0.1, 3), data, mode=3, Method="Nelder-Mead", ...)
Denny(a, b, c, t) fitDenny(initialpar=rep(0.1, 3), data, mode=3, Method="Nelder-Mead", ...)
a |
The parameter a of the Denny model, l(t)=1/(1+a*(t/(105-t))^3+b*sqrt(exp(t/(105-t))-1)+c*(1-exp(-2*t))). |
b |
The parameter b of the Denny model, l(t)=1/(1+a*(t/(105-t))^3+b*sqrt(exp(t/(105-t))-1)+c*(1-exp(-2*t))). |
c |
The parameter c of the Denny model, l(t)=1/(1+a*(t/(105-t))^3+b*sqrt(exp(t/(105-t))-1)+c*(1-exp(-2*t))). |
t |
Age (vector OK) in years. The t must be less than 105, otherwise the value by Denny() become 0. |
initialpar |
Initial value for the parameters to be estimated. If not given, rep(0.1, 3) is used. |
data |
Actual vector of qx in the lifetable to be used to obtain the best-fit parameters of the Denny's model. If the ages for qx are equal or elder than 105 years old, those will be ignored in fitting. |
mode |
Which of lifetable functions should be used to calculate the RMSE: 1 qx, 2 dx, otherwise lx. Default is 3. |
Method |
The method to be used in optim() function. Default is "Nelder-Mead". |
... |
Other options to be passed to optim(). |
Denny() returns model lx for the same length with t. fitDenny() returns the numeric vector of fitted parameters a, b, and c, RMSE for those values, and the flag of convergence.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Denny C (1997) A model of the probability of survival from birth. Mathematical and Computer Modelling, 26: 69-78. doi:10.1016/S0895-7177(97)00170-2
res <- fitDenny(,qxtolx(Jlife$qx2005M)) FLAG <- res[5] while (FLAG>0) { res <- fitDenny(res[1:3], qxtolx(Jlife$qx2005M)) FLAG <- res[5] } print(res)
res <- fitDenny(,qxtolx(Jlife$qx2005M)) FLAG <- res[5] while (FLAG>0) { res <- fitDenny(res[1:3], qxtolx(Jlife$qx2005M)) FLAG <- res[5] } print(res)
Geary's test for normality. Null hypothesis is that the data obeys to normal distribution.
geary.test(X)
geary.test(X)
X |
A numeric vector. |
statistic |
Geary's test statistic G |
p.value |
The significant probability of the null-hypothesis testing. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
geary.test(rnorm(100)) geary.test(20:50)
geary.test(rnorm(100)) geary.test(20:50)
Implementing Gompertz-Makeham's model mortality function of the force of mortality u(x) with conversion into qx and fitting the model to actual qx of given lifetable.
GompertzMakeham(A, B, C, t) fitGM(initialpar=c(0.01, 0.0003, 0.07), data, mode=1, Method="Nelder-Mead", ...)
GompertzMakeham(A, B, C, t) fitGM(initialpar=c(0.01, 0.0003, 0.07), data, mode=1, Method="Nelder-Mead", ...)
A |
The parameter A of the Gompertz-Makeham model u(t)=A*exp(B*t)+C. |
B |
The parameter B of the Gompertz-Makeham model u(t)=A*exp(B*t)+C. |
C |
The parameter C of the Gompertz-Makeham model u(t)=A*exp(B*t)+C. |
t |
Age (vector OK) in years |
initialpar |
Initial value for the parameters to be estimated. If not given, c(0.01, 0.0003, 0.07) is used. |
data |
Actual vector of qx in the lifetable to be used to obtain the best-fit parameters of the Gompertz-Makeham model. |
mode |
Which of lifetable functions should be used to calculate the RMSE, which is to be minimized in optim() function: 1 qx, 2 dx, otherwise lx. Default is 1. |
Method |
The method to be used in optim() function. Default is "Nelder-Mead". |
... |
Other options to be passed to optim(). |
GompertzMakeham() returns model qx for the same length with t, where u(x) is internally converted into qx. fitGM() returns the numeric vector of fitted parameters of A, B and C, RMSE for those values, and the flag of convergence.
Minato Nakazawa [email protected] https://minato.sip21c.org/
res <- fitGM(,Jlife$qx2005M) FLAG <- res[5] while (FLAG>0) { res <- fitGM(res[1:3], Jlife$qx2005M) FLAG <- res[5] } print(res)
res <- fitGM(,Jlife$qx2005M) FLAG <- res[5] while (FLAG>0) { res <- fitGM(res[1:3], Jlife$qx2005M) FLAG <- res[5] } print(res)
Capture the output of stem() function and plot them into graphic devices. However, the result of setting scale parameter as 2 may be controversial.
gstem(X, scale)
gstem(X, scale)
X |
A numeric vector. |
scale |
Parameter to control plot length of graph. Default is 1. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
x <- rnorm(100, 10, 1) stem(x) stem(x, 2) layout(t(1:2)) gstem(x) gstem(x, 2)
x <- rnorm(100, 10, 1) stem(x) stem(x, 2) layout(t(1:2)) gstem(x) gstem(x, 2)
The data gives the age-class specific model population of Japan in smoothed Heisei 27 (2015) to calculate directly adjusted mortality rate.
H27MPJ
H27MPJ
A named vector containing 21 observations, where names show age-classes.
https://www.mhlw.go.jp/content/12601000/000638712.pdf
Tamura K. (2008) How do we die?: death date from vital statistics of the Japanese population. The Waseda study of politics and public law, 87: 27-57.
Implementing Hadwiger's model of age-specific fertility rates and fitting the model to actual ASFR.
Hadwiger(a=3.4, b=2.5, c=22.2) fitHad(initialpar=c(3.4, 2.5, 22.2), data, Method="Nelder-Mead", ...)
Hadwiger(a=3.4, b=2.5, c=22.2) fitHad(initialpar=c(3.4, 2.5, 22.2), data, Method="Nelder-Mead", ...)
a |
The parameter a of the Hadwiger model, ASFR(x) = a*b/c*(c/x)^1.5*exp(-b^2*(c/x+x/c-2)) for age x from 15 to 54. |
b |
The parameter b of the Hadwiger model, ASFR(x) = a*b/c*(c/x)^1.5*exp(-b^2*(c/x+x/c-2)) for age x from 15 to 54. |
c |
The parameter c of the Hadwiger model, ASFR(x) = a*b/c*(c/x)^1.5*exp(-b^2*(c/x+x/c-2)) for age x from 15 to 54. |
initialpar |
Initial value for the parameters to be estimated. If not given, c(3.4, 2.5, 22.2) is used. |
data |
Actual vector of ASFR (which must be given for from ages from 15 to 54 for each age) to be used to obtain the best-fit parameters of the Hadwiger's model. |
Method |
The method to be used in optim() function. Default is "Nelder-Mead". |
... |
Other options to be passed to optim(). |
Hadwiger() returns model ASFR for ages from 15 to 54. fitHad() returns the numeric vector of fitted parameters a, b and c, RMSE for those values, and the flag of convergence.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Chandola T, Coleman DA, Horns RW (1999) Recent European fertility patterns: fitting curves to 'distorted' distributions. Population Studies, 53(3): 317-329. doi:10.1080/00324720308089
res <- fitHad(,Jfert$ASFR2000) FLAG <- res[5] while (FLAG>0) { res <- fitHad(res[1:3], Jfert$ASFR2000) FLAG <- res[5] } print(res)
res <- fitHad(,Jfert$ASFR2000) FLAG <- res[5] while (FLAG>0) { res <- fitHad(res[1:3], Jfert$ASFR2000) FLAG <- res[5] } print(res)
Index of dissimilarity between the 2 age-distributions.
IndexOfDissimilarity(X, Y)
IndexOfDissimilarity(X, Y)
X |
A vector of age-specific standard populations (or percentage) for each age. |
Y |
A vector of age-specific target populations (or percentage) for each age. |
ID |
Index of dissimilarity, which is a half of sum of absolute differences of percentages for each age, where NA is automatically treated as 0. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Preston SH, Heuveline P, Guillot M (2001) Demography: Measuring and Modeling Population Processes. Blackwell Publishing, Oxford.
Newell C (1988) Methods and Models in Demography. The Guilford Press, New York.
Rowland DT (2003) Demographic methods and concepts. Oxford Univ. Press, Oxford.
# Dissimilarities of Japanese population structure were increasing # from 1960-1980 (0.132) to 1980-2000 (0.156). IndexOfDissimilarity(Jpopl$M1980+Jpopl$F1980, Jpopl$M2000+Jpopl$F2000) IndexOfDissimilarity(Jpopl$M1980+Jpopl$F1980, Jpopl$M1960+Jpopl$F1960)
# Dissimilarities of Japanese population structure were increasing # from 1960-1980 (0.132) to 1980-2000 (0.156). IndexOfDissimilarity(Jpopl$M1980+Jpopl$F1980, Jpopl$M2000+Jpopl$F2000) IndexOfDissimilarity(Jpopl$M1980+Jpopl$F1980, Jpopl$M1960+Jpopl$F1960)
Calculate a incidence rate with confidence interval.
IRCI(a, PT, conf.level=0.9)
IRCI(a, PT, conf.level=0.9)
a |
Number of cases |
PT |
Person-years of observed population at risk |
conf.level |
Probability for confidence intervals. Default is 0.9. |
IR |
Point estimate of incidence rate. |
IRL |
Lower limit of confidence interval |
IRU |
Upper limit of confidence interval |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
IRCI(8, 85000)
IRCI(8, 85000)
Calculate incidence rate with its confidence intervals by exact method using Poisson distribution.
IRCIPois(a, PT, conf.level=0.9)
IRCIPois(a, PT, conf.level=0.9)
a |
Number of cases |
PT |
Person-years of observed population at risk |
conf.level |
Probability for confidence intervals. Default is 0.9. |
IR |
Point estimate of incidence rate. |
IRL |
Lower limit of confidence interval |
IRU |
Upper limit of confidence interval |
Minato Nakazawa [email protected] https://minato.sip21c.org/
https://www.statsdirect.com/help/rates/poisson_rate_ci.htm
IRCIPois(8, 85000)
IRCIPois(8, 85000)
Calculate pooled incidence rate difference and its confidence intervals with Mantel-Haenszel's method.
IRDMH(XTAB, conf.level=0.9)
IRDMH(XTAB, conf.level=0.9)
XTAB |
A matrix with 4 columns. The first column is the incidence in the exposed cohort. The second column is the incidence in the unexposed cohort. The third column is the observed person-time of exposed cohort. The forth column is the observed person-time of unexposed cohort. Rows should be composed of different strata or studies. |
conf.level |
Probability for confidence intervals. Default is 0.9. |
estimate |
Calculated point estimate of pooled incidence rate difference with Manterl-Haenszel's method. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
conf.level |
Simply return the value of given conf.level. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
# Table 10-5 of Rothman's textbook (Chapter 10). IRDMH(matrix(c(196, 111, 62119, 15763, 167, 157, 6085, 2780), 2, byrow=TRUE), conf.level=0.9)
# Table 10-5 of Rothman's textbook (Chapter 10). IRDMH(matrix(c(196, 111, 62119, 15763, 167, 157, 6085, 2780), 2, byrow=TRUE), conf.level=0.9)
Calculate pooled incidence rate ratio and its confidence intervals with Mantel-Haenszel's method.
IRRMH(XTAB, conf.level=0.9)
IRRMH(XTAB, conf.level=0.9)
XTAB |
A matrix with 4 columns. The first column is the incidence in the exposed cohort. The second column is the incidence in the unexposed cohort. The third column is the observed person-time of exposed cohort. The forth column is the observed person-time of unexposed cohort. Rows should be composed of different strata or studies. |
conf.level |
Probability for confidence intervals. Default is 0.9. |
estimate |
Calculated point estimate of pooled incidence rate ratio with Manterl-Haenszel's method. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
conf.level |
Simply return the value of given conf.level. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
# Table 10-5 of Rothman's textbook (Chapter 10). IRRMH(matrix(c(196, 111, 62119, 15763, 167, 157, 6085, 2780), 2, byrow=TRUE), conf.level=0.9)
# Table 10-5 of Rothman's textbook (Chapter 10). IRRMH(matrix(c(196, 111, 62119, 15763, 167, 157, 6085, 2780), 2, byrow=TRUE), conf.level=0.9)
The data gives the sex and age-class (by five) specific numbers of death in Showa 60 (S60 = 1985), Heisei 2 (H02 = 1990), Heisei 7 (H07 = 1995), Heisei 12 (H12 = 2000), Heisei 17 (H17 = 2005), Heisei 22 (H22 = 2010) and Heisei 27 (H27 = 2015), and corresponding populations.
JASM
JASM
A data frame with 18 observations on 30 variables.
[, 1] |
AGECLASS |
Factor w/18 levels | Age class (years old) |
[, 2] |
S60MODEL |
numeric | Model population in 1985 |
[, 3] |
S60M |
numeric | Number of males' death by age classes in 1985 |
[, 4] |
H02M |
numeric | Number of males' death by age classes in 1990 |
[, 5] |
H07M |
numeric | Number of males' death by age classes in 1995 |
[, 6] |
H12M |
numeric | Number of males' death by age classes in 2000 |
[, 7] |
H17M |
numeric | Number of males' death by age classes in 2005 |
[, 8] |
H22M |
numeric | Number of males' death by age classes in 2010 |
[, 8] |
H27M |
numeric | Number of males' death by age classes in 2015 |
[, 9] |
S60F |
numeric | Number of females' death by age classes in 1985 |
[,10] |
H02F |
numeric | Number of females' death by age classes in 1990 |
[,11] |
H07F |
numeric | Number of females' death by age classes in 1995 |
[,12] |
H12F |
numeric | Number of females' death by age classes in 2000 |
[,13] |
H17F |
numeric | Number of females' death by age classes in 2005 |
[,14] |
H22F |
numeric | Number of females' death by age classes in 2010 |
[,14] |
H27F |
numeric | Number of females' death by age classes in 2015 |
[,15] |
S60MP |
numeric | Number of males' population by age classes in 1985 |
[,16] |
H02MP |
numeric | Number of males' population by age classes in 1990 |
[,17] |
H07MP |
numeric | Number of males' population by age classes in 1995 |
[,18] |
H12MP |
numeric | Number of males' population by age classes in 2000 |
[,19] |
H17MP |
numeric | Number of males' population by age classes in 2005 |
[,20] |
H22MP |
numeric | Number of males' population by age classes in 2010 |
[,20] |
H27MP |
numeric | Number of males' population by age classes in 2015 |
[,21] |
S60FP |
numeric | Number of females' population by age classes in 1985 |
[,22] |
H02FP |
numeric | Number of females' population by age classes in 1990 |
[,23] |
H07FP |
numeric | Number of females' population by age classes in 1995 |
[,24] |
H12FP |
numeric | Number of females' population by age classes in 2000 |
[,25] |
H17FP |
numeric | Number of females' population by age classes in 2005 |
[,26] |
H22FP |
numeric | Number of females' population by age classes in 2010 |
[,26] |
H27FP |
numeric | Number of females' population by age classes in 2015 |
Japanese mortality data by sex and age-class (by five) given as national official vital statitistics from 1985 to 2015, every 5 years.
AGECLASS
: Labels for age classes. [0-4] to [85-].
S60MODEL
: Age class specific model population of Japan in 1985.
S60M
-H27M
: Age class specific number of death of males in 1985-2015.
S60F
-H27F
: Age class specific number of death of females in 1985-2015.
S60MP
-H27MP
: Age class specific number of males' population in 1985-2015.
S60FP
-H27FP
: Age class specific number of females' population in 1985-2015.
https://www.stat.go.jp/english/data/nenkan/66nenkan/index.html
Ministry of Health, Labor and Welfare of Japan: Vital Statistics.
Age-specific fertility and marital fertility rates for aged 15-54 Japanese wowmen in Japan, from 1950 to 2020, every five years.
Jfert
Jfert
A data frame with 40 observations on 31 variables.
[, 1] |
Age |
integer | Ages of women |
[, 2] |
ASFR1950 |
numeric | Age-specific fertility rates of Japanese women in 1950. |
[, 3] |
ASFR1955 |
numeric | Age-specific fertility rates of Japanese women in 1955. |
[, 4] |
ASFR1960 |
numeric | Age-specific fertility rates of Japanese women in 1960. |
[, 5] |
ASFR1965 |
numeric | Age-specific fertility rates of Japanese women in 1965. |
[, 6] |
ASFR1970 |
numeric | Age-specific fertility rates of Japanese women in 1970. |
[, 7] |
ASFR1975 |
numeric | Age-specific fertility rates of Japanese women in 1975. |
[, 8] |
ASFR1980 |
numeric | Age-specific fertility rates of Japanese women in 1980. |
[, 9] |
ASFR1985 |
numeric | Age-specific fertility rates of Japanese women in 1985. |
[,10] |
ASFR1990 |
numeric | Age-specific fertility rates of Japanese women in 1990. |
[,11] |
ASFR1995 |
numeric | Age-specific fertility rates of Japanese women in 1995. |
[,12] |
ASFR2000 |
numeric | Age-specific fertility rates of Japanese women in 2000. |
[,13] |
ASFR2005 |
numeric | Age-specific fertility rates of Japanese women in 2005. |
[,14] |
ASFR2010 |
numeric | Age-specific fertility rates of Japanese women in 2010. |
[,15] |
ASFR2015 |
numeric | Age-specific fertility rates of Japanese women in 2015. |
[,16] |
ASFR2020 |
numeric | Age-specific fertility rates of Japanese women in 2020. |
[,17] |
ASMFR1950 |
numeric | Age-specific marital fertility rates of Japanese married women in 1950. |
[,18] |
ASMFR1955 |
numeric | Age-specific marital fertility rates of Japanese married women in 1955. |
[,19] |
ASMFR1960 |
numeric | Age-specific marital fertility rates of Japanese married women in 1960. |
[,20] |
ASMFR1965 |
numeric | Age-specific marital fertility rates of Japanese married women in 1965. |
[,21] |
ASMFR1970 |
numeric | Age-specific marital fertility rates of Japanese married women in 1970. |
[,22] |
ASMFR1975 |
numeric | Age-specific marital fertility rates of Japanese married women in 1975. |
[,23] |
ASMFR1980 |
numeric | Age-specific marital fertility rates of Japanese married women in 1980. |
[,24] |
ASMFR1985 |
numeric | Age-specific marital fertility rates of Japanese married women in 1985. |
[,25] |
ASMFR1990 |
numeric | Age-specific marital fertility rates of Japanese married women in 1990. |
[,26] |
ASMFR1995 |
numeric | Age-specific marital fertility rates of Japanese married women in 1995. |
[,27] |
ASMFR2000 |
numeric | Age-specific marital fertility rates of Japanese married women in 2000. |
[,28] |
ASMFR2005 |
numeric | Age-specific marital fertility rates of Japanese married women in 2005. |
[,29] |
ASMFR2010 |
numeric | Age-specific marital fertility rates of Japanese married women in 2010. |
[,30] |
ASMFR2015 |
numeric | Age-specific marital fertility rates of Japanese married women in 2015. |
[,31] |
ASMFR2020 |
numeric | Age-specific marital fertility rates of Japanese married women in 2020. |
The calculations were the numbers of live births divided by the numbers of women for ASFR (15-54), and the numbers of legitimate live births divided by the numbers of married women for ASMFR (15-54). Data sources are all official publication as vital statistics and national population census, so that the data are given with 5 years intervals.
Age
: Ages of women, from 15 to 54.
ASFR1950
-ASFR2020
: Age-specific fertility rates for all women aged 15-54 for 1950-2020, every 5 years.
ASMFR1950
-ASMFR2020
: Age-specific marital fertility rates for married women aged 15-54 for 1950-2020, every 5 years.
https://warp.da.ndl.go.jp/info:ndljp/pid/1334623/www.stat.go.jp/english/data/chouki/02.htm https://warp.da.ndl.go.jp/info:ndljp/pid/1334623/www.stat.go.jp/data/chouki/zuhyou/02-29-b.xls https://www.ipss.go.jp/syoushika/tohkei/Popular/P_Detail2022.asp?fname=T04-09.htm https://www.e-stat.go.jp/stat-search/file-download?statInfId=000032118572&fileKind=1 https://www.e-stat.go.jp/stat-search/file-download?statInfId=000032142474&fileKind=0
Ministry of Health, Labor and Welfare of Japan: Vital Statistics. / Ministry of Internal Affairs and Communications, Statistics Bureau: Population Census.
The qx column of the completed lifetables in Japan, from "1891-1898" to "2020", mostly every 5 years.
Jlife
Jlife
A data frame with 117 observations (NAs are filled for the ages with no survivors) on 45 variables.
[, 1] |
Age |
integer | Ages of women |
[, 2] |
qx1895M |
numeric | qx of completed lifetable functions of Japanese men in 1891-1898. |
[, 3] |
qx1895F |
numeric | qx of completed lifetable functions of Japanese women in 1891-1898. |
[, 4] |
qx1901M |
numeric | qx of completed lifetable functions of Japanese men in 1899-1903. |
[, 5] |
qx1901F |
numeric | qx of completed lifetable functions of Japanese women in 1899-1903. |
[, 6] |
qx1911M |
numeric | qx of completed lifetable functions of Japanese men in 1909-1913. |
[, 7] |
qx1911F |
numeric | qx of completed lifetable functions of Japanese women in 1909-1913. |
[, 8] |
qx1923M |
numeric | qx of completed lifetable functions of Japanese men in 1921-1925. |
[, 9] |
qx1923F |
numeric | qx of completed lifetable functions of Japanese women in 1921-1925. |
[,10] |
qx1928M |
numeric | qx of completed lifetable functions of Japanese men in 1926-1930. |
[,11] |
qx1928F |
numeric | qx of completed lifetable functions of Japanese women in 1926-1930. |
[,12] |
qx1935M |
numeric | qx of completed lifetable functions of Japanese men in 1935-1936. |
[,13] |
qx1935F |
numeric | qx of completed lifetable functions of Japanese women in 1935-1936. |
[,14] |
qx1947M |
numeric | qx of completed lifetable functions of Japanese men in 1947. |
[,15] |
qx1947F |
numeric | qx of completed lifetable functions of Japanese women in 1947. |
[,16] |
qx1951M |
numeric | qx of completed lifetable functions of Japanese men in 1950-1952. |
[,17] |
qx1951F |
numeric | qx of completed lifetable functions of Japanese women in 1950-1952. |
[,18] |
qx1955M |
numeric | qx of completed lifetable functions of Japanese men in 1955. |
[,19] |
qx1955F |
numeric | qx of completed lifetable functions of Japanese women in 1955. |
[,20] |
qx1960M |
numeric | qx of completed lifetable functions of Japanese men in 1960. |
[,21] |
qx1960F |
numeric | qx of completed lifetable functions of Japanese women in 1960. |
[,22] |
qx1965M |
numeric | qx of completed lifetable functions of Japanese men in 1965. |
[,23] |
qx1965F |
numeric | qx of completed lifetable functions of Japanese women in 1965. |
[,24] |
qx1970M |
numeric | qx of completed lifetable functions of Japanese men in 1970. |
[,25] |
qx1970F |
numeric | qx of completed lifetable functions of Japanese women in 1970. |
[,26] |
qx1975M |
numeric | qx of completed lifetable functions of Japanese men in 1975. |
[,27] |
qx1975F |
numeric | qx of completed lifetable functions of Japanese women in 1975. |
[,28] |
qx1980M |
numeric | qx of completed lifetable functions of Japanese men in 1980. |
[,29] |
qx1980F |
numeric | qx of completed lifetable functions of Japanese women in 1980. |
[,30] |
qx1985M |
numeric | qx of completed lifetable functions of Japanese men in 1985. |
[,31] |
qx1985F |
numeric | qx of completed lifetable functions of Japanese women in 1985. |
[,32] |
qx1990M |
numeric | qx of completed lifetable functions of Japanese men in 1990. |
[,33] |
qx1990F |
numeric | qx of completed lifetable functions of Japanese women in 1990. |
[,34] |
qx1995M |
numeric | qx of completed lifetable functions of Japanese men in 1995. |
[,35] |
qx1995F |
numeric | qx of completed lifetable functions of Japanese women in 1995. |
[,36] |
qx2000M |
numeric | qx of completed lifetable functions of Japanese men in 2000. |
[,37] |
qx2000F |
numeric | qx of completed lifetable functions of Japanese women in 2000. |
[,38] |
qx2005M |
numeric | qx of completed lifetable functions of Japanese men in 2005. |
[,39] |
qx2005F |
numeric | qx of completed lifetable functions of Japanese women in 2005. |
[,40] |
qx2010M |
numeric | qx of completed lifetable functions of Japanese men in 2010. |
[,41] |
qx2010F |
numeric | qx of completed lifetable functions of Japanese women in 2010. |
[,42] |
qx2015M |
numeric | qx of completed lifetable functions of Japanese men in 2015. |
[,43] |
qx2015F |
numeric | qx of completed lifetable functions of Japanese women in 2015. |
[,44] |
qx2020M |
numeric | qx of completed lifetable functions of Japanese men in 2020. |
[,45] |
qx2020F |
numeric | qx of completed lifetable functions of Japanese women in 2020. |
qx columns were cited from the completed life tables in Japan for the 1st to 23rd one (7th one was not made, so that it is missing).
Age
: Ages from 0 to 116.
qx1895M
-qx2020M
: qx of 1st to 23rd completed lifetables for Japanese men.
qx1895F
-qx2020F
: qx of 1st to 23rd completed lifetables for Japanese women.
https://warp.da.ndl.go.jp/info:ndljp/pid/1334623/www.stat.go.jp/english/data/chouki/02.htm https://warp.da.ndl.go.jp/collections/content/info:ndljp/pid/11423429/www.stat.go.jp/data/chouki/zuhyou/02-35.xls https://www.mhlw.go.jp/toukei/saikin/hw/life/20th/index.html https://www.mhlw.go.jp/toukei/saikin/hw/life/21th/index.html https://www.mhlw.go.jp/toukei/saikin/hw/life/22th/index.html https://www.mhlw.go.jp/toukei/saikin/hw/life/23th/index.html
Ministry of Health, Labor and Welfare of Japan: Completed lifetables. / Ministry of Internal Affairs and Communications, Statistics Bureau: Historical Statistics of Japan.
The data gives the sex and age specific population for the all census results in Japan.
Jpop
Jpop
A data frame with 86 observations on 61 variables.
[, 1] |
Age |
Factor w/86 levels | Ages (years old, combined for 85+) |
[, 2] |
M1888 |
numeric | Age specific population of males in 1888 |
[, 3] |
F1888 |
numeric | Age specific population of females in 1888 |
[, 4] |
M1893 |
numeric | Age specific population of males in 1893 |
[, 5] |
F1893 |
numeric | Age specific population of females in 1893 |
[, 6] |
M1898 |
numeric | Age specific population of males in 1898 |
[, 7] |
F1898 |
numeric | Age specific population of females in 1898 |
[, 8] |
M1903 |
numeric | Age specific population of males in 1903 |
[, 9] |
F1903 |
numeric | Age specific population of females in 1903 |
[,10] |
M1908 |
numeric | Age specific population of males in 1908 |
[,11] |
F1908 |
numeric | Age specific population of females in 1908 |
[,12] |
M1913 |
numeric | Age specific population of males in 1913 |
[,13] |
F1913 |
numeric | Age specific population of females in 1913 |
[,14] |
M1918 |
numeric | Age specific population of males in 1918 |
[,15] |
F1918 |
numeric | Age specific population of females in 1918 |
[,16] |
M1920 |
numeric | Age specific population of males in 1920 |
[,17] |
F1920 |
numeric | Age specific population of females in 1920 |
[,18] |
M1925 |
numeric | Age specific population of males in 1925 |
[,19] |
F1925 |
numeric | Age specific population of females in 1925 |
[,20] |
M1930 |
numeric | Age specific population of males in 1930 |
[,21] |
F1930 |
numeric | Age specific population of females in 1930 |
[,22] |
M1935 |
numeric | Age specific population of males in 1935 |
[,23] |
F1935 |
numeric | Age specific population of females in 1935 |
[,24] |
M1940 |
numeric | Age specific population of males in 1940 |
[,25] |
F1940 |
numeric | Age specific population of females in 1940 |
[,26] |
M1947 |
numeric | Age specific population of males in 1947 |
[,27] |
F1947 |
numeric | Age specific population of females in 1947 |
[,28] |
M1950 |
numeric | Age specific population of males in 1950 |
[,29] |
F1950 |
numeric | Age specific population of females in 1950 |
[,30] |
M1955 |
numeric | Age specific population of males in 1955 |
[,31] |
F1955 |
numeric | Age specific population of females in 1955 |
[,32] |
M1960 |
numeric | Age specific population of males in 1960 |
[,33] |
F1960 |
numeric | Age specific population of females in 1960 |
[,34] |
M1965 |
numeric | Age specific population of males in 1965 |
[,35] |
F1965 |
numeric | Age specific population of females in 1965 |
[,36] |
M1970 |
numeric | Age specific population of males in 1970 |
[,37] |
F1970 |
numeric | Age specific population of females in 1970 |
[,38] |
M1975 |
numeric | Age specific population of males in 1975 |
[,39] |
F1975 |
numeric | Age specific population of females in 1975 |
[,40] |
M1980 |
numeric | Age specific population of males in 1980 |
[,41] |
F1980 |
numeric | Age specific population of females in 1980 |
[,42] |
M1985 |
numeric | Age specific population of males in 1985 |
[,43] |
F1985 |
numeric | Age specific population of females in 1985 |
[,44] |
M1990 |
numeric | Age specific population of males in 1990 |
[,45] |
F1990 |
numeric | Age specific population of females in 1990 |
[,46] |
M1995 |
numeric | Age specific population of males in 1995 |
[,47] |
F1995 |
numeric | Age specific population of females in 1995 |
[,48] |
M2000 |
numeric | Age specific population of males in 2000 |
[,49] |
F2000 |
numeric | Age specific population of females in 2000 |
[,50] |
M2005 |
numeric | Age specific population of males in 2005 |
[,51] |
F2005 |
numeric | Age specific population of females in 2005 |
[,52] |
M2010 |
numeric | Age specific population of males in 2010 |
[,53] |
F2010 |
numeric | Age specific population of females in 2010 |
[,54] |
M2015 |
numeric | Age specific population of males in 2015 |
[,55] |
F2015 |
numeric | Age specific population of females in 2015 |
[,56] |
M2015J |
numeric | Age specific population of Japanese males in 2015 |
[,57] |
F2015J |
numeric | Age specific population of Japanese females in 2015 |
[,58] |
M2020 |
numeric | Age specific population of males in 2020 |
[,59] |
F2020 |
numeric | Age specific population of females in 2020 |
[,60] |
M2020J |
numeric | Age specific population of Japanese males in 2020 |
[,61] |
F2020J |
numeric | Age specific population of Japanese females in 2020 |
Japanese population data by sex and age given as national official census record.
Age
: Ages, combined for 85+.
M1888
-M2020
: Age specific number of males' population in 1988-2020.
F1888
-F2020
: Age specific number of females' population in 1988-2020.
M2015J
-M2020J
: Age specific number of the Japanese population of males in 2015-2020.
F2015J
-F2020J
: Age specific number of the Japanese population of females in 2015-2020.
https://www.stat.go.jp/english/data/kokusei/index.html https://warp.da.ndl.go.jp/info:ndljp/pid/1334623/www.stat.go.jp/english/data/chouki/02.htm https://www.e-stat.go.jp/stat-search/files/data?fileid=000007809775&rcount=3 https://www.e-stat.go.jp/stat-search/file-download?statInfId=000032142404&fileKind=0
Statistics Bureau, Ministry of Internal Affairs and Communications: Population Census, 1888-2020.
The data gives the sex and age specific population for the all census results in Japan.
Jpopl
Jpopl
A data frame with 111 observations on 67 variables.
[, 1] |
Age |
Factor w/111 levels | Ages (years old, combined for 110+) |
[, 2] |
M1888 |
numeric | Age specific population of males in 1888 |
[, 3] |
F1888 |
numeric | Age specific population of females in 1888 |
[, 4] |
M1893 |
numeric | Age specific population of males in 1893 |
[, 5] |
F1893 |
numeric | Age specific population of females in 1893 |
[, 6] |
M1898 |
numeric | Age specific population of males in 1898 |
[, 7] |
F1898 |
numeric | Age specific population of females in 1898 |
[, 8] |
M1903 |
numeric | Age specific population of males in 1903 |
[, 9] |
F1903 |
numeric | Age specific population of females in 1903 |
[,10] |
M1908 |
numeric | Age specific population of males in 1908 |
[,11] |
F1908 |
numeric | Age specific population of females in 1908 |
[,12] |
M1913 |
numeric | Age specific population of males in 1913 |
[,13] |
F1913 |
numeric | Age specific population of females in 1913 |
[,14] |
M1918 |
numeric | Age specific population of males in 1918 |
[,15] |
F1918 |
numeric | Age specific population of females in 1918 |
[,16] |
M1920 |
numeric | Age specific population of males in 1920 |
[,17] |
F1920 |
numeric | Age specific population of females in 1920 |
[,18] |
M1925 |
numeric | Age specific population of males in 1925 |
[,19] |
F1925 |
numeric | Age specific population of females in 1925 |
[,20] |
M1930 |
numeric | Age specific population of males in 1930 |
[,21] |
F1930 |
numeric | Age specific population of females in 1930 |
[,22] |
M1935 |
numeric | Age specific population of males in 1935 |
[,23] |
F1935 |
numeric | Age specific population of females in 1935 |
[,24] |
M1940 |
numeric | Age specific population of males in 1940 |
[,25] |
F1940 |
numeric | Age specific population of females in 1940 |
[,26] |
M1947 |
numeric | Age specific population of males in 1947 |
[,27] |
F1947 |
numeric | Age specific population of females in 1947 |
[,28] |
M1950 |
numeric | Age specific population of males in 1950 |
[,29] |
F1950 |
numeric | Age specific population of females in 1950 |
[,30] |
M1955 |
numeric | Age specific population of males in 1955 |
[,31] |
F1955 |
numeric | Age specific population of females in 1955 |
[,32] |
M1960 |
numeric | Age specific population of males in 1960 |
[,33] |
F1960 |
numeric | Age specific population of females in 1960 |
[,34] |
M1965 |
numeric | Age specific population of males in 1965 |
[,35] |
F1965 |
numeric | Age specific population of females in 1965 |
[,36] |
M1970 |
numeric | Age specific population of males in 1970 |
[,37] |
F1970 |
numeric | Age specific population of females in 1970 |
[,38] |
M1975 |
numeric | Age specific population of males in 1975 |
[,39] |
F1975 |
numeric | Age specific population of females in 1975 |
[,40] |
M1980 |
numeric | Age specific population of males in 1980 |
[,41] |
F1980 |
numeric | Age specific population of females in 1980 |
[,42] |
M1985 |
numeric | Age specific population of males in 1985 |
[,43] |
F1985 |
numeric | Age specific population of females in 1985 |
[,44] |
M1990 |
numeric | Age specific population of males in 1990 |
[,45] |
F1990 |
numeric | Age specific population of females in 1990 |
[,46] |
M1995 |
numeric | Age specific population of males in 1995 |
[,47] |
F1995 |
numeric | Age specific population of females in 1995 |
[,48] |
M2000 |
numeric | Age specific population of males in 2000 |
[,49] |
F2000 |
numeric | Age specific population of females in 2000 |
[,50] |
M2000J |
numeric | Age specific population of Japanese males in 2000 |
[,51] |
F2000J |
numeric | Age specific population of Japanese females in 2000 |
[,52] |
M2005 |
numeric | Age specific population of males in 2005 |
[,53] |
F2005 |
numeric | Age specific population of females in 2005 |
[,54] |
M2005J |
numeric | Age specific population of Japanese males in 2005 |
[,55] |
F2005J |
numeric | Age specific population of Japanese females in 2005 |
[,56] |
M2010 |
numeric | Age specific population of males in 2010 |
[,57] |
F2010 |
numeric | Age specific population of females in 2010 |
[,58] |
M2010J |
numeric | Age specific population of Japanese males in 2010 |
[,59] |
F2010J |
numeric | Age specific population of Japanese females in 2010 |
[,60] |
M2015 |
numeric | Age specific population of males in 2015 |
[,61] |
F2015 |
numeric | Age specific population of females in 2015 |
[,62] |
M2015J |
numeric | Age specific population of Japanese males in 2015 |
[,63] |
F2015J |
numeric | Age specific population of Japanese females in 2015 |
[,64] |
M2020 |
numeric | Age specific population of males in 2020 |
[,65] |
F2020 |
numeric | Age specific population of females in 2020 |
[,66] |
M2020J |
numeric | Age specific population of Japanese males in 2020 |
[,67] |
F2020J |
numeric | Age specific population of Japanese females in 2020 |
Japanese population data by sex and age given as national official census record.
Age
: Ages, combined for 110+.
M1888
-M2020
: Age specific number of males' population in Japan for 1888-2020.
F1888
-F2020
: Age specific number of females' population in Japan for 1888-2020.
M2000J
-M2020J
: Age specific number of Japanese males' population in Japan for 2000-2020 by every 5 years.
F2000J
-F2020J
: Age specific number of Japanese females' population in Japan for 2000-2020 by every 5 years.
https://www.stat.go.jp/english/data/kokusei/index.html https://warp.da.ndl.go.jp/info:ndljp/pid/1334623/www.stat.go.jp/english/data/chouki/02.htm https://www.e-stat.go.jp/stat-search/files/data?fileid=000007809775&rcount=3 https://www.e-stat.go.jp/stat-search/file-download?statInfId=000032142404&fileKind=0
Statistics Bureau, Ministry of Internal Affairs and Communications: Population Census, 1888-2020.
The data gives longitudinal data of several vital statistics in Japan. Included indices are crude birth rates, crude death rates, infant mortality rates, and so on.
Jvital
Jvital
A data frame with 121 observations on 19 variables.
[, 1] |
YEAR |
numeric | Year |
[, 2] |
CBR |
numeric | Crude birth rates of Japan |
[, 3] |
CDR |
numeric | Crude death rates of Japan |
[, 4] |
IMR |
numeric | Infant mortality rates of Japan |
[, 5] |
NMR |
numeric | Neonatal mortality rates of Japan |
[, 6] |
NIR |
numeric | Natural increase rates of Japan |
[, 7] |
SBRPB |
numeric | Stillbirth rates of Japan |
[, 8] |
SARPB |
numeric | Spontaneous abortion rates of Japan |
[, 9] |
ACRPB |
numeric | Artificial contraception rates of Japan |
[,10] |
PNMPB |
numeric | Perinatal mortalities per birth of Japan |
[,11] |
MR |
numeric | Marriage rates of Japan |
[,12] |
DR |
numeric | Divorce rates of Japan |
[,13] |
TFR |
numeric | Total fertility rates of Japan |
[,14] |
ASMRM |
numeric | Age-standardized mortality rates of males in Japan |
[,15] |
ASMRM2 |
numeric | Age-standardized mortality rates of males in Japan using new model population 2015 |
[,16] |
ASMRF |
numeric | Age-standardized mortality rates of females in Japan |
[,17] |
ASMRF2 |
numeric | Age-standardized mortality rates of females in Japan using new model population 2015 |
[,18] |
PNMPLB |
numeric | Perinatal mortalities per live births of Japan |
[,19] |
MMR |
numeric | Maternal mortality rates per 100000 births in Japan |
Longitudinal vital statistics in Japan provided as national official vital statitistics every year from 1899 to 2022, except for 1944-1946.
YEAR
: Calender year.
CBR
: Crude birth rate. Number of all live birth / mid-year population 1000.
CDR
: Crude death rate. Number of death / mid-year population 1000.
IMR
: Infant mortality rate. Number of death at age 0 / 1000 live births.
NMR
: Neonatal mortality rate. Number of death within 4 weeks after birth / 1000 live births.
NIR
: Natural increase rate. CBR
-CDR
.
SBRPB
: Stillbirth rate per birth. Number of stillbirths / 1000 births.
SARPB
: Spontaneous abortion rate per birth. Number of spontaneous abortions / 1000 births.
ACRPB
: Artificial contraception (= induced abortion) rate per birth. Number of induced abortions / 1000 births.
PNMPB
: Perinatal mortality per birth. [(Number of stillbirths after gestational age 22 weeks) + (Number of early neonatal deaths within a week after birth)] per 1000 births. The denominator is the sum of the number of stillbirths after gestational age 22 weeks and the number of live births. This definition was established in 1995, but PNMPB
also includes some values before 1995.
MR
: Marital rate. The number of marriages / mid-year population 1000.
DR
: Divorce rate. The number of divorces / mid-year population 1000.
TFR
: Total fertility rate. The sum of age-specific fertility rates, which is the number of births divided by the number of women's population for each age.
ASMRM
: Age-standardized mortality rate of males, per mid-year population 1000, where the standard population is the model population in 1985 (S60MPJ
).
ASMRM2
: Age-standardized mortality rate of males, per mid-year population 1000, where the standard population is the model population in 2015 (H27MPJ
).
ASMRF
: Age-standardized mortality rate of females, per mid-year population 1000, where the standard population is the model population in 1985 (S60MPJ
).
ASMRF2
: Age-standardized mortality rate of females, per mid-year population 1000, where the standard population is the model population in 2015 (H27MPJ
).
PNMPLB
: Perinatal mortality per live birth. [(Number of stillbirths after gestational age 28 weeks) + (Number of early neonatal deaths within a week after birth)] per 1000 live births (Note: the denominator does not include stillbirths!). This definition stood until 1994, but PNMPLB
also includes values after 1995, for comparison.
MMR
: Maternal mortality rate (actually ratio) per birth. (Number of maternal deaths during pregnancy or postpartum periods within 42 days [90 days until 1978] after the delivery due to reproduction-related causes) / (Number of total births = live births + stillbirths)* 100,000.
https://www.mhlw.go.jp/toukei/list/dl/81-1a2.pdf https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/geppo/nengai10/toukei02.html https://www.ipss.go.jp/p-info/e/psj2012/PSJ2012-05.xls https://www.mhlw.go.jp/english/database/db-hw/vs01.html https://www.e-stat.go.jp/stat-search/files/data?sinfid=000022220050&ext=csv https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei12/ https://www.e-stat.go.jp/stat-search/files/data?sinfid=000022220091&ext=csv https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei13/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei14/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei15/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei16/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei17/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei18/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei19/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei20/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei21/ https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei22/ https://www.ipss.go.jp/syoushika/tohkei/Popular/P_Detail2021.asp?fname=T05-28.htm https://www.e-stat.go.jp/stat-search/file-download?statInfId=000040098325&fileKind=1
Ministry of Health, Labor and Welfare of Japan: Vital Statistics.
National Institude for Population and Social Security Research: Table 5-28 of Population Statistics of Japan 2019.
The data gives cross sectional data of several vital statistics in Japan 2013 for each prefecture. Included indices are crude birth rates, crude death rates, infant mortality rates, and so on.
Jvital2013byPref
Jvital2013byPref
A data frame with 47 observations on 34 variables.
[, 1] |
PNAME |
factor w/47 levels | The name (in roma-ji) for prefectures |
[, 2] |
JCODE |
numeric | Prefecture number defined by Geographical Information Authority of Japan |
[, 3] |
CBR |
numeric | Crude birth rates |
[, 4] |
CDR |
numeric | Crude death rates |
[, 5] |
IMR |
numeric | Infant mortality rates |
[, 6] |
NMR |
numeric | Neonatal mortality rates |
[, 7] |
NIR |
numeric | Natural increase rates |
[, 8] |
SBRPB |
numeric | Stillbirth rates |
[, 9] |
SARPB |
numeric | Spontaneous abortion rates |
[,10] |
ACRPB |
numeric | Artificial contraception rates |
[,11] |
PNMPB |
numeric | Perinatal mortalities per birth |
[,12] |
SBRA22W |
numeric | Stillbirth rate after gestational age of 22 weeks per birth |
[,13] |
ENMR |
numeric | Early neonatal mortality rate per live birth |
[,14] |
MR |
numeric | Marriage rates |
[,15] |
DR |
numeric | Divorce rates |
[,16] |
TFR |
numeric | Total fertility rates |
[,17] |
CSM.ALL |
numeric | Cause-specific mortality for all causes |
[,18] |
CSM.CANCER |
numeric | Cause-specific mortality for cancer |
[,19] |
CSM.HD |
numeric | Cause-specific mortality for heart disease except for hypertention |
[,20] |
CSM.PNEUM |
numeric | Cause-specific mortality for pneumonia |
[,21] |
CSM.CEVD |
numeric | Cause-specific mortality for cerebrovascular disease |
[,22] |
CSM.SEN |
numeric | Cause-specific mortality for senescence |
[,23] |
CSM.ACC |
numeric | Cause-specific mortality for accidents |
[,24] |
CSM.SUI |
numeric | Cause-specific mortality for suicide |
[,25] |
CSM.KF |
numeric | Cause-specific mortality for kidney failure |
[,26] |
CSM.COPD |
numeric | Cause-specific mortality for chronic obstructive pulmonary disease |
[,27] |
CSM.AA |
numeric | Cause-specific mortality for aneuysm of aorta |
[,28] |
CSM.LIVD |
numeric | Cause-specific mortality for liver disease |
[,29] |
CSM.DIAB |
numeric | Cause-specific mortality for diabetes |
[,30] |
CSM.SEP |
numeric | Cause-specific mortality for sepsis |
[,31] |
CSM.MNP |
numeric | Cause-specific mortality for miscellaneous neoplasms |
[,32] |
CSM.DEM |
numeric | Cause-specific mortality for dementia |
[,33] |
CSM.TB |
numeric | Cause-specific mortality for tuberculosis |
[,34] |
CSM.TA |
numeric | Cause-specific mortality for traffic accidents |
Official vital statistics in Japan in 2013 for each prefecture.
PNAME
: The name (in roma-ji) for prefectures.
JCODE
: Prefecture number defined by Geographical Information Authority of Japan. From 1 to 47.
CBR
: Crude birth rate. Number of all live birth / mid-year population 1000.
CDR
: Crude death rate. Number of death / mid-year population 1000.
IMR
: Infant mortality rate. Number of death at age 0 / 1000 live births.
NMR
: Neonatal mortality rate. Number of death within 4 weeks after birth / 1000 live births.
NIR
: Natural increase rate. CBR
-CDR
.
SBRPB
: Stillbirth rate per birth. Number of stillbirths / 1000 births.
SARPB
: Spontaneous abortion rate per birth. Number of spontaneous abortions / 1000 births.
ACRPB
: Artificial contraception (= induced abortion) rate per birth. Number of induced abortions / 1000 births.
PNMPB
: Perinatal mortality per birth. [(Number of stillbirths after gestational age 22 weeks) + (Number of early neonatal deaths within a week after birth)] per 1000 births. The denominator is the sum of the number of stillbirths after gestational age 22 weeks and the number of live births. This definition was established in 1995, but PNMPB
also includes some values before 1995.
SBRA22W
: Stillbirth rate after gestational age of 22 weeks per 1000 births.
ENMR
: Early neonatal mortality rate per 1000 live births.
MR
: Marital rate. The number of marriages / mid-year population 1000.
DR
: Divorce rate. The number of divorces / mid-year population 1000.
TFR
: Total fertility rate. The sum of age-specific fertility rates, which is the number of births divided by the number of women's population for each age.
CSM.ALL
: Cause-specific mortality for all causes. Similar to CDR
, but the denominator is mid-year population 100000 instead of 1000.
CSM.CANCER
: Cause-specific mortality for cancer. The number of deaths caused by cancer / mid-year population 100000.
CSM.HD
: Cause-specific mortality for heart disease except for hypertention / mid-year population 100000.
CSM.PNEUM
: Cause-specific mortality for pneumonia / mid-year population 100000.
CSM.CEVD
: Cause-specific mortality for cerebrovascular disease / mid-year population 100000.
CSM.SEN
: Cause-specific mortality for senescence / mid-year population 100000.
CSM.ACC
: Cause-specific mortality for accidents / mid-year population 100000.
CSM.SUI
: Cause-specific mortality for suicide / mid-year population 100000.
CSM.KF
: Cause-specific mortality for kidney failure / mid-year population 100000.
CSM.COPD
: Cause-specific mortality for chronic obstructive pulmonary disease / mid-year population 100000.
CSM.AA
: Cause-specific mortality for aneuysm of aorta / mid-year population 100000.
CSM.LIVD
: Cause-specific mortality for liver disease / mid-year population 100000.
CSM.DIAB
: Cause-specific mortality for diabetes / mid-year population 100000.
CSM.SEP
: Cause-specific mortality for sepsis / mid-year population 100000.
CSM.MNP
: Cause-specific mortality for miscellaneous neoplasms / mid-year population 100000.
CSM.DEM
: Cause-specific mortality for dementia / mid-year population 100000.
CSM.TB
: Cause-specific mortality for tuberculosis / mid-year population 100000.
CSM.TA
: Cause-specific mortality for traffic accidents / mid-year population 100000.
https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei13/xls/hyo.xls https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/kakutei13/xls/sankou.xls
Ministry of Health, Labor and Welfare of Japan: Vital Statistics 2013.
Calculate Cohen's kappa statistics for agreement and its confidence intervals followed by testing null-hypothesis that the extent of agreement is same as random, kappa statistic equals zero.
Kappa.test(x, y=NULL, conf.level=0.95)
Kappa.test(x, y=NULL, conf.level=0.95)
x |
If y is not given, x must be the square matrix that the rows and columns show the ratings of different rater (or repeated measure) and the values indicate the numbers of data having that combination. If y is given, x must be the result of ratings by the first rater (or first time measurement). |
y |
If given, y must be the result of ratings by the second rater (or second time measurement). As default, it is not given. |
conf.level |
Probability for confidence intervals for kappa statistics. Default is 0.95. |
Result$statistic |
Z score to test null-hypothesis. |
Result$estimate |
Calculated point estimate of Cohen's kappa statistic. |
Result$conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
Result$p.value |
The significant probability as the result of null-hypothesis testing. |
Judgement |
The judgement for the estimated kappa about the extent of agreement, given by Landis JR, Koch GG (1977) Biometrics, 33: 159-174: If kappa is less than 0, "No agreement", if 0-0.2, "Slignt agreement", if 0.2-0.4, "Fair agreement", if 0.4-0.6, "Moderate agreement", if 0.6-0.8, "Substantial agreement", if 0.8-1.0, "Almost perfect agreement". |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Landis JR, Koch GG (1977) The measurement of observer agreement for categorical data. Biometrics, 33: 159-174.
res <- Kappa.test(matrix(c(20, 10, 5, 15), 2, 2)) str(res) print(res) Kappa.test(c(1, 1, 3, 1, 1, 2, 1, 2, 1, 1), c(2, 1, 3, 1, 3, 2, 1, 3, 3, 3))
res <- Kappa.test(matrix(c(20, 10, 5, 15), 2, 2)) str(res) print(res) Kappa.test(c(1, 1, 3, 1, 1, 2, 1, 2, 1, 1), c(2, 1, 3, 1, 3, 2, 1, 3, 3, 3))
Lifetable related functions.
lifetable(mx, ns=NULL, class=5, mode=1) lifetable2(mx, ax=0.5, n=1) lifetable3(lx, ax=0.5, n=1) clifetable(qx) lxtodx(lx) dxtolx(dx) qxtodx(qx) dxtoqx(dx) qxtomx(qx, ax=0.5, n=1, mmax=NULL) mxtoqx(mx, ax=0.5, n=1) qxtolx(qx) lxtoqx(lx) uxtoqx(ux) hlifetable(mx, ax=0.5, n=5, pix=0, Nx=NULL, conf.level=0.95) getax(lx, Tx, n=5)
lifetable(mx, ns=NULL, class=5, mode=1) lifetable2(mx, ax=0.5, n=1) lifetable3(lx, ax=0.5, n=1) clifetable(qx) lxtodx(lx) dxtolx(dx) qxtodx(qx) dxtoqx(dx) qxtomx(qx, ax=0.5, n=1, mmax=NULL) mxtoqx(mx, ax=0.5, n=1) qxtolx(qx) lxtoqx(lx) uxtoqx(ux) hlifetable(mx, ax=0.5, n=5, pix=0, Nx=NULL, conf.level=0.95) getax(lx, Tx, n=5)
mx |
Lifetable function mx, meaning the age (class)-specific death rates. |
ns |
If given as a vector with the same length as mx, the duration for each age (class). Default is NULL: same duration with class is automatically used. |
n |
If given as a vector with the same length as mx or qx, the duration for each age (class). Default is 1, which means the length for all age-classes being 1 year. |
class |
Age-class of lifetable() function. Default is 5. |
mode |
How to set ax and correction method in conversion from mx to qx. 1 and 11: all ax is 0.5 except the open-ended class [where ax is reciprocal of mx], 2, 4, 12, 14: ax is 0.1 for age 0, 0.4 for age 1-4, 0.5 for the other ages except the open-ended class [where ax is reciprocal of mx], 3, 5, 13, 15: ax is 0.3 for age 0, 0.4 for age 1-4, 0.5 for the other ages except the open-ended class [where ax is reciprocal of mx], 6 and 16: Males value given in Preston SH (2001), pp.48 Table 3.3, 7 and 17: Females value given in Preston SH (2001), pp.48 Table 3.3. If less than 10, simply calculating qx as n*mx/(1+n*(1-ax)*mx) (Note: In the formula of Preston SH (2001) pp.47, the function is given as n*mx/(1+(n-ax)*mx). The difference is due to the formulation of ax. In this function, ax is given for single age, same as Newell C (1988), pp.71) except for the open-ended class where qx=1, otherwise calculating qx by Greville's method. Default is 1. |
ax |
Lifetable function ax, fraction of last year lived. Default is 0.5 (scalar) for all classes. It can be given as scalar or vector. Note: This argument can only be specified in lifetable2() or lifetable3(), not in lifetable(). |
qx |
Lifetable function qx, which means the probability of dying between age x and x+1 (for lifetable(), x+class). |
mmax |
To calculate mx from qx, mx at the maximum open-ended age-class cannot be calculated from qx. In such situation, mmax gives a value for it. Default is NULL. |
lx |
Lifetable function lx, which means number of people left alive at age x from 100,000 newborns. |
dx |
Lifetable function dx, which means number of people dying between age x and x+1 (for lifetable(), x+class) from 100,000 newborns. Differentials of lx. |
ux |
The force of mortality. |
pix |
age-(class-)specific proportions of unhealthy people. |
Nx |
Population of xth age-class, which is needed to calculate confidence intervals. |
conf.level |
The level of confidence intervals. Default is 0.95. |
Tx |
Lifetable function Tx, which means sum of person-years lived above age x. |
ages |
Lifetable's exact age x, which is the beginning of each interval. |
n |
Duration of each interval. If ns is not given, the value of the class is repeatedly used. |
mx |
Lifetable function mx, meaning the age (class)-specific death rates. |
qx |
Lifetable function qx, which means the probability of dying between age x and x+1 (for lifetable(), x+class). |
ax |
Lifetable function ax, which means the average number of person-years lived in the interval by those dying in the interval. In lifetable(), it's automatically specified by mode. |
lx |
Lifetable function lx, which means number of people left alive at age x from 100,000 newborns. |
dx |
Lifetable function dx, which means number of people dying between age x and x+1 (for lifetable(), x+class) from 100,000 newborns. Differentials of lx. |
Lx |
Lifetable function Lx, which means person-years lived between age x and x+class. |
Tx |
Lifetable function Tx, which means person-years lived above age x. |
ex |
Lifetable function ex, which means expectation of life at age x. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Preston SH, Heuveline P, Guillot M (2001) Demography: Measuring and Modeling Population Processes. Blackwell Publishing, Oxford.
Newell C (1988) Methods and Models in Demography. The Guilford Press, New York.
Sullivan DF (1971) A single index of mortality and morbidity. HSMHA Health Reports, 86: 347-354.
lifetable(c(0.0087, 0.00015, 0.00019, 0.00098, 0.0013, 0.0011, 0.0014, 0.0019, 0.0029, 0.0048, 0.0071, 0.011, 0.019, 0.028, 0.041, 0.072, 0.11, 0.19), class=5, mode=11) lifetable2(c(0.008314, 0.000408, 0.000181, 0.000187, 0.000282, 0.000307, 0.000364, 0.000566, 0.000884, 0.001445, 0.002485, 0.004210, 0.007219, 0.012054, 0.018259, 0.029920, 0.049689, 0.085545, 0.177987), ax = c(0.1, 0.4, rep(0.5, 16), NA), n = c(1, 4, rep(5, 16), NA) ) lifetable3(lx=c(1.0, 0.8499, 0.8070, 0.7876, 0.7762, 0.7691, 0.7502, 0.7362, 0.7130, 0.6826, 0.6525, 0.6223, 0.5898, 0.5535, 0.5106, 0.4585, 0.3965, 0.3210, 0.2380, 0.1516, 0.0768, 0.0276, 0.0059, 0.0006, 0), n=c(rep(1, 5), rep(5, 20)), ax=c(0.3, rep(0.5, 24))) # Newell, Table 13.1 clifetable(Jlife$qx2000F)
lifetable(c(0.0087, 0.00015, 0.00019, 0.00098, 0.0013, 0.0011, 0.0014, 0.0019, 0.0029, 0.0048, 0.0071, 0.011, 0.019, 0.028, 0.041, 0.072, 0.11, 0.19), class=5, mode=11) lifetable2(c(0.008314, 0.000408, 0.000181, 0.000187, 0.000282, 0.000307, 0.000364, 0.000566, 0.000884, 0.001445, 0.002485, 0.004210, 0.007219, 0.012054, 0.018259, 0.029920, 0.049689, 0.085545, 0.177987), ax = c(0.1, 0.4, rep(0.5, 16), NA), n = c(1, 4, rep(5, 16), NA) ) lifetable3(lx=c(1.0, 0.8499, 0.8070, 0.7876, 0.7762, 0.7691, 0.7502, 0.7362, 0.7130, 0.6826, 0.6525, 0.6223, 0.5898, 0.5535, 0.5106, 0.4585, 0.3965, 0.3210, 0.2380, 0.1516, 0.0768, 0.0276, 0.0059, 0.0006, 0), n=c(rep(1, 5), rep(5, 20)), ax=c(0.3, rep(0.5, 24))) # Newell, Table 13.1 clifetable(Jlife$qx2000F)
To compare the maternity histories among several human populations, this kind of graph is useful, inspired by Wood JW (1994) "Dynamics of Human Reproduction", Aldine de Gruyter, New York.
mhchart(LIST, XLIM=c(15,45), COL="black", FILL="white", BWD=1, ...)
mhchart(LIST, XLIM=c(15,45), COL="black", FILL="white", BWD=1, ...)
LIST |
The list of groups with their maternity histories from first birth to the last birth. Usually the first childbirth age is estimated as median by Kaplan-Meier method, the second childbirth age was given by adding the median of first birth intervals to the first childbirth age by Kaplan-Meier method, and so on. |
XLIM |
The limit of x axis, which means the range of reproductive ages. Default is 15 and 45. |
COL |
The border color. Default is black. |
FILL |
The painting color. Default is white. |
BWD |
The line width of the boxes. Default is 1. |
... |
Other parameters handed to barplot() to draw axes and background. |
No value is returned.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Developing <- c(18, 21, 24, 27, 30, 33.5, 37) Hutterite <- c(23, 25, 27, 29, 31, 33, 35, 37, 39) Gainj <- c(27, 31, 35, 39) Japan <- c(29, 34) x <- list( Developing=Developing, Hutterite=Hutterite, Gainj=Gainj, Japan=Japan) mhchart(rev(x), COL="blue", FILL="pink", BWD=2, XLIM=c(15, 45), main="Maternity histories for selected populations", xlab="Maternal age (years)")
Developing <- c(18, 21, 24, 27, 30, 33.5, 37) Hutterite <- c(23, 25, 27, 29, 31, 33, 35, 37, 39) Gainj <- c(27, 31, 35, 39) Japan <- c(29, 34) x <- list( Developing=Developing, Hutterite=Hutterite, Gainj=Gainj, Japan=Japan) mhchart(rev(x), COL="blue", FILL="pink", BWD=2, XLIM=c(15, 45), main="Maternity histories for selected populations", xlab="Maternal age (years)")
To evaluate the goodness of fit of the logistic regression model, calculating Nagelkerke's R squared from the result of glm(). The Nagelkerke's R squared means the power of explanation of the model.
NagelkerkeR2(rr)
NagelkerkeR2(rr)
rr |
The object with class "glm" and "lm", which would be generated by glm(). |
N |
The number of observations in which the model were fitted. |
R2 |
Nagelkerke's R squared. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Nagelkerke N (1991) A note on a general definition of the coefficient of determination. Biometrika, 78: 691-692.
Faraway JJ (2006) Extending the linear models with R: Generalized linear, mixed effects and nonparametric regression models. Chapman and Hall.
https://minato.sip21c.org/grad/infop-text2012.pdf
res <- glm(cbind(ncases,ncontrols) ~ agegp+alcgp+tobgp, data=esoph, family=binomial()) summary(res) NagelkerkeR2(res)
res <- glm(cbind(ncases,ncontrols) ~ agegp+alcgp+tobgp, data=esoph, family=binomial()) summary(res) NagelkerkeR2(res)
Calculate odds ratio and its confidence intervals based on approximation, followed by null-hypothesis (odds ratio equals to 1) testing.
oddsratio(a, b, c, d, conf.level=0.95, p.calc.by.independence=TRUE)
oddsratio(a, b, c, d, conf.level=0.95, p.calc.by.independence=TRUE)
a |
A scalar or a matrix. If matrix, it has to be 2 by 2, which contains the number of individuals who both suffer from exposure and disease as [1, 1], the number of individuals who suffer from disesase but not exposed as [2, 1], the number of individuals who suffer from exposure but are healthy as [1, 2] and the number of individuals who neither suffered from exposure nor disease as [2, 2]. |
b |
If a is a scalar, this has to be given as the number of individuals who suffer from disesase but not exposed. Otherwise, ignored. |
c |
If a is a scalar, this has to be given as the number of individuals who suffer from exposure but are healthy. Otherwise, ignored. |
d |
If a is a scalar, this has to be given as the number of individuals who neither suffered from exposure nor disease. Otherwise, ignored. |
conf.level |
Probability for confidence intervals. Default is 0.95. |
p.calc.by.independence |
Logical. If TRUE, calculating p-value by testing the null-hypothesis of independence between exposure and disease. Otherwise, calculating p-value by inverse-function of confidence intervals calculation (the result becomes the same as the vcd package). Default TRUE. |
estimate |
Calculated point estimate of odds ratio. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
p.value |
The significant probability as the result of null-hypothesis testing. |
This function can also accept a matrix as argument, as suggested by Dr. Toshiaki Ara ([email protected]). Thanks for a good suggestion.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
res <- oddsratio(5, 10, 85, 80) str(res) print(res) oddsratio(12, 5, 6, 12) oddsratio(12, 5, 6, 12, p.calc.by.independence=FALSE) DH <- sample(c("Disease", "Health"), 100, replace=TRUE) EN <- sample(c("Exposed", "Nonexposed"), 100, replace=TRUE) x <- table(EN, DH) oddsratio(x) # same as oddsratio(x[1,1], x[2,1], x[1,2], x[2,2])
res <- oddsratio(5, 10, 85, 80) str(res) print(res) oddsratio(12, 5, 6, 12) oddsratio(12, 5, 6, 12, p.calc.by.independence=FALSE) DH <- sample(c("Disease", "Health"), 100, replace=TRUE) EN <- sample(c("Exposed", "Nonexposed"), 100, replace=TRUE) x <- table(EN, DH) oddsratio(x) # same as oddsratio(x[1,1], x[2,1], x[1,2], x[2,2])
Calculate pooled odds ratio and its confidence intervals with Mantel-Haenszel's method.
ORMH(TBL, conf.level=0.95)
ORMH(TBL, conf.level=0.95)
TBL |
A matrix with 4 columns. The first column is the number of exposed cases. The second column is the number of unexposed cases. The third column is the number of exposed controls. The forth column is the number of unexposed controls. Rows should be composed of different strata or studies. |
conf.level |
Probability for confidence intervals. Default is 0.95. |
estimate |
Calculated point estimate of pooled odds ratio with Manterl-Haenszel's method. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
conf.level |
Simply return the value of given conf.level. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
# Table 10-6 of Rothman's textbook (Chapter 10). ORMH(matrix(c(3, 9, 104, 1059, 1, 3, 5, 86), 2, 4, byrow=TRUE), conf.level=0.9) # Figure 8-4 of Rothman's textbook (Chapter 8) # https://www.ncbi.nlm.nih.gov/pubmed/7630245 # https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(05)74403-2/fulltext TenStudies <- matrix( c(215, 229, 311-215, 306-229, 38, 33, 59-38, 51-33, 161, 174, 293-161, 293-174, 76, 88, 164-76, 163-88, 103, 105, 129-103, 133-105, 65, 67, 120-65, 125-67, 81, 75, 113-81, 110-75, 48, 63, 160-48, 159-63, 22, 21, 60-22, 62-21, 56, 51, 137-56, 140-51 ), 10, 4, byrow=TRUE) ORMH(TenStudies) ElevenStudies <- rbind(TenStudies, c(468, 480, 229, 205)) ORMH(ElevenStudies)
# Table 10-6 of Rothman's textbook (Chapter 10). ORMH(matrix(c(3, 9, 104, 1059, 1, 3, 5, 86), 2, 4, byrow=TRUE), conf.level=0.9) # Figure 8-4 of Rothman's textbook (Chapter 8) # https://www.ncbi.nlm.nih.gov/pubmed/7630245 # https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(05)74403-2/fulltext TenStudies <- matrix( c(215, 229, 311-215, 306-229, 38, 33, 59-38, 51-33, 161, 174, 293-161, 293-174, 76, 88, 164-76, 163-88, 103, 105, 129-103, 133-105, 65, 67, 120-65, 125-67, 81, 75, 113-81, 110-75, 48, 63, 160-48, 159-63, 22, 21, 60-22, 62-21, 56, 51, 137-56, 140-51 ), 10, 4, byrow=TRUE) ORMH(TenStudies) ElevenStudies <- rbind(TenStudies, c(468, 480, 229, 205)) ORMH(ElevenStudies)
By conducting repeatedly Fisher's exact tests instead of chi-square tests, this function can test the null-hypothesis of no difference in any pair of proportions for more than 2 groups, with adjustment of type I error for multiple comparison.
pairwise.fisher.test(x, n, p.adjust.method, ...)
pairwise.fisher.test(x, n, p.adjust.method, ...)
x |
A integer vector of event occurences |
n |
A integer vector of trials |
p.adjust.method |
A name in p.adjust.methods to specify the method to adjust type I error for multiple comparisons. Default is "holm". |
... |
Miscellaneous arguments to be given for fisher.test(). |
An object of adjusted p-values for all possible comparisons of pairs with class pairwise.htest.
Minato Nakazawa [email protected] https://minato.sip21c.org/. The code of this function was provided by Dr. Shigenobu AOKI (Gunma Univ.).
pairwise.prop.test, p.adjust.methods
pairwise.fisher.test(c(2, 4, 5), c(10, 14, 17), p.adjust.method="bonferroni") smoker <- c(2, 1, 7) total <- c(11, 14, 10) names(total) <- c("A", "B", "C") pairwise.fisher.test(smoker, total)
pairwise.fisher.test(c(2, 4, 5), c(10, 14, 17), p.adjust.method="bonferroni") smoker <- c(2, 1, 7) total <- c(11, 14, 10) names(total) <- c("A", "B", "C") pairwise.fisher.test(smoker, total)
Population Expansion Index (Bulge Index) for movement.
PEI(X, CLS, MODE)
PEI(X, CLS, MODE)
X |
The vector to give age-specific population from age 0. |
CLS |
The width of age-class in X. default is 1. |
MODE |
If the MODE is 1, the ages of 20 to 39 years old are assumed as "easily movable ages" comparing with "relatively unmovable" 10 to 19 and 40 to 49, otherwise the ages of 15 to 34 years old are assumed as the former and 5 to 14 and 35 to 44 are assumed as the latter, as Dr. Toshio Kuroda suggested in his book. Then PEI (originally named as bulge index, but I prefer to use PEI instead) is calculated as the ratio of the population of "easily movable ages" to the population of "relatively unmovavle ages" times 100. If PEI is larger than 100, net migration may be positive and vise versa. Default 1. |
The value of PEI is returned.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Kuroda T (1976) Japan's Changing Population Structure (in Japanese). Kokon-Shoin, Tokyo.
Kuroda T (1971) A study on population composition: Special reference to Japan. (in Japanese, with abstract in English) Journal of Population Problems (Jinko-Mondai-Kenkyu), No. 119: 1-12. https://www.ipss.go.jp/syoushika/bunken/data/pdf/j119.pdf
# Prefectural population estimates in 2018 (unit=1000 persons) # total of males and females, by 5 year age-class # (Data source) Download Excel file and extracted # \url{https://www.e-stat.go.jp/stat-search/file-download?statInfId=000031807147&fileKind=0} PPT2018 <- data.frame( Hokkaido = c(175, 195, 207, 229, 235, 232, 266, 304, 367, 381, 344, 341, 354, 452, 368, 310, 252, 274), Aomori = c(41, 45, 51, 58, 48, 48, 59, 69, 82, 86, 83, 88, 94, 112, 89, 75, 67, 69), Iwate = c(41, 47, 52, 57, 47, 50, 59, 69, 81, 82, 78, 84, 91, 106, 82, 74, 67, 75), Miyagi = c(85, 93, 98, 109, 123, 119, 130, 144, 164, 163, 144, 146, 155, 182, 139, 116, 98, 108), Akita = c(28, 33, 37, 40, 30, 33, 42, 51, 61, 62, 59, 69, 78, 93, 72, 63, 61, 69), Yamagata = c(38, 42, 47, 51, 40, 43, 53, 61, 70, 69, 66, 73, 80, 95, 71, 62, 58, 73), Fukushima = c(67, 70, 79, 89, 73, 80, 94, 105, 122, 124, 117, 129, 139, 160, 119, 102, 89, 106), Ibaraki = c(106, 117, 127, 140, 132, 130, 152, 172, 204, 216, 185, 176, 190, 233, 196, 162, 116, 125), Tochigi = c(73, 80, 87, 92, 83, 90, 107, 122, 142, 146, 125, 121, 131, 157, 127, 101, 76, 84), Gumma = c(70, 79, 87, 97, 90, 88, 99, 113, 139, 148, 127, 117, 124, 153, 135, 110, 82, 94), Saitama = c(279, 299, 312, 343, 405, 381, 407, 458, 552, 608, 508, 428, 415, 524, 488, 411, 275, 235), Chiba = c(233, 251, 264, 289, 323, 310, 344, 387, 465, 513, 428, 367, 361, 460, 430, 358, 248, 225), Tokyo = c(539, 516, 495, 554, 867, 911, 961, 1013, 1109, 1167, 1005, 810, 687, 797, 750, 647, 500, 494), Kanagawa = c(351, 374, 385, 423, 518, 490, 529, 592, 706, 788, 679, 551, 486, 599, 558, 479, 343, 326), Niigata = c(78, 88, 94, 103, 92, 94, 111, 127, 152, 154, 141, 141, 155, 190, 151, 129, 111, 135), Toyama = c(37, 40, 45, 50, 44, 44, 50, 58, 75, 79, 65, 62, 65, 84, 80, 63, 49, 60), Ishikawa = c(44, 48, 51, 57, 57, 53, 58, 65, 82, 86, 71, 68, 70, 86, 80, 63, 47, 58), Fukui = c(30, 33, 36, 39, 33, 34, 39, 43, 52, 54, 48, 49, 50, 62, 50, 43, 36, 44), Yamanashi = c(29, 32, 36, 41, 38, 35, 39, 44, 53, 60, 56, 53, 54, 64, 54, 47, 37, 46), Nagano = c(76, 85, 94, 101, 79, 83, 98, 114, 143, 150, 133, 127, 130, 159, 142, 122, 98, 129), Gifu = c(75, 86, 92, 101, 92, 86, 98, 112, 139, 148, 128, 122, 123, 155, 139, 116, 90, 96), Shizuoka = c(137, 155, 164, 175, 150, 162, 193, 214, 256, 276, 241, 225, 230, 284, 251, 212, 161, 173), Aichi = c(319, 339, 344, 374, 420, 414, 451, 484, 567, 610, 507, 434, 397, 492, 461, 387, 276, 259), Mie = c(67, 75, 80, 87, 82, 81, 92, 102, 125, 135, 118, 111, 109, 135, 122, 103, 80, 88), Shiga = c(61, 67, 69, 74, 74, 71, 79, 88, 105, 108, 89, 83, 81, 100, 85, 69, 52, 58), Kyoto = c(94, 102, 107, 122, 159, 136, 137, 149, 183, 197, 167, 148, 142, 189, 180, 150, 112, 118), Osaka = c(334, 352, 370, 418, 486, 461, 489, 529, 645, 727, 608, 507, 465, 614, 592, 519, 367, 329), Hyogo = c(212, 230, 242, 267, 267, 247, 279, 317, 392, 430, 367, 334, 324, 410, 377, 313, 234, 244), Nara = c(48, 54, 59, 67, 66, 58, 63, 71, 89, 100, 88, 81, 82, 107, 99, 85, 60, 63), Wakayama = c(33, 37, 39, 45, 36, 37, 44, 48, 61, 67, 60, 60, 61, 77, 69, 59, 47, 54), Tottori = c(22, 24, 25, 27, 22, 23, 28, 32, 37, 37, 33, 35, 39, 46, 38, 30, 27, 36), Shimane = c(26, 28, 29, 32, 25, 27, 32, 37, 43, 43, 38, 42, 46, 58, 48, 39, 37, 49), Okayama = c(75, 81, 84, 93, 97, 90, 99, 107, 130, 136, 112, 108, 114, 142, 133, 106, 86, 104), Hiroshima = c(113, 125, 126, 135, 136, 133, 150, 165, 201, 212, 175, 163, 167, 211, 194, 155, 119, 137), Yamaguchi = c(49, 55, 58, 63, 57, 55, 64, 72, 89, 94, 80, 80, 90, 119, 104, 88, 71, 83), Tokushima = c(26, 28, 29, 33, 29, 30, 36, 41, 48, 50, 45, 46, 52, 64, 53, 43, 37, 46), Kagawa = c(37, 40, 42, 46, 40, 40, 48, 54, 68, 69, 58, 57, 61, 79, 70, 54, 45, 56), Ehime = c(49, 55, 58, 63, 52, 54, 65, 74, 91, 93, 83, 84, 90, 115, 98, 79, 66, 81), Kochi = c(24, 26, 29, 32, 26, 26, 32, 37, 47, 48, 41, 44, 48, 61, 55, 44, 37, 49), Fukuoka = c(218, 229, 226, 241, 275, 251, 285, 321, 363, 365, 311, 300, 315, 394, 320, 262, 205, 228), Saga = c(34, 38, 39, 42, 35, 35, 42, 47, 53, 52, 48, 52, 57, 67, 51, 43, 37, 46), Nagasaki = c(53, 57, 60, 63, 51, 54, 64, 72, 83, 87, 82, 89, 98, 117, 90, 77, 66, 79), Kumamoto = c(74, 80, 81, 83, 75, 77, 91, 100, 112, 109, 104, 111, 122, 142, 111, 94, 85, 105), Oita = c(44, 48, 49, 54, 47, 46, 56, 64, 75, 75, 66, 70, 78, 97, 81, 67, 57, 69), Miyazaki = c(45, 50, 50, 51, 41, 42, 52, 61, 70, 67, 62, 69, 78, 92, 72, 60, 54, 64), Kagoshima = c(68, 74, 74, 74, 62, 65, 80, 91, 100, 97, 96, 106, 123, 135, 101, 88, 80, 102), Okinawa = c(82, 84, 81, 81, 72, 76, 88, 93, 104, 102, 89, 90, 93, 97, 60, 56, 48, 52) ) # Calculate PEI for all prefectures # for (i in 1:47) { # print(PEI(PPT2018[, i], CLS=5)) # } print(apply(PPT2018, 2, PEI, CLS=5))
# Prefectural population estimates in 2018 (unit=1000 persons) # total of males and females, by 5 year age-class # (Data source) Download Excel file and extracted # \url{https://www.e-stat.go.jp/stat-search/file-download?statInfId=000031807147&fileKind=0} PPT2018 <- data.frame( Hokkaido = c(175, 195, 207, 229, 235, 232, 266, 304, 367, 381, 344, 341, 354, 452, 368, 310, 252, 274), Aomori = c(41, 45, 51, 58, 48, 48, 59, 69, 82, 86, 83, 88, 94, 112, 89, 75, 67, 69), Iwate = c(41, 47, 52, 57, 47, 50, 59, 69, 81, 82, 78, 84, 91, 106, 82, 74, 67, 75), Miyagi = c(85, 93, 98, 109, 123, 119, 130, 144, 164, 163, 144, 146, 155, 182, 139, 116, 98, 108), Akita = c(28, 33, 37, 40, 30, 33, 42, 51, 61, 62, 59, 69, 78, 93, 72, 63, 61, 69), Yamagata = c(38, 42, 47, 51, 40, 43, 53, 61, 70, 69, 66, 73, 80, 95, 71, 62, 58, 73), Fukushima = c(67, 70, 79, 89, 73, 80, 94, 105, 122, 124, 117, 129, 139, 160, 119, 102, 89, 106), Ibaraki = c(106, 117, 127, 140, 132, 130, 152, 172, 204, 216, 185, 176, 190, 233, 196, 162, 116, 125), Tochigi = c(73, 80, 87, 92, 83, 90, 107, 122, 142, 146, 125, 121, 131, 157, 127, 101, 76, 84), Gumma = c(70, 79, 87, 97, 90, 88, 99, 113, 139, 148, 127, 117, 124, 153, 135, 110, 82, 94), Saitama = c(279, 299, 312, 343, 405, 381, 407, 458, 552, 608, 508, 428, 415, 524, 488, 411, 275, 235), Chiba = c(233, 251, 264, 289, 323, 310, 344, 387, 465, 513, 428, 367, 361, 460, 430, 358, 248, 225), Tokyo = c(539, 516, 495, 554, 867, 911, 961, 1013, 1109, 1167, 1005, 810, 687, 797, 750, 647, 500, 494), Kanagawa = c(351, 374, 385, 423, 518, 490, 529, 592, 706, 788, 679, 551, 486, 599, 558, 479, 343, 326), Niigata = c(78, 88, 94, 103, 92, 94, 111, 127, 152, 154, 141, 141, 155, 190, 151, 129, 111, 135), Toyama = c(37, 40, 45, 50, 44, 44, 50, 58, 75, 79, 65, 62, 65, 84, 80, 63, 49, 60), Ishikawa = c(44, 48, 51, 57, 57, 53, 58, 65, 82, 86, 71, 68, 70, 86, 80, 63, 47, 58), Fukui = c(30, 33, 36, 39, 33, 34, 39, 43, 52, 54, 48, 49, 50, 62, 50, 43, 36, 44), Yamanashi = c(29, 32, 36, 41, 38, 35, 39, 44, 53, 60, 56, 53, 54, 64, 54, 47, 37, 46), Nagano = c(76, 85, 94, 101, 79, 83, 98, 114, 143, 150, 133, 127, 130, 159, 142, 122, 98, 129), Gifu = c(75, 86, 92, 101, 92, 86, 98, 112, 139, 148, 128, 122, 123, 155, 139, 116, 90, 96), Shizuoka = c(137, 155, 164, 175, 150, 162, 193, 214, 256, 276, 241, 225, 230, 284, 251, 212, 161, 173), Aichi = c(319, 339, 344, 374, 420, 414, 451, 484, 567, 610, 507, 434, 397, 492, 461, 387, 276, 259), Mie = c(67, 75, 80, 87, 82, 81, 92, 102, 125, 135, 118, 111, 109, 135, 122, 103, 80, 88), Shiga = c(61, 67, 69, 74, 74, 71, 79, 88, 105, 108, 89, 83, 81, 100, 85, 69, 52, 58), Kyoto = c(94, 102, 107, 122, 159, 136, 137, 149, 183, 197, 167, 148, 142, 189, 180, 150, 112, 118), Osaka = c(334, 352, 370, 418, 486, 461, 489, 529, 645, 727, 608, 507, 465, 614, 592, 519, 367, 329), Hyogo = c(212, 230, 242, 267, 267, 247, 279, 317, 392, 430, 367, 334, 324, 410, 377, 313, 234, 244), Nara = c(48, 54, 59, 67, 66, 58, 63, 71, 89, 100, 88, 81, 82, 107, 99, 85, 60, 63), Wakayama = c(33, 37, 39, 45, 36, 37, 44, 48, 61, 67, 60, 60, 61, 77, 69, 59, 47, 54), Tottori = c(22, 24, 25, 27, 22, 23, 28, 32, 37, 37, 33, 35, 39, 46, 38, 30, 27, 36), Shimane = c(26, 28, 29, 32, 25, 27, 32, 37, 43, 43, 38, 42, 46, 58, 48, 39, 37, 49), Okayama = c(75, 81, 84, 93, 97, 90, 99, 107, 130, 136, 112, 108, 114, 142, 133, 106, 86, 104), Hiroshima = c(113, 125, 126, 135, 136, 133, 150, 165, 201, 212, 175, 163, 167, 211, 194, 155, 119, 137), Yamaguchi = c(49, 55, 58, 63, 57, 55, 64, 72, 89, 94, 80, 80, 90, 119, 104, 88, 71, 83), Tokushima = c(26, 28, 29, 33, 29, 30, 36, 41, 48, 50, 45, 46, 52, 64, 53, 43, 37, 46), Kagawa = c(37, 40, 42, 46, 40, 40, 48, 54, 68, 69, 58, 57, 61, 79, 70, 54, 45, 56), Ehime = c(49, 55, 58, 63, 52, 54, 65, 74, 91, 93, 83, 84, 90, 115, 98, 79, 66, 81), Kochi = c(24, 26, 29, 32, 26, 26, 32, 37, 47, 48, 41, 44, 48, 61, 55, 44, 37, 49), Fukuoka = c(218, 229, 226, 241, 275, 251, 285, 321, 363, 365, 311, 300, 315, 394, 320, 262, 205, 228), Saga = c(34, 38, 39, 42, 35, 35, 42, 47, 53, 52, 48, 52, 57, 67, 51, 43, 37, 46), Nagasaki = c(53, 57, 60, 63, 51, 54, 64, 72, 83, 87, 82, 89, 98, 117, 90, 77, 66, 79), Kumamoto = c(74, 80, 81, 83, 75, 77, 91, 100, 112, 109, 104, 111, 122, 142, 111, 94, 85, 105), Oita = c(44, 48, 49, 54, 47, 46, 56, 64, 75, 75, 66, 70, 78, 97, 81, 67, 57, 69), Miyazaki = c(45, 50, 50, 51, 41, 42, 52, 61, 70, 67, 62, 69, 78, 92, 72, 60, 54, 64), Kagoshima = c(68, 74, 74, 74, 62, 65, 80, 91, 100, 97, 96, 106, 123, 135, 101, 88, 80, 102), Okinawa = c(82, 84, 81, 81, 72, 76, 88, 93, 104, 102, 89, 90, 93, 97, 60, 56, 48, 52) ) # Calculate PEI for all prefectures # for (i in 1:47) { # print(PEI(PPT2018[, i], CLS=5)) # } print(apply(PPT2018, 2, PEI, CLS=5))
Convert numeric vector into its percentile. For example, 1:5 will become c(0,25,50,75,100).
percentile(dat)
percentile(dat)
dat |
A numeric vector, which will be converted into percentile value. |
A integer vector in [0,100]. Minimum value always becomes 0 and maximum always becomes 100.
Minato Nakazawa [email protected] https://minato.sip21c.org/
percentile(1:5) X <- runif(1000, 10, 20) percentile(X)
percentile(1:5) X <- runif(1000, 10, 20) percentile(X)
The data gives the estimates of life expectancy at birth (e0) for each prefecture in Japan since 1965.
Prefe0
Prefe0
A data frame with 47 observations on 26 variables.
[, 1] |
PNAME |
factor w/47 levels | The name (in roma-ji) for prefectures |
[, 2] |
JCODE |
numeric | Prefecture number defined by Geographical Information Authority of Japan |
[, 3] |
E0M.1965 |
numeric | Life expectancy at birth of each prefecture for males in 1965 |
[, 4] |
E0M.1970 |
numeric | Life expectancy at birth of each prefecture for males in 1970 |
[, 5] |
E0M.1975 |
numeric | Life expectancy at birth of each prefecture for males in 1975 |
[, 6] |
E0M.1980 |
numeric | Life expectancy at birth of each prefecture for males in 1980 |
[, 7] |
E0M.1985 |
numeric | Life expectancy at birth of each prefecture for males in 1985 |
[, 8] |
E0M.1990 |
numeric | Life expectancy at birth of each prefecture for males in 1990 |
[, 9] |
E0M.1995 |
numeric | Life expectancy at birth of each prefecture for males in 1995 |
[,10] |
E0M.2000 |
numeric | Life expectancy at birth of each prefecture for males in 2000 |
[,11] |
E0M.2005 |
numeric | Life expectancy at birth of each prefecture for males in 2005 |
[,12] |
E0M.2010 |
numeric | Life expectancy at birth of each prefecture for males in 2010 |
[,13] |
E0M.2015 |
numeric | Life expectancy at birth of each prefecture for males in 2015 |
[,14] |
E0M.2020 |
numeric | Life expectancy at birth of each prefecture for males in 2020 |
[,15] |
E0F.1965 |
numeric | Life expectancy at birth of each prefecture for females in 1965 |
[,16] |
E0F.1970 |
numeric | Life expectancy at birth of each prefecture for females in 1970 |
[,17] |
E0F.1975 |
numeric | Life expectancy at birth of each prefecture for females in 1975 |
[,18] |
E0F.1980 |
numeric | Life expectancy at birth of each prefecture for females in 1980 |
[,19] |
E0F.1985 |
numeric | Life expectancy at birth of each prefecture for females in 1985 |
[,20] |
E0F.1990 |
numeric | Life expectancy at birth of each prefecture for females in 1990 |
[,21] |
E0F.1995 |
numeric | Life expectancy at birth of each prefecture for females in 1995 |
[,22] |
E0F.2000 |
numeric | Life expectancy at birth of each prefecture for females in 2000 |
[,23] |
E0F.2005 |
numeric | Life expectancy at birth of each prefecture for females in 2005 |
[,24] |
E0F.2010 |
numeric | Life expectancy at birth of each prefecture for females in 2010 |
[,25] |
E0F.2015 |
numeric | Life expectancy at birth of each prefecture for females in 2015 |
[,26] |
E0F.2020 |
numeric | Life expectancy at birth of each prefecture for females in 2020 |
Life expectancy at birth for each prefecture in Japan since 1965.
PNAME
: The name (in roma-ji) for prefectures.
JCODE
: Prefecture number defined by Geographical Information Authority of Japan.
From 1 to 47.
E0[M|F].*
: Life expectancy at birth (e0) of each prefecture for males ([M]) or for females ([F]) in year (*).
https://www.mhlw.go.jp/toukei/saikin/hw/life/tdfk20/dl/tdfk20-08.xls
Ministry of Health, Labor and Welfare of Japan: Vital Statistics with Life Expectancy 2020. https://minato.sip21c.org/demography/how-to-make-pref-charts.html (in Japanese), WHO https://www.who.int/data/gho/data/themes/mortality-and-global-health-estimates
require(fmsb) x <- Prefe0 males <- t(x[, 3:14]) colnames(males) <- x$PNAME females <- t(x[, 15:26]) colnames(females) <- x$PNAME COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red", "lightgrey")) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, 1)) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, 3)) years <- 1965+0:11*5 layout(t(1:2)) matplot(years, males, type="l", col=COL, lwd=LWD, lty=LTY, main="Changes of e0 for males in each prefecture of Japan (Blue: Nagano, Red: Okinawa, Grey: Other)") matplot(years, females, type="l", col=COL, lwd=LWD, lty=LTY, main="Changes of e0 for females in each prefecture of Japan (Blue: Nagano, Red: Okinawa, Grey: Other)")
require(fmsb) x <- Prefe0 males <- t(x[, 3:14]) colnames(males) <- x$PNAME females <- t(x[, 15:26]) colnames(females) <- x$PNAME COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red", "lightgrey")) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, 1)) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, 3)) years <- 1965+0:11*5 layout(t(1:2)) matplot(years, males, type="l", col=COL, lwd=LWD, lty=LTY, main="Changes of e0 for males in each prefecture of Japan (Blue: Nagano, Red: Okinawa, Grey: Other)") matplot(years, females, type="l", col=COL, lwd=LWD, lty=LTY, main="Changes of e0 for females in each prefecture of Japan (Blue: Nagano, Red: Okinawa, Grey: Other)")
The data gives years of life lost by several causes in Japan 2010 for each prefecture. There are several definitions of YLL. For example, WHO's Global Burden of Disease defines the YLL as the number of deaths multiplied by the standard life expectancy at the age at which death occurs, for a given cause, age and sex (WHO). However, Japanese Ministry of Health, Labor and Welfare gives the expected increase of the life expectancy at birth if the mortality due to each cause of death is removed from the age-specific mortality as the measure of YLL, and thus this dataset implements such data derived from the report of regional life tables in Japan (Ministry of Health, Labor and Welfare, 2010).
PrefYLL2010
PrefYLL2010
A data frame with 47 observations on 28 variables.
[, 1] |
PNAME |
factor w/47 levels | The name (in roma-ji) for prefectures |
[, 2] |
JCODE |
numeric | Prefecture number defined by Geographical Information Authority of Japan |
[, 3] |
CancerM |
numeric | Years of Life Lost (YLL) of males by cancer |
[, 4] |
CardioM |
numeric | Years of Life Lost (YLL) of males by heart diseases except for hypertention |
[, 5] |
CerebroM |
numeric | Years of Life Lost (YLL) of males by cerebrovascular disease |
[, 6] |
Top3M |
numeric | Years of Life Lost (YLL) of males by cancer, heart disease or cerebrovascular disease |
[, 7] |
PneumoniaM |
numeric | Years of Life Lost (YLL) of males by pneumonia |
[, 8] |
AccidentM |
numeric | Years of Life Lost (YLL) of males by accident |
[, 9] |
TrafficM |
numeric | Years of Life Lost (YLL) of males by traffic accidents |
[,10] |
SuicideM |
numeric | Years of Life Lost (YLL) of males by suicide |
[,11] |
KidneyM |
numeric | Years of Life Lost (YLL) of males by kidney failure |
[,12] |
LiverM |
numeric | Years of Life Lost (YLL) of males by liver disease |
[,13] |
DiabetesM |
numeric | Years of Life Lost (YLL) of males by diabetes |
[,14] |
HypertensM |
numeric | Years of Life Lost (YLL) of males by hypertension |
[,15] |
Covid19M |
numeric | Years of Life Lost (YLL) of males by tuberculosis |
[,16] |
CancerF |
numeric | Years of Life Lost (YLL) of females by cancer |
[,17] |
CardioF |
numeric | Years of Life Lost (YLL) of females by heart diseases except for hypertention |
[,18] |
CerebroF |
numeric | Years of Life Lost (YLL) of females by cerebrovascular disease |
[,19] |
Top3F |
numeric | Years of Life Lost (YLL) of females by cancer, heart disease or cerebrovascular disease |
[,20] |
PneumoniaF |
numeric | Years of Life Lost (YLL) of females by pneumonia |
[,21] |
AccidentF |
numeric | Years of Life Lost (YLL) of females by accident |
[,22] |
TrafficF |
numeric | Years of Life Lost (YLL) of females by traffic accidents |
[,23] |
SuicideF |
numeric | Years of Life Lost (YLL) of females by suicide |
[,24] |
KidneyF |
numeric | Years of Life Lost (YLL) of females by kidney failure |
[,25] |
LiverF |
numeric | Years of Life Lost (YLL) of females by liver disease |
[,26] |
DiabetesF |
numeric | Years of Life Lost (YLL) of females by diabetes |
[,27] |
HypertensF |
numeric | Years of Life Lost (YLL) of females by hypertension |
[,28] |
Covid19F |
numeric | Years of Life Lost (YLL) of females by tuberculosis |
Years of Life Lost by several causes in Japan 2010 for each prefecture.
PNAME
: The name (in roma-ji) for prefectures.
JCODE
: Prefecture number defined by Geographical Information Authority of Japan.
From 1 to 47.
Cancer[M|F]
: YLL by cancer for males ([M]) or for females ([F]).
Cardio[M|F]
: YLL by heart disease for males ([M]) or for females ([F]).
Cerebro[M|F]
: YLL by cerebrovascular disease for males ([M]) or for females ([F]).
Top3[M|F]
: YLL by above 3 major diseases for males ([M]) or for females ([F]).
Peumonia[M|F]
: YLL by pneumonia for males ([M]) or for females ([F]).
Accident[M|F]
: YLL by accidents for males ([M]) or for females ([F]).
Traffic[M|F]
: YLL by traffic accidents (it's also included in Accident[M|F]
for males ([M]) or for females ([F]).
Suicide[M|F]
: YLL by suicide for males ([M]) or for females ([F]).
Kidney[M|F]
: YLL by kidney failure for males ([M]) or for females ([F]).
Liver[M|F]
: YLL by liver disease for males ([M]) or for females ([F]).
Diabetes[M|F]
: YLL by diabates for males ([M]) or for females ([F]).
Hypertension[M|F]
: YLL by hypertension for males ([M]) or for females ([F]).
TB[M|F]
: YLL by tuberculosis for males ([M]) or for females ([F]).
https://www.mhlw.go.jp/toukei/saikin/hw/life/tdfk10/dl/zuhyou.xls
Ministry of Health, Labor and Welfare of Japan: Vital Statistics with Life Expectancy 2010. https://minato.sip21c.org/demography/how-to-make-pref-charts.html (in Japanese), WHO https://www.who.int/data/gho/data/themes/mortality-and-global-health-estimates
require(fmsb) x <- PrefYLL2010 COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red", ifelse(x$PNAME=="Shiga", "green", "lightgrey"))) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, ifelse(x$PNAME=="Shiga", 2, 1))) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, ifelse(x$PNAME=="Shiga", 1, 3))) VX <- c("Cancer","Heart\n Disease","Cerebrovascular\n Disease","Top3","Pneumonia", "Accident","(Traffic\n Accident)","Suicide","Kidney\n Failure","Liver\n Disease", "Diabetes","Hypertension","Tuberculosis") males <- x[,3:15] females <- x[,16:28] layout(t(1:2)) radarchart(males, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLLs in males (2010)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)") radarchart(females, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLL in females (2010)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)")
require(fmsb) x <- PrefYLL2010 COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red", ifelse(x$PNAME=="Shiga", "green", "lightgrey"))) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, ifelse(x$PNAME=="Shiga", 2, 1))) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, ifelse(x$PNAME=="Shiga", 1, 3))) VX <- c("Cancer","Heart\n Disease","Cerebrovascular\n Disease","Top3","Pneumonia", "Accident","(Traffic\n Accident)","Suicide","Kidney\n Failure","Liver\n Disease", "Diabetes","Hypertension","Tuberculosis") males <- x[,3:15] females <- x[,16:28] layout(t(1:2)) radarchart(males, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLLs in males (2010)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)") radarchart(females, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLL in females (2010)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)")
The data gives years of life lost by several causes in Japan 2015 for each prefecture. There are several definitions of YLL. For example, WHO's Global Burden of Disease defines the YLL as the number of deaths multiplied by the standard life expectancy at the age at which death occurs, for a given cause, age and sex (WHO). However, Japanese Ministry of Health, Labor and Welfare gives the expected increase of the life expectancy at birth if the mortality due to each cause of death is removed from the age-specific mortality as the measure of YLL, and thus this dataset implements such data derived from the report of regional life tables in Japan (Ministry of Health, Labor and Welfare, 2015).
PrefYLL2015
PrefYLL2015
A data frame with 47 observations on 26 variables.
[, 1] |
PNAME |
factor w/47 levels | The name (in roma-ji) for prefectures |
[, 2] |
JCODE |
numeric | Prefecture number defined by Geographical Information Authority of Japan |
[, 3] |
CancerM |
numeric | Years of Life Lost (YLL) of males by cancer |
[, 4] |
CardioM |
numeric | Years of Life Lost (YLL) of males by heart diseases except for hypertention |
[, 5] |
CerebroM |
numeric | Years of Life Lost (YLL) of males by cerebrovascular disease |
[, 6] |
PneumoniaM |
numeric | Years of Life Lost (YLL) of males by pneumonia |
[, 7] |
AccidentM |
numeric | Years of Life Lost (YLL) of males by accident |
[, 8] |
TrafficM |
numeric | Years of Life Lost (YLL) of males by traffic accidents |
[, 9] |
SuicideM |
numeric | Years of Life Lost (YLL) of males by suicide |
[,10] |
KidneyM |
numeric | Years of Life Lost (YLL) of males by kidney failure |
[,11] |
LiverM |
numeric | Years of Life Lost (YLL) of males by liver disease |
[,12] |
DiabetesM |
numeric | Years of Life Lost (YLL) of males by diabetes |
[,13] |
HypertensM |
numeric | Years of Life Lost (YLL) of males by hypertension |
[,14] |
TBM |
numeric | Years of Life Lost (YLL) of males by tuberculosis |
[,15] |
CancerF |
numeric | Years of Life Lost (YLL) of females by cancer |
[,16] |
CardioF |
numeric | Years of Life Lost (YLL) of females by heart diseases except for hypertention |
[,17] |
CerebroF |
numeric | Years of Life Lost (YLL) of females by cerebrovascular disease |
[,18] |
PneumoniaF |
numeric | Years of Life Lost (YLL) of females by pneumonia |
[,19] |
AccidentF |
numeric | Years of Life Lost (YLL) of females by accident |
[,20] |
TrafficF |
numeric | Years of Life Lost (YLL) of females by traffic accidents |
[,21] |
SuicideF |
numeric | Years of Life Lost (YLL) of females by suicide |
[,22] |
KidneyF |
numeric | Years of Life Lost (YLL) of females by kidney failure |
[,23] |
LiverF |
numeric | Years of Life Lost (YLL) of females by liver disease |
[,24] |
DiabetesF |
numeric | Years of Life Lost (YLL) of females by diabetes |
[,25] |
HypertensF |
numeric | Years of Life Lost (YLL) of females by hypertension |
[,26] |
TBF |
numeric | Years of Life Lost (YLL) of females by tuberculosis |
Years of Life Lost by several causes in Japan 2015 for each prefecture.
PNAME
: The name (in roma-ji) for prefectures.
JCODE
: Prefecture number defined by Geographical Information Authority of Japan.
From 1 to 47.
Cancer[M|F]
: YLL by cancer for males ([M]) or for females ([F]).
Cardio[M|F]
: YLL by heart disease for males ([M]) or for females ([F]).
Cerebro[M|F]
: YLL by cerebrovascular disease for males ([M]) or for females ([F]).
Peumonia[M|F]
: YLL by pneumonia for males ([M]) or for females ([F]).
Accident[M|F]
: YLL by accidents for males ([M]) or for females ([F]).
Traffic[M|F]
: YLL by traffic accidents (it's also included in Accident[M|F]
for males ([M]) or for females ([F]).
Suicide[M|F]
: YLL by suicide for males ([M]) or for females ([F]).
Kidney[M|F]
: YLL by kidney failure for males ([M]) or for females ([F]).
Liver[M|F]
: YLL by liver disease for males ([M]) or for females ([F]).
Diabetes[M|F]
: YLL by diabates for males ([M]) or for females ([F]).
Hypertension[M|F]
: YLL by hypertension for males ([M]) or for females ([F]).
TB[M|F]
: YLL by tuberculosis for males ([M]) or for females ([F]).
https://www.mhlw.go.jp/toukei/saikin/hw/life/tdfk15/dl/tdfk15-09.xls
Ministry of Health, Labor and Welfare of Japan: Vital Statistics with Life Expectancy 2015. https://minato.sip21c.org/demography/how-to-make-pref-charts.html (in Japanese), WHO https://www.who.int/data/gho/data/themes/mortality-and-global-health-estimates
require(fmsb) x <- PrefYLL2015 COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "pink", ifelse(x$PNAME=="Shiga", "green", "lightgrey"))) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, ifelse(x$PNAME=="Shiga", 2, 1))) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, ifelse(x$PNAME=="Shiga", 1, 3))) VX <- c("Cancer","Heart\n Disease","Cerebrovascular\n Disease","Pneumonia", "Accident","(Traffic\n Accident)","Suicide","Kidney\n Failure","Liver\n Disease", "Diabetes","Hypertension","Tuberculosis") males <- x[,3:14] females <- x[,15:26] layout(t(1:2)) radarchart(males, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLLs in males (2015)\n (Blue: Nagano, Green: Shiga,\n Pink: Okinawa, Gray: Others)") radarchart(females, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLL in females (2015)\n (Blue: Nagano, Green: Shiga,\n Pink: Okinawa, Gray: Others)")
require(fmsb) x <- PrefYLL2015 COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "pink", ifelse(x$PNAME=="Shiga", "green", "lightgrey"))) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, ifelse(x$PNAME=="Shiga", 2, 1))) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, ifelse(x$PNAME=="Shiga", 1, 3))) VX <- c("Cancer","Heart\n Disease","Cerebrovascular\n Disease","Pneumonia", "Accident","(Traffic\n Accident)","Suicide","Kidney\n Failure","Liver\n Disease", "Diabetes","Hypertension","Tuberculosis") males <- x[,3:14] females <- x[,15:26] layout(t(1:2)) radarchart(males, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLLs in males (2015)\n (Blue: Nagano, Green: Shiga,\n Pink: Okinawa, Gray: Others)") radarchart(females, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLL in females (2015)\n (Blue: Nagano, Green: Shiga,\n Pink: Okinawa, Gray: Others)")
The data gives years of life lost by several causes in Japan 2020 for each prefecture. There are several definitions of YLL. For example, WHO's Global Burden of Disease defines the YLL as the number of deaths multiplied by the standard life expectancy at the age at which death occurs, for a given cause, age and sex (WHO). However, Japanese Ministry of Health, Labor and Welfare gives the expected increase of the life expectancy at birth if the mortality due to each cause of death is removed from the age-specific mortality as the measure of YLL, and thus this dataset implements such data derived from the report of regional life tables in Japan (Ministry of Health, Labor and Welfare, 2020). Until 2015, deaths caused by tuberculosis were analyzed, but in 2020, deaths caused by COVID-19 are calculated instead.
PrefYLL2020
PrefYLL2020
A data frame with 47 observations on 28 variables.
[, 1] |
PNAME |
factor w/47 levels | The name (in roma-ji) for prefectures |
[, 2] |
JCODE |
numeric | Prefecture number defined by Geographical Information Authority of Japan |
[, 3] |
CancerM |
numeric | Years of Life Lost (YLL) of males by cancer |
[, 4] |
CardioM |
numeric | Years of Life Lost (YLL) of males by heart diseases except for hypertention |
[, 5] |
CerebroM |
numeric | Years of Life Lost (YLL) of males by cerebrovascular disease |
[, 6] |
Top3M |
numeric | Years of Life Lost (YLL) of males by cancer, heart disease or cerebrovascular disease |
[, 7] |
PneumoniaM |
numeric | Years of Life Lost (YLL) of males by pneumonia |
[, 8] |
AccidentM |
numeric | Years of Life Lost (YLL) of males by accident |
[, 9] |
TrafficM |
numeric | Years of Life Lost (YLL) of males by traffic accidents |
[,10] |
SuicideM |
numeric | Years of Life Lost (YLL) of males by suicide |
[,11] |
KidneyM |
numeric | Years of Life Lost (YLL) of males by kidney failure |
[,12] |
LiverM |
numeric | Years of Life Lost (YLL) of males by liver disease |
[,13] |
DiabetesM |
numeric | Years of Life Lost (YLL) of males by diabetes |
[,14] |
HypertensM |
numeric | Years of Life Lost (YLL) of males by hypertension |
[,15] |
Covid19M |
numeric | Years of Life Lost (YLL) of males by tuberculosis |
[,16] |
CancerF |
numeric | Years of Life Lost (YLL) of females by cancer |
[,17] |
CardioF |
numeric | Years of Life Lost (YLL) of females by heart diseases except for hypertention |
[,18] |
CerebroF |
numeric | Years of Life Lost (YLL) of females by cerebrovascular disease |
[,19] |
Top3F |
numeric | Years of Life Lost (YLL) of females by cancer, heart disease or cerebrovascular disease |
[,20] |
PneumoniaF |
numeric | Years of Life Lost (YLL) of females by pneumonia |
[,21] |
AccidentF |
numeric | Years of Life Lost (YLL) of females by accident |
[,22] |
TrafficF |
numeric | Years of Life Lost (YLL) of females by traffic accidents |
[,23] |
SuicideF |
numeric | Years of Life Lost (YLL) of females by suicide |
[,24] |
KidneyF |
numeric | Years of Life Lost (YLL) of females by kidney failure |
[,25] |
LiverF |
numeric | Years of Life Lost (YLL) of females by liver disease |
[,26] |
DiabetesF |
numeric | Years of Life Lost (YLL) of females by diabetes |
[,27] |
HypertensF |
numeric | Years of Life Lost (YLL) of females by hypertension |
[,28] |
Covid19F |
numeric | Years of Life Lost (YLL) of females by tuberculosis |
Years of Life Lost by several causes in Japan 2020 for each prefecture.
PNAME
: The name (in roma-ji) for prefectures.
JCODE
: Prefecture number defined by Geographical Information Authority of Japan.
From 1 to 47.
Cancer[M|F]
: YLL by cancer for males ([M]) or for females ([F]).
Cardio[M|F]
: YLL by heart disease for males ([M]) or for females ([F]).
Cerebro[M|F]
: YLL by cerebrovascular disease for males ([M]) or for females ([F]).
Top3[M|F]
: YLL by above 3 major diseases for males ([M]) or for females ([F]).
Peumonia[M|F]
: YLL by pneumonia for males ([M]) or for females ([F]).
Accident[M|F]
: YLL by accidents for males ([M]) or for females ([F]).
Traffic[M|F]
: YLL by traffic accidents (it's also included in Accident[M|F]
for males ([M]) or for females ([F]).
Suicide[M|F]
: YLL by suicide for males ([M]) or for females ([F]).
Kidney[M|F]
: YLL by kidney failure for males ([M]) or for females ([F]).
Liver[M|F]
: YLL by liver disease for males ([M]) or for females ([F]).
Diabetes[M|F]
: YLL by diabates for males ([M]) or for females ([F]).
Hypertension[M|F]
: YLL by hypertension for males ([M]) or for females ([F]).
Covid19[M|F]
: YLL by COVID-19 for males ([M]) or for females ([F]).
https://www.mhlw.go.jp/toukei/saikin/hw/life/tdfk20/dl/tdfk20-08.xls
Ministry of Health, Labor and Welfare of Japan: Vital Statistics with Life Expectancy 2020. https://minato.sip21c.org/demography/how-to-make-pref-charts.html (in Japanese), WHO https://www.who.int/data/gho/data/themes/mortality-and-global-health-estimates
require(fmsb) x <- PrefYLL2020 COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red", ifelse(x$PNAME=="Shiga", "green", "lightgrey"))) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, ifelse(x$PNAME=="Shiga", 2, 1))) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, ifelse(x$PNAME=="Shiga", 1, 3))) VX <- c("Cancer","Heart\n Disease","Cerebrovascular\n Disease","Top 3 causes","Pneumonia", "Accident","(Traffic\n Accident)","Suicide","Kidney\n Failure","Liver\n Disease", "Diabetes","Hypertension","Tuberculosis") males <- x[,3:15] females <- x[,16:28] layout(t(1:2)) radarchart(males, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLLs in males (2020)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)") radarchart(females, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLL in females (2020)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)")
require(fmsb) x <- PrefYLL2020 COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red", ifelse(x$PNAME=="Shiga", "green", "lightgrey"))) LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, ifelse(x$PNAME=="Shiga", 2, 1))) LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, ifelse(x$PNAME=="Shiga", 1, 3))) VX <- c("Cancer","Heart\n Disease","Cerebrovascular\n Disease","Top 3 causes","Pneumonia", "Accident","(Traffic\n Accident)","Suicide","Kidney\n Failure","Liver\n Disease", "Diabetes","Hypertension","Tuberculosis") males <- x[,3:15] females <- x[,16:28] layout(t(1:2)) radarchart(males, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLLs in males (2020)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)") radarchart(females, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX, title="YLL in females (2020)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)")
Drawing the p-value function (a.k.a. nested confidence intervals) plot of risk ratio (RR) or odds ratio (OR) for a given 2 by 2 cross table, which is strongly recommended by Rothman KJ "Epidemiology: An introduction. 2nd Ed." Oxford Univ. Press.
Until fmsb-0.4.2, the formula to calculate p-values was not appropriate, so that the curve was not correct. Through discussion with Professor Rothman, I realized my mistake, then fixed it in fmsb-0.4.3. The feasible calculation is only possible in the manner of back-calculation from p-values to RR or OR, so that the calculation of p-values is restricted to the given range from 0.0005 to 1.
pvalueplot(XTAB, plot.OR, plot.log, xrange, add, ...)
pvalueplot(XTAB, plot.OR, plot.log, xrange, add, ...)
XTAB |
A 2 by 2 matrix to draw p-value function (in another term, nested confidence intervals). The table should be given as the cross table for the exposure status being column and the health outcome status being row, opposite from usual manner for cross tabulation. To note, usually the numbers of incidence and the total observed numbers for exposed and nonexposed population as risk data, but in this function, the numbers of incidence and the remaining numbers without disease should be given as rows. |
plot.OR |
Logical. If you want to draw the p-value function for the odds ratio, it should be set at TRUE, otherwise the p-value function for the risk ratio is drawn. Default FALSE. |
xrange |
A numeric vector includes 2 elements for minimum and maximum of x axis. Default is c(0.01, 5). |
plot.log |
Logical. If TRUE, the horizontal axis becomes logarythmic scale. Default FALSE. |
add |
Logical. If TRUE, the line is overlayed on the existing pvalueplot, otherwise the graph is newly plotted. Default FALSE. |
... |
Other options handed down to plot() or lines(). pch, lty or col may be useful. |
The data.frame containing the set of p-values (ranging from 0.0005 to 1) and corresponding RR or OR is returned.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
pvalueplot(matrix(c(321, 411, 686-321, 689-411), 2, 2), xrange=c(0.7, 0.9)) pvalueplot(matrix(c(4, 386, 4, 1250), 2, 2), xrange=c(0.1, 20), plot.log=TRUE) pvalueplot(matrix(c(468, 480, 229, 205), 2, 2), plot.OR=TRUE, xrange=c(0.7, 1.0))
pvalueplot(matrix(c(321, 411, 686-321, 689-411), 2, 2), xrange=c(0.7, 0.9)) pvalueplot(matrix(c(4, 386, 4, 1250), 2, 2), xrange=c(0.1, 20), plot.log=TRUE) pvalueplot(matrix(c(468, 480, 229, 205), 2, 2), plot.OR=TRUE, xrange=c(0.7, 1.0))
Drawing the p-value function (a.k.a. nested confidence intervals) plot of pooled odds ratios (pORs) for several 2 by 2 crosstables, which are stratified by a confounding variable or pooled for several studies, with Mantel-Haenszel's method.
pvpORMH(XTAB, xrange, add, ...)
pvpORMH(XTAB, xrange, add, ...)
XTAB |
A matrix with 4 columns. The first column is the number of exposed cases. The second column is the number of unexposed cases. The third column is the number of exposed controls. The forth column is the number of unexposed controls. Rows should be composed of different strata or studies. |
xrange |
A numeric vector includes 2 elements for minimum and maximum of x axis. Default is c(0.6, 1.2). |
add |
Logical. If TRUE, the line is overlayed on the existing pvalueplot, otherwise the graph is newly plotted. Default FALSE. |
... |
Other options handed down to plot() or lines(). pch, lty or col may be useful. |
A data.frame containing the set of p-values (ranging from 0.0005 to 1) and corresponding pORs are returned.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
TenStudies <- matrix( c(215, 229, 311-215, 306-229, 38, 33, 59-38, 51-33, 161, 174, 293-161, 293-174, 76, 88, 164-76, 163-88, 103, 105, 129-103, 133-105, 65, 67, 120-65, 125-67, 81, 75, 113-81, 110-75, 48, 63, 160-48, 159-63, 22, 21, 60-22, 62-21, 56, 51, 137-56, 140-51 ), 10, 4, byrow=TRUE) ElevenStudies <- rbind(TenStudies, c(468, 480, 229, 205)) # Figure 8-4 in Chapter 8 of Rothman's textbook. pvpORMH(TenStudies) pvpORMH(ElevenStudies, add=TRUE, lty=2) segments(1, 0, 1, 1, lwd=2)
TenStudies <- matrix( c(215, 229, 311-215, 306-229, 38, 33, 59-38, 51-33, 161, 174, 293-161, 293-174, 76, 88, 164-76, 163-88, 103, 105, 129-103, 133-105, 65, 67, 120-65, 125-67, 81, 75, 113-81, 110-75, 48, 63, 160-48, 159-63, 22, 21, 60-22, 62-21, 56, 51, 137-56, 140-51 ), 10, 4, byrow=TRUE) ElevenStudies <- rbind(TenStudies, c(468, 480, 229, 205)) # Figure 8-4 in Chapter 8 of Rothman's textbook. pvpORMH(TenStudies) pvpORMH(ElevenStudies, add=TRUE, lty=2) segments(1, 0, 1, 1, lwd=2)
Drawing the radar chart with several lines from a data frame, which must be composed of more than 3 variables as axes and the rows indicate cases as series. The radatchart() uses the polygons as radar grid, radarchartcirc() uses circles as radar grid.
radarchart(df, axistype, seg, pty, pcol, plty, plwd, pdensity, pangle, pfcol, cglty, cglwd, cglcol, axislabcol, title, maxmin, na.itp, centerzero, vlabels, vlcex, caxislabels, calcex, paxislabels, palcex, ...) radarchartcirc(df, axistype, seg, pty, pcol, plty, plwd, pdensity, pangle, pfcol, cglty, cglwd, cglcol, axislabcol, title, maxmin, na.itp, centerzero, vlabels, vlcex, caxislabels, calcex, paxislabels, palcex, ...)
radarchart(df, axistype, seg, pty, pcol, plty, plwd, pdensity, pangle, pfcol, cglty, cglwd, cglcol, axislabcol, title, maxmin, na.itp, centerzero, vlabels, vlcex, caxislabels, calcex, paxislabels, palcex, ...) radarchartcirc(df, axistype, seg, pty, pcol, plty, plwd, pdensity, pangle, pfcol, cglty, cglwd, cglcol, axislabcol, title, maxmin, na.itp, centerzero, vlabels, vlcex, caxislabels, calcex, paxislabels, palcex, ...)
df |
The data frame to be used to draw radarchart. If maxmin is TRUE, this must include maximum values as row 1 and minimum values as row 2 for each variables, and actual data should be given as row 3 and lower rows. The number of columns (variables) must be more than 2. |
axistype |
The type of axes, specified by any of 0:5. 0 means no axis label. 1 means center axis label only. 2 means around-the-chart label only. 3 means both center and around-the-chart (peripheral) labels. 4 is *.** format of 1, 5 is *.** format of 3. Default is 0. |
seg |
The number of segments for each axis (default 4). |
pty |
A vector to specify point symbol: Default 16 (closed circle), if you don't plot data points, it should be 32. This is repeatedly used for data series. |
pcol |
A vector of color codes for plot data: Default 1:8, which are repeatedly used. |
plty |
A vector of line types for plot data: Default 1:6, which are repeatedly used. |
plwd |
A vector of line widths for plot data: Default 1, which is repeatedly used. |
pdensity |
A vector of filling density of polygons: Default NULL, which is repeatedly used. |
pangle |
A vector of the angles of lines used as filling polygons: Default 45, which is repeatedly used. |
pfcol |
A vector of color codes for filling polygons: Default NA, which is repeatedly usd. |
cglty |
Line type for radar grids: Default 3, dotted line. For radatchartcirc(), default 1, solid line. |
cglwd |
Line width for radar grids: Default 1, which means thinnest line. |
cglcol |
Line color for radar grids: Default "navy" |
axislabcol |
Color of axis label and numbers: Default "blue" |
title |
if any, title should be typed. |
maxmin |
Logical. If true, data frame includes possible maximum values as row 1 and possible minimum values as row 2. If false, the maximum and minimum values for each axis will be calculated as actual maximum and minimum of the data. Default TRUE. |
na.itp |
Logical. If true, items with NA values are interpolated from nearest neighbor items and connect them. If false, items with NA are treated as the origin (but not pointed, only connected with lines). Default FALSE. |
centerzero |
Logical. If true, this function draws charts with scaling originated from (0,0). If false, charts originated from (1/segments). Default FALSE. |
vlabels |
Character vector for the names for variables. If NULL, the names of the variables as colnames(df) are used. Default NULL. |
vlcex |
Font size magnification for vlabels. If NULL, the font size is fixed at text()'s default. Default NULL. |
caxislabels |
Character vector for center axis labels, overwriting values specified in axistype option. If NULL, the values specified by axistype option are used. Default is NULL. |
calcex |
Font size magnification for caxislabels. If NULL, the font size is fixed at text()'s default. Default NULL. |
paxislabels |
Character vector for around-the-chart (peripheral) labels, overwriting values specified in axistype option. If NULL, the values specified by axistype option are used. Default is NULL. |
palcex |
Font size magnification for paxislabels. If NULL, the font size is fixed at text()'s default. Default NULL. |
... |
Miscellaneous arguments to be given for plot.default(). |
No value is returned.
Minato Nakazawa [email protected] https://minato.sip21c.org/
# Data must be given as the data frame, where the first cases show maximum. maxmin <- data.frame( total=c(5, 1), phys=c(15, 3), psycho=c(3, 0), social=c(5, 1), env=c(5, 1)) # data for radarchart function version 1 series, minimum value must be omitted from above. RNGkind("Mersenne-Twister") set.seed(123) dat <- data.frame( total=runif(3, 1, 5), phys=rnorm(3, 10, 2), psycho=c(0.5, NA, 3), social=runif(3, 1, 5), env=c(5, 2.5, 4)) dat <- rbind(maxmin, dat) VARNAMES <- c("Total\nQOL", "Physical\naspects", "Phychological\naspects", "Social\naspects", "Environmental\naspects") op <- par(mar=c(1, 2, 2, 1), mfrow=c(2, 3)) radarchart(dat, axistype=1, seg=5, plty=1, vlabels=VARNAMES, title="(axis=1, 5 segments, with specified vlabels)", vlcex=0.5) radarchart(dat, axistype=2, pcol=topo.colors(3), plty=1, pdensity=c(5, 10, 30), pangle=c(10, 45, 120), pfcol=topo.colors(3), title="(topo.colors, fill with hatching, axis=2)") radarchart(dat, axistype=2, pcol=topo.colors(3), plty=1, pfcol=adjustcolor(topo.colors(3), 0.3), title="(topo.colors, fill with transparency, axis=2)") radarchart(dat, axistype=3, pty=32, plty=1, axislabcol="grey", na.itp=FALSE, title="(no points, axis=3, na.itp=FALSE)") radarchartcirc(dat, axistype=3, pty=32, plty=1, axislabcol="grey", na.itp=FALSE, title="(no points, axis=3, na.itp=FALSE, circular radar grid)") radarchart(dat, axistype=1, plwd=1:5, pcol=1, centerzero=TRUE, seg=4, caxislabels=c("worst", "", "", "", "best"), title="(use lty and lwd but b/w, axis=1,\n centerzero=TRUE, with centerlabels)") par(op)
# Data must be given as the data frame, where the first cases show maximum. maxmin <- data.frame( total=c(5, 1), phys=c(15, 3), psycho=c(3, 0), social=c(5, 1), env=c(5, 1)) # data for radarchart function version 1 series, minimum value must be omitted from above. RNGkind("Mersenne-Twister") set.seed(123) dat <- data.frame( total=runif(3, 1, 5), phys=rnorm(3, 10, 2), psycho=c(0.5, NA, 3), social=runif(3, 1, 5), env=c(5, 2.5, 4)) dat <- rbind(maxmin, dat) VARNAMES <- c("Total\nQOL", "Physical\naspects", "Phychological\naspects", "Social\naspects", "Environmental\naspects") op <- par(mar=c(1, 2, 2, 1), mfrow=c(2, 3)) radarchart(dat, axistype=1, seg=5, plty=1, vlabels=VARNAMES, title="(axis=1, 5 segments, with specified vlabels)", vlcex=0.5) radarchart(dat, axistype=2, pcol=topo.colors(3), plty=1, pdensity=c(5, 10, 30), pangle=c(10, 45, 120), pfcol=topo.colors(3), title="(topo.colors, fill with hatching, axis=2)") radarchart(dat, axistype=2, pcol=topo.colors(3), plty=1, pfcol=adjustcolor(topo.colors(3), 0.3), title="(topo.colors, fill with transparency, axis=2)") radarchart(dat, axistype=3, pty=32, plty=1, axislabcol="grey", na.itp=FALSE, title="(no points, axis=3, na.itp=FALSE)") radarchartcirc(dat, axistype=3, pty=32, plty=1, axislabcol="grey", na.itp=FALSE, title="(no points, axis=3, na.itp=FALSE, circular radar grid)") radarchart(dat, axistype=1, plwd=1:5, pcol=1, centerzero=TRUE, seg=4, caxislabels=c("worst", "", "", "", "best"), title="(use lty and lwd but b/w, axis=1,\n centerzero=TRUE, with centerlabels)") par(op)
Calculate incidence rate difference (a kind of attributable risk / excess risk) and its confidence intervals based on approximation, followed by null hypothesis (incidence rate difference equals to 0) testing.
ratedifference(a, b, PT1, PT0, CRC=FALSE, conf.level=0.95)
ratedifference(a, b, PT1, PT0, CRC=FALSE, conf.level=0.95)
a |
The number of disease occurence among exposed cohort. |
b |
The number of disease occurence among non-exposed cohort. |
PT1 |
The observed person-time of the exposed cohort. |
PT0 |
The observed person-time of the unexposed cohort. |
CRC |
Logical. If TRUE, calculate confidence intervals for each incidence rate. Default is FALSE. |
conf.level |
Probability for confidence intervals. Default is 0.95. |
estimate |
Calculated point estimate of incidence rate difference. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
p.value |
The significant probability of the result of null-hypothesis testing. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
res <- ratedifference(136, 1709, 22050, 127650, CRC=TRUE) str(res) print(res)
res <- ratedifference(136, 1709, 22050, 127650, CRC=TRUE) str(res) print(res)
Calculate incidence rate ratio (a kind of relative risk) and its confidence intervals based on approximation, followed by null hypothesis (incidence rate ratio equals to 1) testing.
rateratio(a, b, PT1, PT0, conf.level=0.95)
rateratio(a, b, PT1, PT0, conf.level=0.95)
a |
The number of disease occurence among exposed cohort. |
b |
The number of disease occurence among non-exposed cohort. |
PT1 |
The observed person-time of the exposed cohort. |
PT0 |
The observed person-time of the unexposed cohort. |
conf.level |
Probability for confidence intervals. Default is 0.95. |
estimate |
Calculated point estimate of incidence rate ratio. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
p.value |
The significant probability of the result of null-hypothesis testing. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
res <- rateratio(136, 1709, 22050, 127650) str(res) print(res)
res <- rateratio(136, 1709, 22050, 127650) str(res) print(res)
Calculate risk and its confidence interval by the simple asymptotic method.
RCI(a, N, conf.level=0.9)
RCI(a, N, conf.level=0.9)
a |
Number of cases |
N |
Number of population at risk |
conf.level |
Probability for confidence intervals. Default is 0.9. |
R |
Point estimate of risk. |
RL |
Lower limit of confidence interval |
RU |
Upper limit of confidence interval |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
# By simple asymptotic method RCI(20, 100) # By Wilson Score (without continuity correction) prop.test(20, 100, conf.level=0.9, correct=FALSE) # By Exact method binom.test(20, 100, conf.level=0.9)
# By simple asymptotic method RCI(20, 100) # By Wilson Score (without continuity correction) prop.test(20, 100, conf.level=0.9, correct=FALSE) # By Exact method binom.test(20, 100, conf.level=0.9)
Calculate pooled risk difference and its confidence intervals with Mantel-Haenszel's method.
RDMH(XTAB, conf.level=0.9)
RDMH(XTAB, conf.level=0.9)
XTAB |
A matrix with 4 columns. The first column is the number of disease occurrence in exposed cohort. The second column is the number of disease occurrence in unexposed cohort. The third column is the total number of exposed cohort. The forth column is the total number of unexposed cohort. Rows should be composed of different strata or studies. |
conf.level |
Probability for confidence intervals. Default is 0.9. |
estimate |
Calculated point estimate of pooled risk difference with Manterl-Haenszel's method. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
conf.level |
Simply return the value of given conf.level. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
# Table 10-3 of Rothman's textbook (Chapter 10). RDMH(matrix(c(8, 5, 106, 120, 22, 16, 98, 85), 2, 4, byrow=TRUE), conf.level=0.9)
# Table 10-3 of Rothman's textbook (Chapter 10). RDMH(matrix(c(8, 5, 106, 120, 22, 16, 98, 85), 2, 4, byrow=TRUE), conf.level=0.9)
Calculate risk difference (a kind of attributable risk / excess risk) and its confidence intervals based on approximation, followed by null hypothesis (risk difference equals to 0) testing.
riskdifference(a, b, N1, N0, CRC=FALSE, conf.level=0.95)
riskdifference(a, b, N1, N0, CRC=FALSE, conf.level=0.95)
a |
The number of disease occurence among exposed cohort. |
b |
The number of disease occurence among non-exposed cohort. |
N1 |
The population at risk of the exposed cohort. |
N0 |
The population at risk of the unexposed cohort. |
CRC |
Logical. If TRUE, calculate confidence intervals for each risk. Default is FALSE. |
conf.level |
Probability for confidence intervals. Default is 0.95. |
estimate |
Calculated point estimate of risk difference. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
p.value |
The significant probability of the result of null-hypothesis testing. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
res <- riskdifference(321, 411, 686, 689, CRC=TRUE) str(res) print(res)
res <- riskdifference(321, 411, 686, 689, CRC=TRUE) str(res) print(res)
Calculate risk ratio (a kind of relative risk) and its confidence intervals based on approximation, followed by null hypothesis (risk ratio equals to 1) testing.
riskratio(X, Y, m1, m2, conf.level=0.95, p.calc.by.independence=TRUE)
riskratio(X, Y, m1, m2, conf.level=0.95, p.calc.by.independence=TRUE)
X |
The number of disease occurence among exposed cohort. |
Y |
The number of disease occurence among non-exposed cohort. |
m1 |
The number of individuals in exposed cohort group. |
m2 |
The number of individuals in non-exposed cohort group. |
conf.level |
Probability for confidence intervals. Default is 0.95. |
p.calc.by.independence |
Logical. If TRUE, calculating p-value by testing the null-hypothesis of independence between exposure and disease. Otherwise, calculating p-value by inverse-function of confidence intervals calculation (the result becomes the same as the vcd package). Default TRUE. |
estimate |
Calculated point estimate of risk ratio. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
p.value |
The significant probability of the result of null-hypothesis testing. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
res <- riskratio(5, 10, 90, 90) str(res) print(res) riskratio(12, 5, 18, 17) riskratio(12, 5, 18, 17, p.calc.by.independence=FALSE)
res <- riskratio(5, 10, 90, 90) str(res) print(res) riskratio(12, 5, 18, 17) riskratio(12, 5, 18, 17, p.calc.by.independence=FALSE)
Calculate Receiver Operating Characteristic (ROC) curve's each performance set of [sensitivity, 1-specificity], each distance of the performance from the worst performance [0, 1], and each piece of area under the curve, for each cutoff point, as list. Fittest cut off is suggested as the set of [sensitivity, 1-specificity] which gives the longest distance from [0, 1] (though it's not common). If option maxdist=FALSE is given, the distances are calculated from the best performance [1, 0] and fittest cut off is the set of [sensitivity, 1-specificity] which gives minimum distance from best performance.
roc(values, iscase, maxdist=TRUE)
roc(values, iscase, maxdist=TRUE)
values |
A numeric vector of measured values. |
iscase |
A logical (or 0/1) vector of diagnostics. Negative result must be given by FALSE or 0. |
maxdist |
A logical value to specify the method of distance calculation to seek the best cutoff. Default TRUE. |
cutoff |
The numeric vector of cutoff points, which are composed of the all unique values among the given measurements and the maximum cutoff is maximum measurement plus 1. Therefore, the minimum cutoff gives [1, 1] and the maximum cutoff gives [0, 0] as the performance set of [sensitivity, 1-specificity], respectively. |
sens |
The numeric vector of sensitivities for all cutoff points. |
falsepos |
The numeric vector of 1-specificities (false positiveness) for all cutoff points. |
distance |
The numeric vector of distance between actual performance set and the worst performance. |
aucpiece |
The numeric vector of the pieces of areas under the curve. |
maxdist |
Same as the given argument maxdist. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
scores <- c(15, 20, 19, 28, 26, 17, 13, 22, 23, 24) diagno <- c(0, 0, 0, 1, 1, 1, 0, 1, 1, 1) res <- roc(scores, diagno) print(res) plot(res)
scores <- c(15, 20, 19, 28, 26, 17, 13, 22, 23, 24) diagno <- c(0, 0, 0, 1, 1, 1, 0, 1, 1, 1) res <- roc(scores, diagno) print(res) plot(res)
Calculate pooled risk ratio and its confidence intervals with Mantel-Haenszel's method.
RRMH(XTAB, conf.level=0.9)
RRMH(XTAB, conf.level=0.9)
XTAB |
A matrix with 4 columns. The first column is the number of disease occurrence in exposed cohort. The second column is the number of disease occurrence in unexposed cohort. The third column is the total number of exposed cohort. The forth column is the total number of unexposed cohort. Rows should be composed of different strata or studies. |
conf.level |
Probability for confidence intervals. Default is 0.9. |
estimate |
Calculated point estimate of pooled risk ratio with Manterl-Haenszel's method. |
conf.int |
A numeric vector of length 2 to give upper/lower limit of confidence intervals. |
conf.level |
Simply return the value of given conf.level. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
# Table 10-3 of Rothman's textbook (Chapter 10). RRMH(matrix(c(8, 5, 106, 120, 22, 16, 98, 85), 2, 4, byrow=TRUE), conf.level=0.9)
# Table 10-3 of Rothman's textbook (Chapter 10). RRMH(matrix(c(8, 5, 106, 120, 22, 16, 98, 85), 2, 4, byrow=TRUE), conf.level=0.9)
The data gives the age-class (by five) specific model population of Japan in Showa 60 (1985) to calculate directly adjusted mortality rate.
S60MPJ
S60MPJ
A vector containing 18 observations.
https://www.mhlw.go.jp/toukei/list/dl/81-1b1.pdf, page 55.
Tamura K. (2008) How do we die?: death date from vital statistics of the Japanese population. The Waseda study of politics and public law, 87: 27-57.
Implementing Siler's model mortality function of qx and fitting the model to actual qx of given lifetable.
Siler(a1, b1, a2, a3, b3, t) fitSiler(initialpar=c(0.01,3,1e-4,1e-5,0.1), data, mode=1, Method="Nelder-Mead", ...)
Siler(a1, b1, a2, a3, b3, t) fitSiler(initialpar=c(0.01,3,1e-4,1e-5,0.1), data, mode=1, Method="Nelder-Mead", ...)
a1 |
The parameter a1 of the Siler model, q(t)=a1*exp(-b1*t)+a2+a3*exp(b3*t). |
b1 |
The parameter b1 of the Siler model, q(t)=a1*exp(-b1*t)+a2+a3*exp(b3*t). |
a2 |
The parameter a2 of the Siler model, q(t)=a1*exp(-b1*t)+a2+a3*exp(b3*t). |
a3 |
The parameter a3 of the Siler model, q(t)=a1*exp(-b1*t)+a2+a3*exp(b3*t). |
b3 |
The parameter b3 of the Siler model, q(t)=a1*exp(-b1*t)+a2+a3*exp(b3*t). |
t |
Age (vector OK) in years |
initialpar |
Initial value for the parameters to be estimated. If not given, c(0.01, 0.0003, 0.07) is used. |
data |
Actual vector of qx in the lifetable to be used to obtain the best-fit parameters of the Gompertz-Makeham model. |
mode |
Which of lifetable functions should be used to calculate the RMSE: 1 qx, 2 dx, otherwise lx. Default is 1. |
Method |
The method to be used in optim() function. Default is "Nelder-Mead". |
... |
Other options to be passed to optim(). |
Siler() returns model qx for the same length with t. fitSiler() returns the numeric vector of fitted parameters a1, b1, a2, a3 and b3, RMSE for those values, and the flag of convergence.
Minato Nakazawa [email protected] https://minato.sip21c.org/
res <- fitSiler(,Jlife$qx2005M) FLAG <- res[7] while (FLAG>0) { res <- fitSiler(res[1:5], Jlife$qx2005M) FLAG <- res[7] } print(res)
res <- fitSiler(,Jlife$qx2005M) FLAG <- res[7] while (FLAG>0) { res <- fitSiler(res[1:5], Jlife$qx2005M) FLAG <- res[7] } print(res)
Calculate semi-interquartile range, using IQR or fivenum.
SIQR(X, mode)
SIQR(X, mode)
X |
a numeric vector. |
mode |
If 1, using fivenum, otherwise using IQR function. Default is 1. |
A numeric vector of length 1, giving the semi-interquartile range.
Minato Nakazawa [email protected] https://minato.sip21c.org/
data <- rnorm(100, 10, 1) SIQR(data) SIQR(data, 2) sd(data) idata <- sample(50:80, 100, replace=TRUE) SIQR(idata) SIQR(idata, 2) sd(idata)
data <- rnorm(100, 10, 1) SIQR(data) SIQR(data, 2) sd(data) idata <- sample(50:80, 100, replace=TRUE) SIQR(idata) SIQR(idata, 2) sd(idata)
Calculate Spearman's rank correlation with its confidence intervals by the same method as SAS. Since fmsb-0.7.3, missing values are excluded pairwisely before calculation.
spearman.ci.sas(x, y, adj.bias=TRUE, conf.level=0.95)
spearman.ci.sas(x, y, adj.bias=TRUE, conf.level=0.95)
x |
A numeric vector. |
y |
A numeric vector. |
adj.bias |
Logical. If TRUE, adjustment for bias is taken. Default TRUE. |
conf.level |
Probability for confidence intervals. Default is 0.95. |
rho |
Calculated point estimate of Spearman's rank correlation coefficient. |
rho.ll |
The lower limit of given confidence intervals. |
rho.ul |
The upper limit of given confidence intervals. |
adj.bias |
The option for bias adjustment taken. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
https://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#corr_toc.htm
data(airquality) spearman.ci.sas(airquality$Ozone, airquality$Wind)
data(airquality) spearman.ci.sas(airquality$Ozone, airquality$Wind)
Usually median for data with ties, tied values are treated as exactly same. For example, median of {3, 3, 4, 4, 4} will be 4. However, the measured values are usually rounded, so that we can assume evenly distributed true values for tied values. For example, the previous data can be treated as rounded values of {2.75, 3.25, 11/3, 4, 13/3}. From this viewpoint, true median of {3, 3, 4, 4, 4} could be 11/3 (=3.66...). This function calculates this.
truemedian(X, h)
truemedian(X, h)
X |
A numeric vector. Usually integer. |
h |
Width of measurement unit. Default is 1. |
A numeric vector of length 1, giving "true" median estimate.
Minato Nakazawa [email protected] https://minato.sip21c.org/
Grimm LG (1993) Statistical Applications for the Behavioral Sciences. John Wiley and Sons.
median(c(3, 3, 4, 4, 4)) truemedian(c(3, 3, 4, 4, 4))
median(c(3, 3, 4, 4, 4)) truemedian(c(3, 3, 4, 4, 4))
To evaluate multicolinearity of multiple regression model, calculating the variance inflation factor (VIF) from the result of lm(). If VIF is more than 10, multicolinearity is strongly suggested.
VIF(X)
VIF(X)
X |
The object with class "lm", which would be generated by lm(). |
A variance inflation factor is returned.
Minato Nakazawa [email protected] https://minato.sip21c.org/
# the target multiple regression model res <- lm(Ozone ~ Wind+Temp+Solar.R, data=airquality) summary(res) # checking multicolinearity for independent variables. VIF(lm(Wind ~ Temp+Solar.R, data=airquality)) VIF(lm(Temp ~ Wind+Solar.R, data=airquality)) VIF(lm(Solar.R ~ Wind+Temp, data=airquality))
# the target multiple regression model res <- lm(Ozone ~ Wind+Temp+Solar.R, data=airquality) summary(res) # checking multicolinearity for independent variables. VIF(lm(Wind ~ Temp+Solar.R, data=airquality)) VIF(lm(Temp ~ Wind+Solar.R, data=airquality)) VIF(lm(Solar.R ~ Wind+Temp, data=airquality))
Whipple's Index for age-heaping
WhipplesIndex(X)
WhipplesIndex(X)
X |
The integer vector to give age-specific population from age 0 to more than 63 for each age. |
WI |
The Whipple's Index. |
JUDGE |
Based on Whipple's Index, accuracy of age-reporting is judged. |
Minato Nakazawa [email protected] https://minato.sip21c.org/
Preston SH, Heuveline P, Guillot M (2001) Demography: Measuring and Modeling Population Processes. Blackwell Publishing, Oxford.
Newell C (1988) Methods and Models in Demography. The Guilford Press, New York.
Rowland DT (2003) Demographic methods and concepts. Oxford Univ. Press, Oxford.
Ministry of Home Affairs, India (2011) 2011 Census C-13. https://censusindia.gov.in/nada/index.php/catalog/22542/download/25673/PC01_C13_00.xls
WhipplesIndex(Jpop$M2000) # India <- read.delim("https://minato.sip21c.org/ldaR/India2011census.txt") # CRAN requires the example code can work without internet connection # since 2024, and thus I modified the code to include the data here. India <- data.frame( Males = c(10633298, 11381468, 11952853, 12331431, 12333024, 13725480, 13394700, 12903364, 14061937, 12214985, 16089436, 12962604, 14637892, 12563775, 13165128, 13739746, 13027935, 11349449, 15020851, 10844415, 14892165, 10532278, 12392976, 9674189, 10093085, 14311524, 10315030, 8552032, 10719926, 7445696, 15628996, 7157502, 8801105, 6108879, 6964192, 15036666, 8067568, 5784879, 8090401, 5939867, 15173411, 6172297, 6856826, 4468914, 4873938, 12685175, 5735540, 4043122, 5568554, 4105723, 11379329, 4323584, 4068700, 2808043, 3263610, 7769352, 3666804, 2339391, 3072508, 2607957, 8677046, 3095448, 2892015, 1977207, 2060033, 6275854, 2278670, 1353711, 1640034, 1396057, 5393714, 1584873, 1176727, 708381, 787804, 2278704, 832251, 438394, 506957, 434297, 1725200, 491522, 306378, 192946, 210994, 580527, 215850, 112348, 112374, 99007, 360237, 118606, 75430, 46220, 51972, 124950, 57894, 35238, 48393, 28284, 289325), Females = c(9677936, 10373729, 11103415, 11642610, 11377014, 12328750, 12259545, 11923276, 12906436, 11209653, 14462671, 11778342, 13239415, 11716908, 12093041, 12159708, 11564358, 9868018, 12937296, 10014673, 13990570, 9446694, 11135249, 9479866, 9787150, 13456554, 9761967, 8157318, 11407090, 7286828, 14770033, 6665743, 8812439, 6655662, 7030400, 13385965, 7760149, 5907352, 9381357, 5786480, 13355581, 5395597, 6523816, 4865438, 4752294, 11187786, 5257138, 3908175, 6081038, 3746076, 10083093, 3562382, 3666464, 2782747, 3131302, 7838194, 3405033, 2259635, 3646426, 2540755, 9133643, 2931365, 2853128, 2016898, 2026924, 6746498, 2233276, 1251371, 1908339, 1371173, 5592566, 1499310, 1074202, 658155, 733110, 2493642, 834882, 396654, 561458, 455264, 2059738, 536294, 297415, 187239, 212503, 684271, 232048, 109063, 123266, 114413, 472835, 139691, 78131, 48410, 55002, 147584, 62374, 36175, 56118, 36287, 316453), Age = 0:100) WhipplesIndex(India$Males) # To check age-heaping graphically, # you can install and load pyramid package from cran # and pyramid(India, Cstep=5) may be useful.
WhipplesIndex(Jpop$M2000) # India <- read.delim("https://minato.sip21c.org/ldaR/India2011census.txt") # CRAN requires the example code can work without internet connection # since 2024, and thus I modified the code to include the data here. India <- data.frame( Males = c(10633298, 11381468, 11952853, 12331431, 12333024, 13725480, 13394700, 12903364, 14061937, 12214985, 16089436, 12962604, 14637892, 12563775, 13165128, 13739746, 13027935, 11349449, 15020851, 10844415, 14892165, 10532278, 12392976, 9674189, 10093085, 14311524, 10315030, 8552032, 10719926, 7445696, 15628996, 7157502, 8801105, 6108879, 6964192, 15036666, 8067568, 5784879, 8090401, 5939867, 15173411, 6172297, 6856826, 4468914, 4873938, 12685175, 5735540, 4043122, 5568554, 4105723, 11379329, 4323584, 4068700, 2808043, 3263610, 7769352, 3666804, 2339391, 3072508, 2607957, 8677046, 3095448, 2892015, 1977207, 2060033, 6275854, 2278670, 1353711, 1640034, 1396057, 5393714, 1584873, 1176727, 708381, 787804, 2278704, 832251, 438394, 506957, 434297, 1725200, 491522, 306378, 192946, 210994, 580527, 215850, 112348, 112374, 99007, 360237, 118606, 75430, 46220, 51972, 124950, 57894, 35238, 48393, 28284, 289325), Females = c(9677936, 10373729, 11103415, 11642610, 11377014, 12328750, 12259545, 11923276, 12906436, 11209653, 14462671, 11778342, 13239415, 11716908, 12093041, 12159708, 11564358, 9868018, 12937296, 10014673, 13990570, 9446694, 11135249, 9479866, 9787150, 13456554, 9761967, 8157318, 11407090, 7286828, 14770033, 6665743, 8812439, 6655662, 7030400, 13385965, 7760149, 5907352, 9381357, 5786480, 13355581, 5395597, 6523816, 4865438, 4752294, 11187786, 5257138, 3908175, 6081038, 3746076, 10083093, 3562382, 3666464, 2782747, 3131302, 7838194, 3405033, 2259635, 3646426, 2540755, 9133643, 2931365, 2853128, 2016898, 2026924, 6746498, 2233276, 1251371, 1908339, 1371173, 5592566, 1499310, 1074202, 658155, 733110, 2493642, 834882, 396654, 561458, 455264, 2059738, 536294, 297415, 187239, 212503, 684271, 232048, 109063, 123266, 114413, 472835, 139691, 78131, 48410, 55002, 147584, 62374, 36175, 56118, 36287, 316453), Age = 0:100) WhipplesIndex(India$Males) # To check age-heaping graphically, # you can install and load pyramid package from cran # and pyramid(India, Cstep=5) may be useful.