Advertisement
Guest User

make_county_prediction

a guest
Mar 30th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. function make_county_prediction($county,$start,$count,$t,$dt){
  2.     global $core;
  3.     $return = '';
  4.     $start = new DateTime ($start, new DateTimeZone ('UTC'));
  5.     $end = new DateTime (' +30 days', new DateTimeZone ('UTC'));
  6.     $interval = new DateInterval ('P1D');
  7.     $range = new DatePeriod ($start, $interval, $end);
  8.     $N = $count; // total cases
  9.     $Nmax = total_count($county); // population
  10.     $a = '0.394'; // percentage daily infection rate   
  11.     foreach ($range as $date) {
  12.         $out = $date->format ('Y-m-j');
  13.         //$N=$N+$a*(1-$N/$Nmax)*$N*$dt;
  14.         //$t=$t+$dt;
  15.         $Nold=$N;
  16.         $N=$N+$a*(1-$N/$Nmax)*$N*$dt;
  17.         $r=($N-$Nold)/$dt;
  18.             $return .= '{ label: "'.$out.'", y: '.$r.' }, ';
  19.     }
  20.     return $return;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement