2020年6月13日土曜日

EPS 2020JUN13



eps_year_xts["2020::"]
             [,1]
2020-01-01 116.42
2020-04-01 100.84
2020-07-01  93.89
2020-10-01  90.33
2021-01-01 110.84
2021-04-01 125.10
2021-07-01 135.49
2021-10-01 142.90

~$ tac eps.txt 
3/31/2019 2834.40 $37.99 $35.02 18.52 21.09 $153.05 $134.39
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27
9/30/2019  2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
12/31/2019 3230.78 $39.18 $35.53 20.56 23.16 $157.12 $139.47
3/31/2020 (97.5%) 2584.59 $19.70 $11.98 22.42 26.73 $138.83 $116.43
6/30/2020 $23.08 $19.94 25.56 30.68 $121.77 $101.44
9/30/2020 $31.04 $27.52 27.54 32.77 $113.00 $94.97
12/31/2020 $35.89 $32.62 28.37 33.81 $109.71 $92.06
3/31/2021 $37.02 $33.16 24.50 27.49 $127.03 $113.24
6/30/2021 $38.14 $34.09 21.90 24.43 $142.09 $127.39
9/30/2021 $42.05 $37.98 20.33 22.58 $153.10 $137.85
12/31/2021 $44.59 $40.05 19.24 21.42 $161.80 $145.28

~$   tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'

eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.47
eps_year_xts["2019::"][5] <- 116.43
eps_year_xts["2019::"][6] <- 101.44
eps_year_xts["2019::"][7] <- 94.97
eps_year_xts["2019::"][8] <- 92.06
eps_year_xts["2019::"][9] <- 113.24
eps_year_xts["2019::"][10] <- 127.39
eps_year_xts["2019::"][11] <- 137.85
eps_year_xts["2019::"][12] <- 145.28

Personal Income and GDP PI



Recalculate based upon the past 20 years except 2020.


summary(lm(last(yearlyReturn(PI),20)[-20] ~ last(yearlyReturn(G),20)[-20]))

Call:
lm(formula = last(yearlyReturn(PI), 20)[-20] ~ last(yearlyReturn(G), 
    20)[-20])

Residuals:
      Min        1Q    Median        3Q       Max 
-0.063473 -0.008838  0.000614  0.013313  0.045431 

Coefficients:
                               Estimate Std. Error t value Pr(>|t|)   
(Intercept)                    0.006467   0.012627   0.512  0.61514   
last(yearlyReturn(G), 20)[-20] 0.878119   0.290504   3.023  0.00767 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.02297 on 17 degrees of freedom
Multiple R-squared:  0.3496, Adjusted R-squared:  0.3113 
F-statistic: 9.137 on 1 and 17 DF,  p-value: 0.007673

  • calculate PI according to the formula above on the assumption that 2020 GDPC1 year return is -5% and CPI is 2%.
0.006467 0.878119 *G["2019-10-01"]*0.97
                GDP
2019-10-01 18508.34


  • when 2020 GDP growth is forecasted as -0.05, to calculate PI growth rate do this.


0.006467 + 0.878119 *(expected GDP growth rate)


  • then 2020 PI forecast is as below


(1 + 0.006467 + 0.878119 *-0.05)*PI["2019-10-01"]
                 PI
2019-10-01 18061.11

plot.default(last(yearlyReturn(G),20)[-20],last(yearlyReturn(PI),20)[-20])
abline(lm(last(yearlyReturn(PI),20)[-20] ~ last(yearlyReturn(G),20)[-20]))
abline(v=0)



Recalculate based upon the past 50 years except 2020.


summary(lm(last(yearlyReturn(PI),50)[-50] ~ last(yearlyReturn(G),50)[-50]))

Call:
lm(formula = last(yearlyReturn(PI), 50)[-50] ~ last(yearlyReturn(G), 
    50)[-50])

Residuals:
      Min        1Q    Median        3Q       Max 
-0.065914 -0.005273  0.000005  0.006657  0.043099 

Coefficients:
                               Estimate Std. Error t value Pr(>|t|)    
(Intercept)                    0.008346   0.005670   1.472    0.148    
last(yearlyReturn(G), 50)[-50] 0.890811   0.080517  11.064 1.11e-14 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.01723 on 47 degrees of freedom
Multiple R-squared:  0.7226, Adjusted R-squared:  0.7167 
F-statistic: 122.4 on 1 and 47 DF,  p-value: 1.11e-14

0.008346+0.890811 *G["2019-10-01"]*0.97
                GDP
2019-10-01 18775.85

0.008346+0.890811 *(expected GDP growth rate)
  • when 2020 is -0.05
0.008346+0.890811 *-0.05
[1] -0.03619455

(1+ 0.008346+0.890811 *-0.05)*PI["2019-12-01"]

      PI
2019-12-01 18222.28

2020年6月2日火曜日

.Last function 終了 終了処理



save image files with timestamp file name like "yyyy-mm-dd-hh-mm-ss-00" and .Rdata.

.Last <- function() {
  # save.image(file=paste(getwd(),Sys.time(),sep="/"))
  #
  # save working image in the parent directory. expected the length of the directory name is fixed.
  # adjust value "len" to fit the length of the result "getwd()".
  #
  op <- options(digits.secs = 2)
  start_pos <- 1
  # len <- 23
  # change to decide based upon strings length.
  last_pos <- nchar(as.character(getwd())) -2
  save.image(file=gsub("[ :.]","-",paste(substr(getwd(),start_pos,last_pos),Sys.time(),sep="/")))
   cat("time stamp file done...\n")
  save.image(file=paste(getwd(),".Rdata",sep="/"))
   cat("RData done...\n")
  #
  # OR store working image at the working directory
  #
  # save.image(file=gsub(" ","-",paste(getwd(),Sys.time(),sep="/")))
  #
  cat("bye bye...\n")
}

2020年6月1日月曜日

EPS 2020JUN01



the entries below are wrong.

> eps_year_xts["2020::"]
             [,1]
2020-01-01 102.44
2020-04-01  96.80
2020-07-01  95.16
2020-10-01 115.77
2021-01-01 130.19
2021-04-01 140.44
2021-07-01 147.68
2021-10-01 150.31

~$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.47
eps_year_xts["2019::"][5] <- 116.42
eps_year_xts["2019::"][6] <- 100.84
eps_year_xts["2019::"][7] <- 93.89
eps_year_xts["2019::"][8] <- 90.33
eps_year_xts["2019::"][9] <- 110.84
eps_year_xts["2019::"][10] <- 125.10
eps_year_xts["2019::"][11] <- 135.49
eps_year_xts["2019::"][12] <- 142.90

2020年5月29日金曜日

Global PMI manufacturing



> pmi_global <- as.xts(c(50.3,50.1,50.4, 47.1,47.3,39.8),seq(as.Date("2019-11-01"),as.Date("2020-04-01"),by='months'))
> pmi_global
           [,1]
2019-11-01 50.3
2019-12-01 50.1
2020-01-01 50.4
2020-02-01 47.1
2020-03-01 47.3
2020-04-01 39.8


> pmi_global <- append(pmi_global,as.xts(c(47.9,50.3,51.8,52.3),seq(as.Date("2020-06-01"),as.Date("2020-09-01"),by='months')))

> pmi_global
           [,1]
2019-11-01 50.3
2019-12-01 50.1
2020-01-01 50.4
2020-02-01 47.1
2020-03-01 47.3
2020-04-01 39.6
2020-05-01 42.4
2020-06-01 47.9
2020-07-01 50.3
2020-08-01 51.8
2020-09-01 52.3

2020年5月23日土曜日

Tokyo Newly Infection and R + 7 days moving average


  • データはhttps://catalog.data.metro.tokyo.lg.jp/dataset/t000010d0000000068/resource/c2d997db-1450-43fa-8037-ebb11ec28d4c から取得した「リソース」ボタンを押すこと。
  • データは公表年月日データが記録されれているだけなので、これをapply.daily()を使用して日毎に集計する必要がある。結果は日々差分データとなる。
  • nod は平滑化のための期間パラメータ(日数)である。ここでは 7 とする。
  • Kは、(十進LOG(過去nod日間の新規感染確認者数計)ー 十進LOG(さらにその前のnod日間の新規感染確認者数計))/ nod
  • L = 平均潜伏期間 = 4.76 (7 in china) 出典= https://www.fukuishimbun.co.jp/articles/-/1071227
  • 福井県内で新型コロナウイルスの感染が確認された人のうち、ほかの感染者と接触し発症するまでの潜伏期間が推定できるケースの平均値は「4.76日」だった。
  • D = 平均潜伏感染期間 = 9 あるいはL+2。2は中国での実測値。
  • R = K^2*(L*D)+K*(L+D)+1

l <- 4.76
d <- l+2
nod <- 7


w <- c()
# w <- read.csv("~/R/R2/covid/summary.csv")
# https://stopcovid19.metro.tokyo.lg.jp/data/130001_tokyo_covid19_patients.csv
curl <- "https://stopcovid19.metro.tokyo.lg.jp/data/130001_tokyo_covid19_patients.csv"
cdestfile <- "~/R/R2/covid/tokyo.csv"
download.file(curl,cdestfile)
w <- read.csv("~/R/R2/covid/tokyo.csv")

w <- apply.daily(as.xts(rep(1,length(w[,1])),as.Date(w[,5])),sum)
last(w)


len <- length(w[,1])
k <- c()
for(i in seq(2*nod+1,len,1)) {
 k <- append(k,((log10(sum(w[,1][(i-nod+1):i]))) - log10(sum(w[,1][(i-2*nod+1):(i-nod)])))/nod)
}
r <- round(k**2*(l*d) + k*(l+d) +1,2)
w <- merge(w,as.xts(r,last(index(w),length(r))))
w


colnames(w)[2] <- "effective_repro"
last(w,len-11)
# plot(last(w[,2],60))

# R と新規感染者数を混在させるためスケール調整のために係数を計算する。
multi <- (max(na.omit(last(w[,1],length_graph))) / max(na.omit(last(w[,2],length_graph))))
length_graph <- 60 # グラフは過去45日間が対象
# merge(w,)

# as.xts(as.vector(round(last((na.omit(filter(w[,1],rep(1,7))/7)),length_graph),2)),as.Date(last(index(w),length_graph)))
w <- merge(w,as.xts(as.vector(round(last((na.omit(filter(w[,1],rep(1,7))/7)),length_graph),2)),as.Date(last(index(w),length_graph))))
w[,2] <- w[,2]*multi
positive <- as.vector(last(w[,1],length_graph))
repro <- as.vector(round(last(w[,2],length_graph),2))
moving_a <- as.vector(last(w[,3],length_graph))
date <- as.Date(last(index(w),length_graph))


df <- data.frame(
                p=positive,
                r=repro,
                m=moving_a,
                # s=seq(1,45,1))
                t=date)


p <- ggplot(df,aes(x=t))

p <- p + geom_bar(aes(y=p),stat="identity", colour="limegreen",fill="limegreen")
# p <- p + scale_x_date(date_breaks = "1 month", date_labels = "%M")
p <- p + geom_path(aes(y=r),colour='red')
p <- p + geom_path(aes(y=m),colour='blue')
# p <- p + scale_x_date(date_breaks = "1 month", date_labels = "%M")


p <- p + theme(axis.title.x=element_blank(),axis.title.y=element_blank())
p <- p+annotate("text",label=as.character("1.0"),x=as.Date(df$t[length_graph]), y=5+1*multi,colour='black')
p <- p + geom_hline(yintercept = 1*multi,size=0.5,linetype=2,colour="red",alpha=1)
p <- p+annotate("text",label=as.character("2.0"),x=as.Date(df$t[length_graph]), y=5+2*multi,,colour='black')
p <- p + geom_hline(yintercept = 2*multi,size=0.5,linetype=2,colour="red",alpha=1)
png("03tokyo.png", width = 800, height = 600)
plot(p)
dev.off()



2020年5月21日木曜日

All Region Daily New Infection stack histgram curl(),matrix(), cbind(),transform(),png(),melt()




  • データは"https://raw.githubusercontent.com/kazogiwara/covid19/master/data/prefectures.csv"から取得
  • データは各県のデータが日付と県名をキーにシーケンシャルに格納されている。必要なデータだけを抽出、ソートの上使用する。 
  • nod は平滑化のための期間パラメータ(日数)である。ここでは 7 とする。
  • Kは、(十進LOG(過去nod日間の新規感染確認者数計)ー 十進LOG(さらにその前のnod日間の新規感染確認者数計))/ nod
  • L = 平均潜伏期間 = 4.76 (7 in china)
  • from https://www.fukuishimbun.co.jp/articles/-/1071227
  • 福井県内で新型コロナウイルスの感染が確認された人のうち、ほかの感染者と接触し発症するまでの潜伏期間が推定できるケースの平均値は「4.76日」だった。
  • D = 平均潜伏感染期間 = 9 あるいはL+2。2は中国での実測値。
  • R = K^2*(L*D)+K*(L+D)+1
  • library(reshape2) を事前に実行しておくこと。melt()に必要。

library(reshape2)
length_graph <- 60 # グラフは過去length_graph日間が対象
l <- 4.76
d <- l+2
nod <- 7

w <- c()
curl <- "https://raw.githubusercontent.com/kaz-ogiwara/covid19/master/data/prefectures.csv"
# curl <- "https://github.com/kaz-ogiwara/covid19/blob/master/data/summary.csv"
cdestfile <- "~/R/R2/covid/pref.csv"
download.file(curl,cdestfile)
w <- read.csv("~/R/R2/covid/pref.csv")
# w <- as.xts(w[,c(5,6)],as.Date(paste(w[,1],w[,2],w[,3],sep='-')))
# とりあえずdata.frameを作って必要なデータを抜きす。
df <- c()
df <- data.frame(t=as.Date(paste(w[,1],w[,2],w[,3],sep='-')),
                r=w[,5],
                p=w[,6])

# データフレームから県名を抜き出し、unique(w[,5])で県名一覧を作る。
# 行列を作成し、各県のデータを抜き出し、順次行列にbindしていく。
i <- 1
mtx <- matrix(diff(df$p[df$r == unique(w[,5])[i]]))
for( i in seq(2,length(unique(w[,5])),1)){
  mtx <- cbind(mtx,diff(df$p[df$r == unique(w[,5])[i]]))
}
# 行列をデータフレームに変換し、そののち日付データを先のデータフレームから抜き出し付加する。
mdf <-as.data.frame(mtx)
mdf <-transform(mdf,t=unique(df$t)[-1])
# データフレームの列名を県名一覧で変更する。
colnames(mdf)[1:length(unique(w[,5]))] <- as.character(unique(w[,5]))

df.melt <- melt(data=mdf, id.vars="t", measure.vars=as.character(unique(w[,5])))
head(df.melt)
df <- df.melt
g <- ggplot(df, aes(x = t, y = value, fill = variable))
g <- g + geom_bar(stat = "identity")


png("04em.png", width = 1400, height = 600)
plot(g)
dev.off()


2020年5月19日火曜日

EPS 2020MAY19


EPS2020MAY13 has a serious problem. where data length should be 12, it has only 11 entries.


~$ tac eps.txt 
3/31/2019 2834.40 $37.99 $35.02 18.52 21.09 $153.05 $134.39
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27
9/30/2019  2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
12/31/2019 3230.78 $39.18 $35.53 20.56 23.16 $157.12 $139.47
3/31/2020 (90.3%) 2584.59 $20.00 $12.56 20.50 24.38 $139.13 $117.01
6/30/2020 $23.66 $21.18 23.26 27.62 $122.65 $103.26
9/30/2020 $31.60 $28.27 24.93 29.24 $114.44 $97.55
12/31/2020 $36.41 $33.57 25.54 29.84 $111.67 $95.59
3/31/2021 $37.29 $33.26 22.12 24.53 $128.96 $116.28
6/30/2021 $38.53 $34.73 19.83 21.97 $143.83 $129.84
9/30/2021 $42.52 $38.61 18.43 20.35 $154.75 $140.17
12/31/2021 $44.80 $40.82 17.49 19.35 $163.14 $147.42

~$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.47
eps_year_xts["2019::"][5] <- 117.01
eps_year_xts["2019::"][6] <- 103.26
eps_year_xts["2019::"][7] <- 97.55
eps_year_xts["2019::"][8] <- 95.59
eps_year_xts["2019::"][9] <- 116.28
eps_year_xts["2019::"][10] <- 129.84
eps_year_xts["2019::"][11] <- 140.17
eps_year_xts["2019::"][12] <- 147.42

2020年5月18日月曜日

Is Jigger & Pony in Singapore

Asia’s Best Bar for 2020 Is Jigger & Pony in Singapore



  1. Jigger & Pony (Singapore)
  2. The Old Man (Hong Kong)
  3. Coa (Hong Kong)
  4. Indulge Experimental Bistro (Taipei)
  5. Atlas (Singapore)
  6. Native (Singapore)
  7. The Bamboo Bar at Mandarin Oriental (Bangkok)
  8. Manhattan (Singapore)
  9. The SG Club (Tokyo)
  10. Aha Saloon (Taipei)
  11. Vesper (Bangkok)
  12. Sober Company (Shanghai)
  13. Bar Mood (Taipei)
  14. Bar Trigona (Kuala Lumpur)
  15. Ben Benfiddich (Tokyo)
  16. Quinary (Hong Kong)
  17. Tippling Club (Singapore)
  18. The Wise King (Hong Kong)
  19. Speak Low (Shanghai)
  20. High Five (Tokyo)
  21. Bee’s Knees (Kyoto)
  22. The Old Man (Singapore)
  23. D.Bespoke (Singapore)
  24. Tropic City (Bangkok)
  25. Gibson (Singapore)
  26. Draft Land (Taipei)
  27. Room by Le Kief (Taipei)
  28. 8 ½ Otto e Mezzo Bombano (Hong Kong)
  29. Charles H (Seoul)
  30. 28 HongKong Street (Singapore)
  31. Rabbit Hole (Bangkok)
  32. Nutmeg & Clove (Singapore)
  33. Backstage Cocktail Bar (Bangkok)
  34. Caprice Bar (Hong Kong)
  35. The Pontiac (Hong Kong)
  36. Hope & Sesame (Guangzhou)
  37. Junglebird (Kuala Lumpur)
  38. The Odd Couple (Shanghai)
  39. Bar Trench (Tokyo)
  40. Sidecar (New Delhi)
  41. Bar Orchard Ginza (Tokyo)
  42. The Curator (Manila)
  43. Union Brasserie, Bakery & Bar (Jakarta)
  44. Lobster Bar & Grill  (Hong Kong)
  45. The Back Room (Manila)
  46. MO Bar (Singapore)
  47. Alice (Seoul)
  48. Coley (Kuala Lumpur)
  49. Le Chamber (Seoul)
  50. Bar Cham (Seoul)



2020年5月13日水曜日

EPS 2020MAY13


> eps_year_xts["2020::"]
             [,1]
2020-01-01 125.55
2020-04-01 112.16
2020-07-01 107.75
2020-10-01 106.97
2021-01-01 119.15
2021-04-01 133.29
2021-07-01 143.24
2021-10-01 150.31

~$ cat eps.txt 
12/31/2021 $45.05 $41.12 17.84 19.84 $164.19 $147.68
9/30/2021 $42.79 $38.61 18.79 20.86 $155.89 $140.44
6/30/2021 $38.88 $34.70 20.21 22.50 $144.98 $130.19
3/31/2021 $37.47 $33.25 22.52 25.31 $130.07 $115.77
12/31/2020 $36.75 $33.89 25.92 30.79 $113.03 $95.16
9/30/2020 $31.88 $28.35 25.38 30.27 $115.46 $96.80
6/30/2020 $23.97 $20.28 23.74 28.60 $123.39 $102.44
3/31/2020 (88.1%) 2584.59 $20.43 $12.64 20.99 25.02 $139.56 $117.09
12/31/2019 3230.78 $39.18 $35.53 20.56 23.16 $157.12 $139.47
9/30/2019  2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27

~$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 135.27
eps_year_xts["2019::"][2] <- 132.90
eps_year_xts["2019::"][3] <- 139.47
eps_year_xts["2019::"][4] <- 117.09
eps_year_xts["2019::"][5] <- 102.44
eps_year_xts["2019::"][6] <- 96.80
eps_year_xts["2019::"][7] <- 95.16
eps_year_xts["2019::"][8] <- 115.77
eps_year_xts["2019::"][9] <- 130.19
eps_year_xts["2019::"][10] <- 140.44
eps_year_xts["2019::"][11] <- 147.68

2020年5月9日土曜日

EPS 2020MAY09



> eps_year_xts["2020::"]
             [,1]
2020-01-01 129.39
2020-04-01 117.62
2020-07-01 113.96
2020-10-01 113.05
2021-01-01 121.56
2021-04-01 133.87
2021-07-01 142.67
2021-10-01 149.17

~$ tac eps.txt 
3/31/2019 2834.40 $37.99 $35.02 18.52 21.09 $153.05 $134.39
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27
9/30/2019  2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
12/31/2019 3230.78 $39.18 $35.53 20.56 23.16 $157.12 $139.47
3/31/2020 (71.8%) 2584.59 $27.89 $21.10 19.25 22.55 $147.02 $125.55
6/30/2020 $24.57 $21.54 21.53 25.24 $131.45 $112.16
9/30/2020 $32.39 $29.58 22.82 26.27 $124.03 $107.75
12/31/2020 $37.09 $34.75 23.21 26.46 $121.94 $106.97
3/31/2021 $37.61 $33.28 21.50 23.76 $131.66 $119.15
6/30/2021 $39.19 $35.68 19.35 21.24 $146.28 $133.29
9/30/2021 $43.07 $39.53 18.03 19.76 $156.96 $143.24
12/31/2021 $45.25 $41.82 17.14 18.83 $165.12 $150.31
~$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.47
eps_year_xts["2019::"][5] <- 125.55
eps_year_xts["2019::"][6] <- 112.16
eps_year_xts["2019::"][7] <- 107.75
eps_year_xts["2019::"][8] <- 106.97
eps_year_xts["2019::"][9] <- 119.15
eps_year_xts["2019::"][10] <- 133.29
eps_year_xts["2019::"][11] <- 143.24
eps_year_xts["2019::"][12] <- 150.31

2020年4月29日水曜日

EPS 2020APR29



> eps_year_xts["2019::"]
             [,1]
2019-01-01 134.39
2019-04-01 135.27
2019-07-01 132.90
2019-10-01 139.47
2020-01-01 138.15
2020-04-01 139.29
2020-07-01 144.62
2020-10-01 149.92
2021-01-01 154.52
2021-04-01 159.07
2021-07-01 163.75
2021-10-01 166.82

~$ tac eps.txt 
3/31/2019 2834.40 $37.99 $35.02 18.52 21.09 $153.05 $134.39
6/30/2019 2941.76 $40.14 $34.93 19.04 21.75 $154.54 $135.27
9/30/2019  2976.74 $39.81 $33.99 19.46 22.40 $152.97 $132.90
12/31/2019 3230.78 $39.18 $35.53 20.56 23.16 $157.12 $139.47
3/31/2020 (27.6%) 2584.59 $31.90 $24.94 18.52 21.62 $151.03 $129.39
6/30/2020 $29.40 $23.16 19.94 23.79 $140.29 $117.62
9/30/2020 $35.66 $30.33 20.55 24.55 $136.14 $113.96
12/31/2020 $39.12 $34.62 20.56 24.75 $136.08 $113.05
3/31/2021 $38.75 $33.45 19.57 23.02 $142.93 $121.56
6/30/2021 $41.34 $35.47 18.07 20.90 $154.87 $133.87
9/30/2021 $44.53 $39.12 17.09 19.61 $163.74 $142.67
12/31/2021 $46.25 $41.13 16.37 18.76 $170.87 $149.17

   
~$ tac eps.txt | awk '{gsub("\\$","",$NF);print "eps_year_xts[\"2019::\"]["NR"] <- "$NF}'
eps_year_xts["2019::"][1] <- 134.39
eps_year_xts["2019::"][2] <- 135.27
eps_year_xts["2019::"][3] <- 132.90
eps_year_xts["2019::"][4] <- 139.47
eps_year_xts["2019::"][5] <- 129.39
eps_year_xts["2019::"][6] <- 117.62
eps_year_xts["2019::"][7] <- 113.96
eps_year_xts["2019::"][8] <- 113.05
eps_year_xts["2019::"][9] <- 121.56
eps_year_xts["2019::"][10] <- 133.87
eps_year_xts["2019::"][11] <- 142.67
eps_year_xts["2019::"][12] <- 149.17

SIR model for R



## Load deSolve package
library(deSolve)

## Create an SIR function
sir <- function(time, state, parameters) {

  with(as.list(c(state, parameters)), {

    dS <- -beta * S * I
    dI <-  beta * S * I - gamma * I
    dR <-                 gamma * I

    return(list(c(dS, dI, dR)))
  })
}

### Set parameters
## Proportion in each compartment: Susceptible 0.999999, Infected 0.000001, Recovered 0
init       <- c(S = 1-1e-6, I = 1e-6, R = 0.0)
## beta: infection parameter; gamma: recovery parameter
parameters <- c(beta = 2.5, gamma = 0.14286)
## Time frame
times      <- seq(0, 70, by = 1)

## Solve using ode (General Solver for Ordinary Differential Equations)
out <- ode(y = init, times = times, func = sir, parms = parameters)
## change to data frame
out <- as.data.frame(out)
## Delete time variable
out$time <- NULL
## Show data

## Plot
matplot(x = times, y = out, type = "l",
        xlab = "Time", ylab = "Susceptible and Recovered", main = "SIR Model",
        lwd = 1, lty = 1, bty = "l", col = 2:4)

## Add legend
legend(40, 0.7, c("Susceptible", "Infected", "Recovered"), pch = 1, col = 2:4, bty = "n")

2020年4月17日金曜日

CLIs for March 2020 : News Release



08/04/2020 - The CLIs for March 2020 recorded the largest drop on record in most major economies in line with the considerable economic shock caused by the COVID-19 pandemic and its immediate impact on production, consumption and confidence in the wake of lockdown measures.

Over the next few months, in particular, care will be needed in interpreting the CLI.

Firstly, with considerable uncertainty around the duration of lockdown measures, the ability of leading indicators to predict future movements in the business cycle has been severely curtailed: current estimates of the CLI are able to provide meaningful signals on current movements in activity, and should therefore be viewed as coincident rather than leading.

Secondly, as always, the magnitude of the CLI decline should not be regarded as a measure of the degree of contraction in economic activity, rather it should be viewed as an indication of the strength of the signal that economies have entered a phase of contraction. For comparison, the signal is stronger now than it was at the time of the Financial Crisis.

Thirdly, the CLIs are not yet able to anticipate the end of the slowdown, especially as it is not yet clear how long, nor indeed severe, lock-down measures are likely to be. However, as the situation settles, even with a more prolonged lockdown, the CLI will begin to recover its ability to predict as firms and consumers begin to adapt to new (even if only short-term) realities, especially as governments begin to formulate and provide signals around longer term strategies, beyond the initial immediate measures they have had to impose.

Download Entire Release