diff --git a/.Rbuildignore b/.Rbuildignore index 5e7d5da94..9ef089b88 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,4 @@ ^\.github$ ^cran-comments\.md$ ^CODE_OF_CONDUCT.md$ +^README\.Rmd$ diff --git a/README.html b/README.html deleted file mode 100644 index a458f9293..000000000 --- a/README.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - - - - - - -README - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
-

serocalculator package

-
- -

R-CMD-check

-

Antibody levels measured in a (cross–sectional) population sample can -be translated into an estimate of the frequency with which -seroconversions (infections) occur in the sampled population. Formulated -simply: the presence of many high titres indicates that many subjects -likely experienced infection recently, while low titres indicate a low -frequency of infections in the sampled population.

-

The serocalculator script was designed to use the longitudinal -response characteristics by means of a set of parameters characterizing -the longitudinal response of the selected serum antibodies.

-
-

Installation

-

You can install the development version from GitHub with the following code:

-
install.packages("devtools")
-devtools::install_github("ucd-serg/serocalculator")
-

A Note for Windows Users

-

Windows users will need to install Rtools, which contains a -collection of tools for building and employing R packages that are still -in development. This can be done either during the devtools -package installation, or independently if devtools is already -installed.

-
 During devtools installation:
-   When prompted to install additional build tools, select “Yes” and -Rtools will be installed. |
-

!(Click Yes to install Rtools along with the devtools -package)[1.png] |

-
 Independently:
-
    -
  1. Download Rtools from https://cran.r-project.org/bin/windows/Rtools/

  2. -
  3. Run the installer

    -
      -
    • During the Rtools installation you may see a window asking you to -“Select Additional Tasks”.
    • -
    • Do not select the box for “Edit the system PATH”. -devtools and RStudio should put Rtools on the PATH automatically when it -is needed.
    • -
    • Do select the box for “Save version information to -registry”. It should be selected by default. | ## Getting Help
    • -
  4. -
-

If you need assistance or encounter a clear bug, please file an issue -with a minimal reproducible example on GitHub.

-

Another great resource is The Epidemiologist R -Handbook, which includes an introductory page on asking for -help with R packages via GitHub: https://epirhandbook.com/en/getting-help.html

-
-
- - - - -
- - - - - - - - - - - - - - - diff --git a/README.md b/README.md index cc433ed3f..6c924c550 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,17 @@ devtools::install_github("ucd-serg/serocalculator") **A Note for Windows Users** + Windows users will need to install Rtools, which contains a collection of tools for building and employing R packages that are still in development. This can be done either during the *devtools* package installation, or independently if *devtools* is already installed. | *During devtools installation:* -| When prompted to install additional build tools, select "Yes" and Rtools will be installed. | +| When prompted to install additional build tools, select "Yes" and Rtools will be installed. + +![Click Yes to install Rtools along with the *devtools* package][id] + +[id]: vignettes/fig/Rtools1.png -!(Click Yes to install Rtools along with the *devtools* package)[\vignettes\fig\Rtools1.png] | | *Independently:* diff --git a/inst/extdata/dmcmc_hlyeigg_09.30.rds b/inst/extdata/dmcmc_hlyeigg_09.30.rds new file mode 100644 index 000000000..f5e81c2b3 Binary files /dev/null and b/inst/extdata/dmcmc_hlyeigg_09.30.rds differ diff --git a/inst/extdata/simpophlyeigg.2.csv b/inst/extdata/simpophlyeigg.2.csv new file mode 100644 index 000000000..98646db3c --- /dev/null +++ b/inst/extdata/simpophlyeigg.2.csv @@ -0,0 +1,501 @@ +a.smpl,y.smpl,i,t +22.925656523690556,10.088593902118793,1,0 +23.891269684017168,0.676364226928609,1,0 +6.030421345506329,0.39894735506634116,1,0 +19.78965313954046,0.6291083896473504,1,0 +9.090025365254842,11.361959623212012,1,0 +17.271839995146728,8.400308025531567,1,0 +23.76020460242638,12.73540536944525,1,0 +16.131577445436267,93.34860846005688,1,0 +18.248825606592,6.633294392265636,1,0 +20.02410902442876,2.1617888005546675,1,0 +22.04276160324458,60.37184538485429,1,0 +11.77530041304184,12.001584451811286,1,0 +17.03995998216327,0.6938945260296263,1,0 +6.121164712279569,4.233963613759292,1,0 +20.039948704417327,16.047973146955176,1,0 +19.909064539521932,3.0812679340971605,1,0 +7.459994014436379,16.928101556789812,1,0 +22.160140914658548,4.194586386875255,1,0 +9.791304893766064,0.6368506891575065,1,0 +13.446984254992566,4.8537443724778155,1,0 +14.488301769369281,45.0805432516028,1,0 +12.443505510974209,10.39074393421835,1,0 +19.377566600523423,2.44031251330012,1,0 +22.552892745740245,9.022693870924636,1,0 +18.874737458035817,22.50089714510804,1,0 +10.299335390082561,45.265260041465474,1,0 +22.597583144260568,28.506178978386657,1,0 +12.925443836678749,0.2432983362049576,1,0 +19.812708394126965,22.48287688981252,1,0 +20.376554923371877,24.078811305372838,1,0 +12.502184324525295,3.7092441962333464,1,0 +16.589363273622002,147.54302367563838,1,0 +16.838299214928412,5.468988676724285,1,0 +18.322083631439597,1.7698816662347197,1,0 +5.151018497536424,1.577373806944717,1,0 +15.663405665017198,302.3539304517082,1,0 +8.163587960416915,12.042989422310246,1,0 +16.67740189600503,8.994614564266772,1,0 +21.9769491677382,0.7973266193942066,1,0 +19.221291004791855,105.1151625621975,1,0 +18.968324653184972,46.87583970362304,1,0 +11.469961077403276,11.64685373505734,1,0 +12.599604620889295,5.299356105845451,1,0 +14.089045426668598,66.39788962440888,1,0 +12.32726667614188,0.78048833863237,1,0 +14.349719245592132,12.620650211728464,1,0 +12.313053398660848,28.864212059153886,1,0 +13.812819166928529,1.8018253823778414,1,0 +16.33632398937596,0.6697483252755183,1,0 +14.342885438685771,5.396547079129008,1,0 +5.466372019774281,0.48405315208345256,1,0 +6.666789801223203,9.778037202588047,1,0 +7.047081675017252,8.244235712866812,1,0 +19.435125714219176,12.014045455279604,1,0 +6.0828570134425535,0.6897476029364217,1,0 +23.42743480319157,2.404218077004231,1,0 +11.915573624304962,4.025093819142054,1,0 +18.88006895962404,1.559640685515237,1,0 +20.735022200578822,76.14354429813085,1,0 +20.58473121426301,0.772678343908586,1,0 +8.621847524957266,0.36996859673523874,1,0 +17.90235290475888,10.53964892438101,1,0 +5.2068286427948625,182.96948734706822,1,0 +11.838894984212239,6.688269181607881,1,0 +23.918911731389816,13.206977513581062,1,0 +5.391325157887768,4.531435400623727,1,0 +18.21921215321403,8.03545850761315,1,0 +5.467781020649709,0.3374150407014904,1,0 +8.623869550961535,1.05831453311799,1,0 +15.354298397456295,5.178802312327238,1,0 +10.85596624233527,5.6917950193720905,1,0 +24.384879200749563,18.485507430745706,1,0 +18.46492998719681,4.195256908347683,1,0 +20.22289879622869,40.481381623340724,1,0 +21.09293504079105,3.0325646387281218,1,0 +18.025830045714976,13.024445019493193,1,0 +24.042630853254813,10.378212182951446,1,0 +9.704373986455611,3.1979921157602105,1,0 +15.074790220151188,15.371468516292543,1,0 +18.087448826543984,1.389638899152946,1,0 +14.035860353757162,2.368837367763009,1,0 +13.438022048408165,3.7698610795121734,1,0 +22.162947085218036,22.719626770992086,1,0 +6.121171298092231,7.6380132328104136,1,0 +14.024447033365721,6.22709450677378,1,0 +10.05848192576319,9.923907023147821,1,0 +21.237068110750986,13.44321106119088,1,0 +6.456678226229269,3.4869416476920088,1,0 +7.909830124448053,4.27310121061671,1,0 +5.5707812736206685,38.66242330745997,1,0 +13.808646349483169,1.4762901047404906,1,0 +8.689373258464038,14.351922083059774,1,0 +13.544922615117393,18.89270329759982,1,0 +12.378510139777791,3.5877555080772625,1,0 +20.99663786052726,25.573244072698838,1,0 +17.584594657968264,10.711496461247306,1,0 +12.681968483543024,8.342051973686656,1,0 +9.818357168815563,4.02074542519349,1,0 +15.842162744442465,1.6948954453724734,1,0 +12.07122869685525,22.913825679306143,1,0 +15.610617695664986,11.642776667509683,1,0 +18.239543888026382,6.0766180867060715,1,0 +19.798100945285988,16.265964324656988,1,0 +15.758067157475743,9.628034456931486,1,0 +9.88549832344288,52.86328671477575,1,0 +19.461621532314457,8.855103659425987,1,0 +9.411764528683852,14.214318027300225,1,0 +17.20828478526091,3.015135793957903,1,0 +5.968518197198864,0.5097024852245491,1,0 +16.692411037529816,20.881049649831223,1,0 +15.611538154906592,11.587847039900927,1,0 +14.608512938339262,18.170671561362887,1,0 +20.869295303658582,14.556598143466449,1,0 +7.093478892773856,5.4495725390230705,1,0 +7.661371023904066,11.496504235128365,1,0 +8.539806795318146,26.21711912024034,1,0 +18.99611318951007,0.7343160819180115,1,0 +21.60838914891705,9.4515808818334,1,0 +20.0825964444899,3.1934010718640056,1,0 +5.544492934222799,1.0220591130811196,1,0 +12.17204485232476,2.857731073160992,1,0 +17.733964747539723,2.9737335987086824,1,0 +17.965816253030205,2.3009904011929914,1,0 +18.236977441047785,104.07000151037722,1,0 +5.122347704337444,127.63134361557398,1,0 +24.416116757418493,2.576347306950208,1,0 +23.31115830588853,11.947787494241922,1,0 +9.645637436504476,12.394682838156966,1,0 +22.520385141861624,0.8089682008073562,1,0 +7.394640230748337,15.248132906523033,1,0 +15.802766287433913,49.52937269313648,1,0 +10.20626902799355,46.874293940099584,1,0 +9.735928430089261,2.064523544800318,1,0 +22.510622016680426,10.378090503819218,1,0 +11.140248095914721,0.3864441083649919,1,0 +11.072231982331722,22.627405952993378,1,0 +13.26870454691816,8.034403716547184,1,0 +13.398587961508891,30.842697109246256,1,0 +10.492286939024925,4.912412766114776,1,0 +7.167665526515338,0.9366798934296122,1,0 +14.323157187718897,7.172126681614276,1,0 +8.93026903023012,27.535927193997463,1,0 +23.815852317807728,3.152737397998056,1,0 +10.594633176582864,10.099330349516155,1,0 +18.421183189020958,34.6141271077283,1,0 +7.810161380444187,15.540810884996143,1,0 +7.211044706024695,7.882611188793602,1,0 +20.17693314700853,4.710827754425337,1,0 +9.651028429158032,0.1813398967503499,1,0 +9.611786820197011,54.05153877063491,1,0 +21.503611941295674,0.6984497016938667,1,0 +17.9020938472799,1.483881309293941,1,0 +23.88603643903043,3.759218408711209,1,0 +21.818797695192043,25.223948283353113,1,0 +16.30296636419836,13.243536730506118,1,0 +13.416540253842248,7.457290295946404,1,0 +23.819765347051433,7.459589088934734,1,0 +12.183895331048406,8.087399318984522,1,0 +9.196166157242843,2.1516515863745,1,0 +6.538229520611931,0.46839683932824616,1,0 +19.687850229199974,77.09331325968473,1,0 +6.973917745840735,7.148349575279893,1,0 +7.490377626244444,8.163493597100087,1,0 +19.29767868693918,30.206155272100204,1,0 +22.434182569580152,2.0302721080753234,1,0 +5.318327633347362,194.36452337757612,1,0 +17.357656075637784,44.01895629422102,1,0 +19.867465977584942,0.8844653308275012,1,0 +12.39953458572505,7.237981702979904,1,0 +18.66180099760415,3.6188323023376214,1,0 +20.13069856391754,188.3418959947462,1,0 +12.054277750574983,109.6230274921499,1,0 +6.214665928829927,0.30242000090481097,1,0 +6.947874864102341,2.35184487215146,1,0 +10.530624108791816,0.6630175494110502,1,0 +8.692757705263793,8.376978677493579,1,0 +5.646530583405402,0.5432084571494213,1,0 +6.070121596977114,11.590350178728752,1,0 +15.628345805073621,14.876532398574938,1,0 +16.55123460184084,10.237995525441907,1,0 +19.50404283213429,3.065699264451066,1,0 +16.71311121016275,8.367113669175385,1,0 +13.532307651536538,42.271592770745684,1,0 +5.804817867975216,0.21034197222624693,1,0 +9.914977649648208,0.4146232640151793,1,0 +13.964740060428158,1.022580304125698,1,0 +18.122010761816053,1.6316746059843306,1,0 +21.595123790956567,41.57160041593666,1,0 +9.130071834991686,20.451336353021546,1,0 +17.883641517229844,6.70882447910594,1,0 +8.86125030462863,55.256552519454516,1,0 +23.71192755636759,14.891665515120028,1,0 +21.0864116095053,2.602807642821931,1,0 +5.234433223176747,51.80873421391114,1,0 +12.355004513345193,8.062881362297237,1,0 +16.32400466129649,104.74246474326041,1,0 +15.199989451051223,13.420605821704063,1,0 +5.400283715513069,0.1068007320733198,1,0 +18.14935071819462,57.86990543274337,1,0 +9.5240080884099,5.202694183273143,1,0 +14.32969111907063,0.33513415009633807,1,0 +6.008001209937501,4.253457682070324,1,0 +11.14910464093089,20.25550200201564,1,0 +13.556746559764724,1.2435302503768515,1,0 +10.236793390021194,5.213260482985253,1,0 +11.322802466489374,119.60174680914633,1,0 +14.530812603661325,1.0667000426048996,1,0 +5.1020982340048064,3.4245333163942804,1,0 +7.314199327651877,0.328654059116923,1,0 +19.4196066399687,16.01234343811714,1,0 +14.381803398006594,42.466470255194935,1,0 +12.074857014203443,0.9193428978723392,1,0 +20.405224888108204,45.02975714014151,1,0 +6.226607059054077,16.744643482839557,1,0 +21.448629611744543,13.877128227665889,1,0 +20.498714459638578,9.45360329108919,1,0 +12.330324494559317,11.83982152459994,1,0 +24.8866971301008,6.083719760276822,1,0 +19.372733866032213,4.975035366122659,1,0 +15.272626491943374,3.571305689011856,1,0 +14.022001518663018,148.51836357778757,1,0 +9.898853895401116,13.414624203362388,1,0 +23.420706969690507,1.1696801312693905,1,0 +5.878173451281619,21.871380043098252,1,0 +8.271477013390976,12.537952528645716,1,0 +5.3620031790807845,4.13003089846204,1,0 +24.675452525380532,1.2989572347101652,1,0 +19.139979191967285,3.650184400769608,1,0 +16.828588343400043,9.045227324522026,1,0 +6.1322660373593685,5.6686121041537145,1,0 +7.46597571492428,0.29227237598004685,1,0 +22.877460276011842,7.895071187686354,1,0 +15.47123688296182,11.712728682443833,1,0 +14.618926662688608,7.39879618502388,1,0 +23.591257470285054,0.3957712953309772,1,0 +22.170592850684187,9.160589091901896,1,0 +15.171947125897276,0.9813049184729703,1,0 +23.294820878091265,13.023131238953818,1,0 +7.603521641097031,64.67419662611809,1,0 +17.742809400858825,3.8362135985847514,1,0 +12.97260534381261,13.731640005783678,1,0 +22.386485991929657,16.122372673241486,1,0 +17.767701184938197,8.502546872385196,1,0 +14.09396992968861,3.424687289643619,1,0 +22.886829602175858,13.849075420526427,1,0 +22.219204186077693,0.6199201636963677,1,0 +6.4140649045910685,48.842335731928436,1,0 +16.4297570858174,1.9676577094694774,1,0 +19.548539984759408,4.527445235339861,1,0 +12.0971921578818,3.305790908412635,1,0 +18.132632230157032,6.975496645841378,1,0 +8.20139095328981,16.462593935154327,1,0 +6.525190193327144,13.887489437542769,1,0 +8.95666595408693,8.248347315447893,1,0 +13.164745990717783,17.352544734633533,1,0 +13.276265818502287,4.789920423903067,1,0 +7.63377467695158,9.236545700948609,1,0 +16.031944786100645,5.825786304779309,1,0 +22.211904978640376,19.264730026412938,1,0 +19.8235831067455,7.1876338705643725,1,0 +11.029779852530918,3.3130998580105433,1,0 +7.833583118051756,46.25121112408265,1,0 +16.877484013692012,7.20566711242011,1,0 +9.7542557041673,60.45389027232578,1,0 +21.913753361706622,17.971121548211293,1,0 +11.545350033859723,4.823478566876325,1,0 +8.742028622594662,22.659675391732687,1,0 +22.352864785308483,2.6027545181255265,1,0 +10.012164268346968,20.603663502863423,1,0 +8.684702753715683,20.548530110686198,1,0 +21.40950594700873,2.256843216865951,1,0 +11.435012589835097,34.54541069409913,1,0 +24.01739023054717,0.2516763204050028,1,0 +19.88843441852601,0.2192223568869294,1,0 +7.452256880709902,0.5406861497243327,1,0 +20.01313282513525,0.7138478091273556,1,0 +6.46088475000346,6.452981958122354,1,0 +12.100939345657824,1.3491717314608196,1,0 +5.660066318064928,116.80059064911802,1,0 +6.319223044642713,0.3938430021744164,1,0 +15.469034843193366,3.3012583974347605,1,0 +12.710496124911586,138.5057482227488,1,0 +24.658955325302667,2.353207183688853,1,0 +16.46928218259709,11.045654860621308,1,0 +11.741614707345143,1.7632980658386144,1,0 +9.689651590748689,4.763234657834274,1,0 +17.12848792809993,12.805249004560327,1,0 +5.2688705399795435,8.224969274575887,1,0 +8.491262332685292,4.401220979422432,1,0 +16.59234692601487,11.193561617441004,1,0 +23.239628705466163,5.67907432975904,1,0 +24.21112713415874,33.89149060694316,1,0 +9.143864248790777,31.000960129215116,1,0 +18.62005860896548,10.967321476505209,1,0 +6.6946408120100385,0.4415554396065113,1,0 +21.342589496586005,19.82743526120609,1,0 +6.9124642200395465,0.10746347379202753,1,0 +22.27231394801056,28.949368342688,1,0 +13.312418267093598,0.9229181455987752,1,0 +16.7249852395663,1.1613285697633318,1,0 +17.501915630435104,7.695924810529727,1,0 +18.259261345707344,11.644176460675283,1,0 +11.160432918234727,145.03504585592034,1,0 +17.118957782441285,109.8817229471618,1,0 +8.47241006927099,0.9378783284099254,1,0 +19.945285196653565,3.440824411485631,1,0 +21.16822144939564,33.66307377314436,1,0 +7.517739229700528,30.911800445960633,1,0 +12.282072195331565,2.7537300617849563,1,0 +16.878785826393866,0.5684120787394953,1,0 +15.304765136721544,1.3344215189715252,1,0 +11.487453549692873,0.38751393055204947,1,0 +6.618186843541917,0.5439328060033373,1,0 +8.225977774681523,0.3861067317433062,1,0 +16.669419109139127,2.9790282637905072,1,0 +5.840324585780036,88.05435696157441,1,0 +16.263561883203216,40.64022627335391,1,0 +22.662839108849873,10.469115264931466,1,0 +17.14350036485819,57.450520038917176,1,0 +21.594036219627593,2.138483924937148,1,0 +22.375780253112314,3.8779827715843016,1,0 +24.972427948752884,240.94152711235702,1,0 +24.439436375368384,4.24821367995347,1,0 +8.858424581419676,11.061253725975043,1,0 +14.763361553694121,62.80066029493909,1,0 +22.93601788733853,10.308812976459368,1,0 +17.937910493894016,107.54405157961195,1,0 +10.512343577693681,0.49380681433569906,1,0 +23.552692319697233,8.272246239513672,1,0 +9.871258032494225,62.47367031257801,1,0 +23.434049025606363,9.842580386345913,1,0 +9.972805697214788,0.5443071138542216,1,0 +14.4099062009342,16.25537809402589,1,0 +18.301731050086673,125.2374202058087,1,0 +10.59850838511018,6.9647323603460025,1,0 +5.12000476075802,6.803643406001717,1,0 +14.033608434021007,20.85783664043738,1,0 +22.260595427562947,77.10464694940632,1,0 +19.02213867353275,6.5569292492640185,1,0 +22.436637644183357,1.0547387334508542,1,0 +24.594106075370217,8.085052810223987,1,0 +18.7209564890177,1.0066109624230886,1,0 +20.398048241946377,72.54629069258907,1,0 +9.570277746189385,8.352430818100325,1,0 +6.291652868732344,0.5263481352408378,1,0 +5.422257440031972,22.452043680880333,1,0 +24.292468939193057,7.641537234577375,1,0 +16.641546223214824,122.29361699698815,1,0 +20.79252287973184,1.818971839191018,1,0 +11.91883332696976,18.89973172751371,1,0 +19.817167943427336,108.6399678314898,1,0 +12.618197580147534,7.046752130209921,1,0 +13.234577908264473,6.488345995367068,1,0 +5.302135647288524,0.46262697512944384,1,0 +15.417222518934867,3.4440825663271717,1,0 +8.243256987652275,0.2469591193773287,1,0 +8.358538757294882,16.28374564970406,1,0 +13.131155088143423,2.683890573386235,1,0 +18.65096349133644,18.93268640181452,1,0 +14.111395589723251,8.053535843937587,1,0 +8.226636951696127,3.522963141337888,1,0 +17.11987400162965,88.19942908227847,1,0 +20.246657615741714,5.395786416050076,1,0 +6.981238814452663,0.21417784652198313,1,0 +13.426858937700745,2.6871172292043575,1,0 +8.671863556012976,0.4202748485791038,1,0 +10.189818296292795,9.255719531947252,1,0 +24.91500423284946,3.3490492976803377,1,0 +11.296950261481106,4.9446172226103124,1,0 +9.094418260545936,2.236259020176363,1,0 +24.447839216070715,105.1919285368162,1,0 +7.044594187976326,133.897798911843,1,0 +17.905657404912635,61.07365114044352,1,0 +6.4459468609211035,3.891867950903443,1,0 +7.140811635691207,2.2462164658715005,1,0 +24.835039067449976,1.318394650524733,1,0 +12.11352084027836,7.1619394687741105,1,0 +24.663870682653503,4.485220545542707,1,0 +18.805381185100412,10.846201478336077,1,0 +18.103933567102068,55.88909654807718,1,0 +16.40219703763025,5.710778046851075,1,0 +19.10294913147809,8.663125958899826,1,0 +8.153471444717143,11.907084578109485,1,0 +23.19250596386846,11.226855395465268,1,0 +9.794805060043,20.377323689411824,1,0 +18.577059037559664,7.876111184063263,1,0 +9.929961979181972,0.21808574007539205,1,0 +17.907606488969176,46.84313067247106,1,0 +7.512574235142674,1.2410892270317544,1,0 +18.564713431389535,2.7939756718499926,1,0 +16.243804919954854,9.827553876791853,1,0 +9.734705721607897,29.552745887399343,1,0 +17.00735207845224,3.1602010515290733,1,0 +16.498937073070557,2.393567993161047,1,0 +8.474229699056595,339.2439631570457,1,0 +7.911759055452421,20.745180660642514,1,0 +5.650105139112566,2.2269015276214117,1,0 +16.682997709759512,2.2854253922873333,1,0 +10.040948300289456,3.769238605820583,1,0 +11.751362915544306,2.5721588835520763,1,0 +16.698139302914498,362.31089340871006,1,0 +23.60314934886992,1.5697263636920842,1,0 +18.505440982459113,5.50569708709474,1,0 +10.345065695403608,4.279931988659079,1,0 +13.241195197852793,5.745475153783466,1,0 +5.839734264251311,0.2794844095295774,1,0 +24.421932653672993,68.4812974514429,1,0 +22.119193473169577,131.44614861632078,1,0 +22.439062414739745,4.139797320116404,1,0 +20.387857541604898,4.254342211076884,1,0 +19.92975823339075,3.646733833673261,1,0 +20.73744781356072,6.055440883904513,1,0 +13.879481800596695,2.251044010833685,1,0 +22.69943269053241,19.149669764823027,1,0 +13.047072956713382,2.568307781561121,1,0 +8.523686322341673,66.12028807917824,1,0 +9.975190766723827,0.28790407565273357,1,0 +8.027909575235098,7.35500579237199,1,0 +24.655366015513426,211.5072448486257,1,0 +11.20307204788085,4.964232879651448,1,0 +24.190164362136272,9.822881946767458,1,0 +6.1922796624898915,14.247590259785603,1,0 +15.669752577906474,15.618640578784472,1,0 +22.382196282127406,0.7859075601950598,1,0 +16.052690761548,4.8296750376422874,1,0 +5.915860147546045,48.139918113281574,1,0 +11.81061854854459,7.1281769629209935,1,0 +14.015828219896648,0.13573998880281524,1,0 +7.431495992934797,0.37450843910013004,1,0 +19.923467897984665,2.440832996427016,1,0 +12.44953237198526,8.514859411732703,1,0 +22.428595045106483,9.261422943511345,1,0 +16.778118212416302,5.835487608621614,1,0 +6.7553538876795205,6.535618439472757,1,0 +5.0543314511259085,58.329261327697,1,0 +19.43324172498658,4.237097478936809,1,0 +20.204852687481324,123.75122256146936,1,0 +20.101731674443,0.8541755463621377,1,0 +22.16961159717757,17.36123999906768,1,0 +23.97771324119065,2.685811640658291,1,0 +20.131111203478646,13.782789773628837,1,0 +19.364293539721984,20.730328060584736,1,0 +8.433435830341185,20.569649750167557,1,0 +13.154174597824458,5.0048793843328925,1,0 +20.58528368714964,37.42447437671203,1,0 +16.676828767403492,2.7176864279107784,1,0 +20.40311110753799,1.5125321969147605,1,0 +24.438707370122426,11.871977395955971,1,0 +24.499177343200426,1.5853488345014415,1,0 +17.619299126050898,2.160653698482232,1,0 +18.967017157601656,3.2374255118545636,1,0 +10.367844299315475,14.406805403973548,1,0 +19.962527324284892,15.310513160256331,1,0 +9.596984715212603,10.766880305087257,1,0 +7.65009101618547,35.08011691700428,1,0 +19.12402804651763,11.245023984069409,1,0 +16.247352499428672,10.542595990875977,1,0 +7.703943117889576,11.12352422804777,1,0 +22.356990454851182,96.03600290126133,1,0 +5.007991187849548,0.2010806182473784,1,0 +22.82140493838815,1.0459034957897746,1,0 +16.23182717447402,2.99259378346059,1,0 +18.736492407124025,2.5915769826763735,1,0 +10.910937108383514,4.395020318112908,1,0 +13.125181132385041,40.182192742926475,1,0 +22.04591965168016,5.443096914089298,1,0 +10.746898463869002,7.264709592107561,1,0 +23.39727642617654,0.9134858169008289,1,0 +23.82180951814167,8.345746201910687,1,0 +20.294164107756224,74.33267750731812,1,0 +7.580912369366269,0.8148531682486984,1,0 +22.425089465896598,12.591426332874253,1,0 +15.768704459692817,16.11025929404548,1,0 +6.190363130499609,5.467662341820384,1,0 +6.568506926300469,3.118361150747353,1,0 +6.930673103081062,21.536361211756756,1,0 +7.997625206736847,0.4237399932364485,1,0 +7.989061863031238,0.13966866814590087,1,0 +15.964435310009867,24.288809722014175,1,0 +20.517173463932703,18.789169629394845,1,0 +21.3190089920233,33.754128570432506,1,0 +22.04383672901662,13.117345414180015,1,0 +18.52815235057613,2.403431593325305,1,0 +8.564683620526921,0.4521597663765857,1,0 +5.618131912262179,14.61285823017511,1,0 +16.645846898511515,1.3509187686305328,1,0 +14.481577743072993,6.2361359034504975,1,0 +20.601615106265527,4.0788895486509285,1,0 +11.461415182610509,15.448324675690252,1,0 +7.458448670948855,46.13711804394988,1,0 +17.53186665907269,11.5716407261537,1,0 +12.13459018145455,22.805226164830014,1,0 +11.981919827128294,1.8859293339586443,1,0 +5.115686897188425,7.970592829575984,1,0 +23.277650994264985,1.9412806136864829,1,0 +14.422504162413533,11.218574831836476,1,0 +12.974873013647738,2.611829555049219,1,0 +12.638759864945897,70.12567400469509,1,0 +13.439484345496165,2.153842016196436,1,0 +24.720311208867933,7.405978197946909,1,0 diff --git a/vignettes/typhoid-seroincidence.Rmd b/vignettes/typhoid-seroincidence.Rmd new file mode 100644 index 000000000..17970f043 --- /dev/null +++ b/vignettes/typhoid-seroincidence.Rmd @@ -0,0 +1,113 @@ +--- +title: "Typhoid Seroincidence" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Typhoid Seroincidence} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- +#Introduction + +This vignette provides users with an example analysis using the *serocalculator* package. Users will be able to determine the seroincidence of typhoid fever in the sample population using existing longitudinal antibody dynamics from ______, and a cross-sectional serosurvey from _____. + +##References +(To be added) + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` +#Sample Analysis +## ##Load serocalculator package +##Still in development as of 09/01/23 +The first step in conducting this analysis is to load our necessary packages. Follow the installation instructions [add link] if you ahev not already installed *serocalculator*. + +```{r setup} + +#library(devtools) +#install_github("UCD-SERG/serocalculator") +library(serocalculator) +library(tidyverse) +``` + +##Load data +###Load longitudinal parameter mcmc data and prepare for model +The next step is to load the longitudinal data modeled with Monte Carlo Markov Chain ____ (Add more here). + +These data include the following variables... + +The code chunk below loads the data included in the *serocalculator* package. We then create two additional variables, *alpha* and *d*. *Alpha* is the ______ and *d* is the ______. Finally, we select only the variables needed for the analysis. +```{r longdata} +c.hlye.IgG <- + fs::path_package( + "extdata", + "dmcmc_hlyeigg_09.30.rds", + package = "serocalculator") |> + readRDS()%>% + mutate(alpha = alpha*365.25, + d = r-1) %>% + select(y1, alpha, d) +``` + +##Load simulated data (lambda = .2) and prepare for model +The simulated data are assuming a force of infection (FOI, *lambda*) of 0.2. We have selected hlye and IgG as our target measures. From the original dataset, we rename our variables to ______. Finally, we once again limit the dataset to only the variables needed for the analysis. +``` {r simdata} +library(fs) # filesystem utility functions +p.hlye.IgG <- + fs::path_package( + package = "serocalculator", + "extdata/simpophlyeigg.2.csv") %>% + read_csv() %>% + rename( + y = y.smpl, + a = a.smpl) %>% + select(y, a) +``` + + +## Conditions based on how i simulated the data +Next, we must set conditions based on some assumptions and simulated data. (Add more here) +``` {r conditions} +cond.hlye.IgG <- data.frame( + nu = 1.027239, # B noise + eps = 0.2, # M noise + y.low = 0.0, # low cutoff + y.high = 5e4); +``` + + +## Seroincidence estimation +Finally, we are ready to begin seroincidence estimation. We define our starting value as 0.5, which will also define our initial estimate for lambda (FOI). Then we set up values for the confidence interval. + +(Add explanation for each section below) +```{r seroinc} +start <- .05 + +lambda = start # initial estimate: starting value +log.lambda = log(lambda) +log.lmin=log(lambda/10) +log.lmax=log(10*lambda) + + + +objfunc <- function(llam){ + return(res <- fdev(llam, p.hlye.IgG, c.hlye.IgG, cond.hlye.IgG)) +} + + +fit <- nlm(objfunc,log.lambda, + hessian=TRUE,print.level=0,stepmax=(log.lmax-log.lmin)/4) + + +#lambda, lower, upper, LF min +log.lambda.est <- c(exp(fit$estimate), + exp(fit$estimate + qnorm(c(0.025))*sqrt(1/fit$hessian)), + exp(fit$estimate + qnorm(c(0.975))*sqrt(1/fit$hessian)), + fit$minimum) + + +log.lambda.est +``` +In our simulated data, we found that the estimated seroincidence of typhoid is ______.