# HG changeset patch # User uncorrelated zombie # Date 1666827590 -32400 # Node ID 720ed4f3405a355863dacc97339dc065c90043e2 # Parent d52c39e8228a62f46f6a45c518904aee6234d8e5 変数名とチェックボタンのラベルを変更 diff -r d52c39e8228a -r 720ed4f3405a EdgeworthBox.R --- a/EdgeworthBox.R Thu Oct 27 07:21:27 2022 +0900 +++ b/EdgeworthBox.R Thu Oct 27 08:39:50 2022 +0900 @@ -1,4 +1,4 @@ -drawEdgeworthBox <- function(init_A=0.9, init_B=0.3, CC=TRUE, SHP=TRUE, I=TRUE, E=TRUE, CORE=TRUE){ +drawEdgeworthBox <- function(init_A=0.9, init_B=0.3, CC=TRUE, SHP=TRUE, IC_I=TRUE, IC_E=TRUE, CORE=TRUE){ # 経済の財は合計1に固定し、かつそれぞれの配分の最小値を0.01とする modifyParam <- function(g){ g <- max(0.01, g) @@ -212,23 +212,23 @@ } # 初期点を通る無差別曲線を描画 - if(I) drawIDC(initial_goods, names=c(expression(U[1]^I), expression(U[2]^I)), IsCore=CORE) + if(IC_I) drawIDC(initial_goods, names=c(expression(U[1]^I), expression(U[2]^I)), IsCore=CORE) with(equilibrium, { # 均衡を通る無差別曲線を描画 - if(E) drawIDC(goods, col=col, names=c(expression(U[1]^E), expression(U[2]^E))) + if(IC_E) drawIDC(goods, col=col, names=c(expression(U[1]^E), expression(U[2]^E))) xadj <- (par()$usr[2] - par()$usr[1])/50 # 文字表示の位置調整 pch <- 21 # 点の形状(21:丸, 22:四角, 23:菱形, 24:三角,25:逆三角, etc...) # 初期配分を描画 - if(I){ + if(IC_I || SHP){ points(initial_goods["person 1", "g/s A"], initial_goods["person 1", "g/s B"], pch=pch, col="blue", bg="blue") text(initial_goods["person 1", "g/s A"] + xadj, initial_goods["person 1", "g/s B"], expression(I), adj=c(0, 0)) } # 競争均衡点を描画 - if(E){ + if(IC_E || SHP){ points(goods["person 1", "g/s A"], goods["person 1", "g/s B"], pch=pch, col="black", bg="black") text(goods["person 1", "g/s A"] + xadj, goods["person 1", "g/s B"], expression(E), adj=c(0, 0)) } diff -r d52c39e8228a -r 720ed4f3405a app.R --- a/app.R Thu Oct 27 07:21:27 2022 +0900 +++ b/app.R Thu Oct 27 08:39:50 2022 +0900 @@ -19,10 +19,10 @@ min = 0.01, max = 0.99, value = 0.3), - checkboxInput("isI", "Initial Point", TRUE), - checkboxInput("isE", "Equilibrium", TRUE), + checkboxInput("isIC_I", "Indiffrent Curves pass through the Initial Point", TRUE), + checkboxInput("isCore", "Core", TRUE), + checkboxInput("isIC_E", "Indiffrent Curves pass through the Equilibrium", TRUE), checkboxInput("isSHP", "Separating Hyperplane", TRUE), - checkboxInput("isCore", "Core", TRUE), checkboxInput("isCC", "Contract Curve", TRUE) ), @@ -34,7 +34,7 @@ server <- function(input, output) { output$distPlot <- renderPlot({ - drawEdgeworthBox(input$A, input$B, CC=input$isCC, SHP=input$isSHP, I=input$isI, E=input$isE, CORE=input$isCore) + drawEdgeworthBox(input$A, input$B, CC=input$isCC, SHP=input$isSHP, IC_I=input$isIC_I, IC_E=input$isIC_E, CORE=input$isCore) }, width=400, height=400) }