stats report

profilerem22
attachment_51.pdf

Project #1 Hints

Here are some hints about how I have done my version of Project #1. You do NOT need to do things exactly like me. I am just showing some things that have worked well for me.

First of all, my pop data frame is structured as follows:

Diseas e Status

Age (days)

Household

Workp lace/ School

Job/ grade

Day of recove

r

Day of death

Long COVID

0 11278 1 LB6 17 -10 -10 0 0 7828 1 NW 537 -10 -10 0 0 27517 2 SB91 5 -10 -10 0 0 14830 2 SB195 2 -10 -10 0 0 8886 3 SB144 3 -10 -10 0 0 22095 3 SB127 2 -10 -10 0 0 1883 3 SC -1 -10 -10 0 0 1902 3 SC -1 -10 -10 0 0 27091 4 LB4 47 -10 -10 0 0 20680 4 LB10 22 -10 -10 0 0 1497 4 SC -2 -10 -10 0 0 20547 5 NW 833 -10 -10 0 0 20894 5 SB166 2 -10 -10 0 0 12214 5 LB2 20 -10 -10 0 0 16778 5 NW 420 -10 -10 0

The column Household tells which household each person belongs to. This is how I know who is in the same household. Likewise, the column Workplace/School shows where each person works and this is how I know who works together. The Job/grade column corresponds to jobs slots for adults and grade in school for children. Each workplace has a number of available job slots and this tells which slot each person has. At present, my program does not use this. I included it in case I wanted it in the future. The school grade is calculated for each student based on their age. It is negative for kids not in school yet. I use the grades to determine which kids are exposed to each other. Day of recovery and Day of death are the days when a person sick with COVID will either recover of die. This is determined when they are infected. These values are initially set to negative numbers to indicate that the person has not been infected. The Long COVID column is 1 if an individual gets long COVID.

Setting up the population

My function to set up the population has the following as its core:

pop=NULL Loop (f over households){ X=runif(1) If(x<0.25){ #single invidual

pop=rbind(pop,c(0,adult_age(),f,NA,NA,-10,-10,0)) } else if ((x>0.25)&(x<0.35){ #two adults with no kids pop=rbind(pop,c(0,adult_age(),f,NA,NA,-10,-10,0)) pop=rbind(pop,c(0,adult_age(),f,NA,NA,-10,-10,0)) } else if . . . . }

This does a loop over households. For each household, it generates random number x to figure out what type of household it is. The series of if/ifelse steps correspond to the different possibilities for the household type. The lines pop=rbind(pop,c(0,adult_age(),f,NA,NA,-10,-10,0)) add individuals into the population. Each time that I had someone in, there is a line like this. The first option adds one adult, the second adds two adults. Further options add individuals for other household options. This sets the initial values for each individual. I fill in jobs/school later, so everyone is set to NA initially for these. f is the index for the current household.