Dear Professors,

I am using YourCast in forecasting disease-specific mortalities in China. The data I input is in following format in .csv format. As showed, there are missings in between observed years.

YourCast works quite well for LC and OLS model. However, when I try model "map" to smooth over age and cities, I met two problem.

year sex2 city2 age r2 time
1987 0 0 10 0.05 0
1988 0 0 10 0.05 1
1989 0 0 10 NA 2
1990 0 0 10 NA 3
1991 0 0 10 0 4
1992 0 0 10 0 5
1993 0 0 10 NA 6
1994 0 0 10 NA 7
1995 0 0 10 NA 8
1996 0 0 10 NA 9
1997 0 0 10 NA 10
1998 0 0 10 NA 11
1999 0 0 10 NA 12
2000 0 0 10 NA 13
2001 0 0 10 NA 14
2002 0 0 10 0 15
2003 0 0 10 0.12 16
2004 0 0 10 0.14 17
2005 0 0 10 0.27 18
2006 0 0 10 0.08 19
2007 0 0 10 0 20
2008 0 0 10 0 21
2009 0 0 10 NA 22
2010 0 0 10 NA 23
2011 0 0 10 0.07 24
2012 0 0 10 NA 25
2013 0 0 10 NA 26
2014 0 0 10 NA 27
2015 0 0 10 NA 28
2016 0 0 10 NA 29
2017 0 0 10 NA 30
2018 0 0 10 NA 31
2019 0 0 10 NA 32
2020 0 0 10 NA 33

1. length of age; the file name is in  csidggggaa.csv format and I have age group 0, 1, 5, 10, 15,20,...,85, and file names are db100100.csv
db100101.csv db100105.csv db100110.csv...etc. (1001 represents cities)

YourCast returns " 'names' attribute [19] must be the same length as the vector [18] " and I guess it maybe related to the name of age group?

> db1<-yourprep(tag="db", year.var=TRUE, index.code="ggggaa",
+ G.names="G.name.txt",sample.frame=c(1987,2011,2012,2030))

Loading cross section files and checking for errors...
...Finished
Total number of cross sections: 76

> db1m<-yourcast(formula=log(r2+0.001)~time+sex2, dataobj=db1, model="map", sample.frame=c
+ (1987,2011,2012,2030))

...
Running MAP model
Preparing for smoothing over age groups
Preparing for smoothing of time trend over age groups
Preparing for smoothing over time
Error in names(whoyg) <- age.char :
  'names' attribute [19] must be the same length as the vector [18]
Data is inconsistent.
Error in m$coeff : $ operator is invalid for atomic vectors


2. A second issue happend after I use only age group 10 to 85 to bypass the 1st problem. Here is what I get

> db1<-yourprep(tag="db", year.var=TRUE, index.code="ggggaa",
+ G.names="G.name.txt",sample.frame=c(1987,2011,2012,2030))

Loading cross section files and checking for errors...
...Finished
Total number of cross sections: 64

> db1m<-yourcast(formula=log(r2+0.001)~time+sex2, dataobj=db1, model="map", sample.frame=c
+ (1987,2011,2012,2030))

...
Running MAP model
Preparing for smoothing over age groups
Preparing for smoothing of time trend over age groups
Preparing for smoothing over time
Choleski for symmetric, positive definite matrix
sample.improper.normal, warning:ranks (chol and code) do not agree
[1] 48 48 32
Error in backsolve(CH, diag(dim)) :
  singular matrix in 'backsolve'. First zero in diagonal [33]
In addition: Warning message:
In chol.default(wmat, pivot = T) :
  the matrix is either rank-deficient or indefinite
Data is inconsistent.
Error in m$coeff : $ operator is invalid for atomic vectors


Thank you so much for your comments!


Weiming Zhu MD. PhD.
China Center for Health Development Studies
Peking University