epiforecasts / socialmixr

R package for deriving social mixing matrices from survey data.
http://epiforecasts.io/socialmixr/
Other
38 stars 11 forks source link

symmetric does not give a symmetric matrix #14

Closed cchauve closed 4 years ago

cchauve commented 4 years ago

I tried to process a french survey data but using the symmetric = TRUE option did nt result in a symmetric matrix:

france_survey <- get_survey("http://doi.org/10.5281/zenodo.1158452") Getting France social contact data. Downloading https://zenodo.org/api/files/d419416a-9088-4ae0-a386-b2ccad1442fd/2015_Beraud_France_contact_common.csv Downloading https://zenodo.org/api/files/d419416a-9088-4ae0-a386-b2ccad1442fd/2015_Beraud_France_contact_extra.csv Downloading https://zenodo.org/api/files/d419416a-9088-4ae0-a386-b2ccad1442fd/2015_Beraud_France_hh_common.csv Downloading https://zenodo.org/api/files/d419416a-9088-4ae0-a386-b2ccad1442fd/2015_Beraud_France_hh_extra.csv Downloading https://zenodo.org/api/files/d419416a-9088-4ae0-a386-b2ccad1442fd/2015_Beraud_France_participant_common.csv Downloading https://zenodo.org/api/files/d419416a-9088-4ae0-a386-b2ccad1442fd/2015_Beraud_France_participant_extra.csv Downloading https://zenodo.org/api/files/d419416a-9088-4ae0-a386-b2ccad1442fd/2015_Beraud_France_sday.csv Using France social contact data. To cite this in a publication, use the 'cite' function contact_matrix(france_survey,symmetric=TRUE,age.limits = c(0,18,64)) Using France social contact data. To cite this in a publication, use the 'cite' function Removing participants that have contacts without age information. To change this behaviour, set the 'missing.contact.age' option $matrix contact.age.group [0,18) [18,64) 64+ [1,] 11.936950 8.971462 1.056843 [2,] 3.428956 18.869048 2.775437 [3,] 1.144307 7.862571 4.984375

$demography age.group population proportion year 1: [0,18) 14184155 0.2202668 2015 2: [18,64) 37111183 0.5763023 2015 3: 64+ 13100007 0.2034310 2015

$participants age.group participants proportion 1: [0,18) 682 0.3924051 2: [18,64) 672 0.3866513 3: 64+ 384 0.2209436

Warning messages: 1: In contact_matrix(france_survey, symmetric = TRUE, age.limits = c(0, : No 'year' column found in the data. Will use 2015 population data. 2: In pop_age(survey.pop, age.limits, ...) : Not all age groups represented in population data (5-year age band).

sbfnk commented 4 years ago

It is symmetric in the sense described in the vignette: c_ij N_i = c_ji N_j. I'll update the documentation to make this clearer.