Comparing Covid Cases of US States

Missouri’s confirmed cases (z-score) compared to the other U.S. states from April 20th to October 3rd, 2020. The z-score is a measure of how far you are away from the average. In this case, a negative z-score is good because it indicates that you’re below the average number of cases (per 1000 people). For all the states.

Based on my students’ statistics projects, I automated the method (using R) to calculate the z-score for all the states in the U.S. We used the John Hopkins daily data.

I put graphs for all of the states on the COVID: The U.S. States Compared webpage.

The R functions (test.R) assumes all of the data is in a folder (COVID-19-master/csse_covid_19_data/csse_covid_19_daily_reports_us/), and outputs the graphs to the folder ‘images/zscore/‘ which needs to exist.

covid_data <- function(infile, state="Missouri") {
    filename <- paste(file_dir, infile, sep='')
    mydata <- read.csv(filename)
    pop <- read.csv('state_populations.txt')
    mydata <- merge(mydata, pop)
    mydata$ConfirmedPerCapita1000 <- mydata$Confirmed / mydata$Population *1000
    summary(mydata$ConfirmedPerCapita1000)
    stddev <- sd(mydata$ConfirmedPerCapita1000)
    avg <- mean(mydata$ConfirmedPerCapita1000)
    cpc1k <- mydata[mydata$Province_State == state,]$ConfirmedPerCapita1000
    zscore <- (cpc1k - avg)/stddev
    #print(infile, zscore)
    return(zscore)
}


get_zScore_history <-function(state='Missouri') {
  df <- data.frame(Date=as.Date(character()), zscore=numeric())
  for (f in datafiles){
    dateString <- as.Date(substring(f, 1, 10), format='%m-%d-%y')
    zscore <- covid_data(f, state=state)
    df[nrow(df) + 1,] = list(dateString, zscore)
  }
  df$day <- 1:nrow(df)

  plot_zScore(df, state)


  # LINEAR REGRESSIONS:
  # http://r-statistics.co/Linear-Regression.html
  lmod <- lm(day ~ zscore, df)
  return(df)
}

plot_zScore <- function(df, state){
  max_z <- max( abs(max(df$zscore)), abs(min(df$zscore)))
  print(max_z)


  zplot <- plot(x=df$day, y=df$zscore, main=paste('z-score: ', state), xlab="Day since April 20th, 2020", ylab='z-score', ylim=c(-max_z,max_z))
  abline(0,0, col='firebrick')
  dev.copy(png, paste('images/zscore/', state, '-zscore.png', sep=''))
  dev.off()
}

get_states <- function(){
  lastfile <- datafiles[ length(datafiles) ]
  filename <- paste(file_dir, lastfile, sep='')
  mydata <- read.csv(filename)
  pop <- read.csv('state_populations.txt')
  mydata <- merge(mydata, pop)
  return(mydata$Province_State)
}

graph_all_states <- function(){
  states <- get_states()
  for (state in states) {
    get_zScore_history(state)
  }
}

file_dir <- 'COVID-19-master/csse_covid_19_data/csse_covid_19_daily_reports_us/'
datafiles <- list.files(file_dir, pattern="*.csv")

print("To get the historical z-score data for a state run (for example):")
print(" > get_zScore_history('New York')" )

df = get_zScore_history()

You can run the code in test.R in the R console using the commands:

> source('test.R')

which does Missouri by default, but to do other states use:

> get_zScore_history('New York')

To get all the states use:

> graph_all_states()

Positive to Negative Feedback: Three to One (at least)

Three positives for every one negative is the minimum ratio required for people to flourish, according to the work of Marcial Losada (and others).

To flourish means to live within an optimal range of human functioning, one that connotes goodness, generativity, growth, and resilience.

— Fredrickson and Losada: Positive Affect and the Complex Dynamics of Human Flourishing (ᔥ PubMed), in American Psychologist (2005).

Why do we need more positives than negatives? Because we’re impacted more by negatives than positives, so we need more positives to offset. Note that people tend toward happiness on average.

Why are positive feelings good? Positivity increases:

  • the scope of your attention. Making it possible to see the bigger picture (see Hirsh and Anderson, 2007 (pdf));
  • intuition;
  • creativity;
  • physical healing;
  • the immune system (at least in conjunction with mindfulness meditation: see Davidson et al, 2003);
  • resilience to adversity;
  • happiness;
  • psychological growth;
  • cortisol (positivity reduces cortisol levels — cortisol is a stress hormone; see Steptoe et al., 2004);
  • resistance to physical pain;
  • how long you’ll live.
  • how much you learn.

In terms of education:

… initially positive attitudes—like interest and curiosity—produce more accurate subsequent knowledge than do initially negative attitudes—like boredom and cynicism. Positivity, by prompting approach and exploration, creates experiential learning opportunities that confirm or correct initial expectations. By contrast, because negativity promotes avoidance, opportunities to correct false impressions are passed by …. positive affect—by broadening exploratory behavior in the moment—over time builds more accurate cognitive maps of what is good and bad in the environment. This greater knowledge becomes a lasting personal resource.

— — Fredrickson and Losada: Positive Affect and the Complex Dynamics of Human Flourishing (ᔥ PubMed), in American Psychologist (2005).

So, once again, research shows how important it is to have a positive (happy) learning environment, and to be able to “spark the imagination” at the beginning of a lesson.

Cumulatively, there is the Losada Zone, a range from 3:1 to 11:1 of positive to negative feelings that are indicative of complex (good) interaction in groups, which separates people who flourish from those who languish.

The Adolescent Sleep Cycle

Bora Zivkovic compiles some information on how kids circadian rhythms change during adolescence, and advocates for later school starting hours.

He points out the interesting concept of chronotypes:

Everyone, from little children, through teens and young adults to elderly, belongs to one of the ‘chronotypes’. You can be a more or less extreme lark (phase-advanced, tend to wake up and fall asleep early), a more or less extreme owl (phase-delayed, tend to wake up and fall asleep late). You can be something in between – some kind of “median” (I don’t want to call this normal, because the whole spectrum is normal) chronotype.

— Zivkovic (2012): When Should School Start in the morning in Scientific American (blog).

And how your chronotype gets phase-delayed at puberty:

No matter where you are on these continua, once you hit puberty your clock will phase-delay. If you were an owl to begin with, you will become a more extreme owl for about a dozen years. If you are an extreme lark, you’ll be a less extreme lark. In the late 20s, your clock will gradually go back to your baseline chronotype and retain it for the rest of your life.

— Zivkovic (2012): When Should School Start in the morning in Scientific American (blog).

There’s no Becoming a Writer

If … you had asked, “Should I become a professional writer?” the answer would have been No. And why not? The answer would have been that if you were destined to become a professional writer, you wouldn’t have asked the question; you would have known the answer for yourself and to hell with what anybody told you.

— Malcolm Cowley in a letter to Richard Max Rebecca Davis O’Brien (2012): Malcolm Cowley, Life Coach, in the Paris Review of Books.

Advice from a writer to a potential writer. A career in writing is a difficult choice: “the rewards come late”; “most writers are failures”. You need to want to write. Intrinsic motivation.

Rebecca Davis O’Brien (2012): Malcolm Cowley, Life Coach The Dish.

A Better Commencement Address

2. Some of your worst days lie ahead. Graduation is a happy day. But my job is to tell you that if you are going to do anything worthwhile, you will face periods of grinding self-doubt and failure.

— Wheelan, 2012: 10 Things Your Commencement Speaker Won’t Tell You in The Wall Street Journal

Charles Wheelan provides an excellent perspective on what should be important in a commencement address.

I particularly like this warning about the danger of working only for rewards:

8. Don’t model your life after a circus animal. Performing animals do tricks because their trainers throw them peanuts or small fish for doing so. You should aspire to do better.

— Wheelan, 2012: 10 Things Your Commencement Speaker Won’t Tell You in The Wall Street Journal

And this point on conservation and the real meaning of being conservative:

3. Don’t make the world worse. I know that I’m supposed to tell you to aspire to great things. But I’m going to lower the bar here: Just don’t use your prodigious talents to mess things up. Too many smart people are doing that already.

— Wheelan, 2012: 10 Things Your Commencement Speaker Won’t Tell You in The Wall Street Journal

The Dish

Control your Destiny: How the Adolescent Brain Works

During your adolescence, which lasts from your early teens into your 20’s, the brain changes rapidly, you develop new abilities and capacities, and the habits of mind and skills you develop will last long into adulthood.

Abilities: The last part of the brain to develop is the Frontal Lobe. It’s responsible for reasoning and judgement — aka Executive Function. So, it’s somewhat understandable that teens often have poor impulse control — their Frontal Lobe (the prefrontal cortex in particular) is still developing.

The parts of the adolescent brain.

However that’s not an excuse. It is essential for adolescents to be held to account, because it’s only by practicing responsibility that they get to learn how to use their Executive thinking skills.

Because that’s how we learn — by practicing.

When we’re learning something new, brain cells, called neurons, reach out and connect to form networks. As we practice and focus on specific things — certain patterns of movement or certain ways of thought — some of the unused connections get pruned away, while others become stronger. The axons that connect the most-used pathways get coated in myelin, which acts as an insulator to make sure signals can pass quickly and efficiently.

Neurons in the brain transmit information to each other along long axons and across the synaptic gap.

By reorganizing the connections between brain cells, the brain learns and becomes better at what you’re practicing. Thus we gradually transition from novices to experts.

However, there is a cost.

Making strong pathways makes for quicker thinking about the things we’ve practiced, but makes our brains somewhat less flexible at learning new things. We develop habits of mind that stay with us for a long time.

Some of those habits we might not actually want to keep; and there’s also the possibility that we might not develop some habits of mind that we really would like to have.

The development of the frontal lobe during adolescence opens a window of opportunity for learning good judgement/executive function, but it does not mean we actually will learn it. We need to actually practice it.

So, if you would like to know yourself, want to be able to control yourself, and, especially, want to shape the future person you will become, then you’re going to have to figure out: which habits of mind you want to be practicing and which ones you don’t.

What Causes Autism?

Martha Herbert argues that diet and environmental toxins play a significant role in creating autism in an interview with Anne Strainchamps on To the Best Of Our Knowledge.

After much thought, I have come to the formulation that autism may be most comprehensively understood and helped through an inclusive whole-body systems approach, where genes and environment are understood to interplay.

— from Martha Herbert’s Website.

Herbert is the author of The Autism Revolution, and her website also hosts her scientific publications.