Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edgeworth Box? #2

Open
emraher opened this issue Nov 17, 2020 · 2 comments
Open

Edgeworth Box? #2

emraher opened this issue Nov 17, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@emraher
Copy link

emraher commented Nov 17, 2020

I'm not sure if this is possible but I think it's closely related to #1 (comment).

Having Edgeworth will be nice. Thanks for the package and your efforts.

@R-CoderDotCom R-CoderDotCom added the enhancement New feature or request label Nov 17, 2020
@R-CoderDotCom
Copy link
Owner

Hey there! I also though about creating the Edgeworth box but I think it is difficult to generalize. I mean, I think it is easy to create an Edgeworth box with ggplot2, but to create a function to satisfy all the user needs.

As an example, one could do something like the following:

curve_A <- data.frame(Hmisc::bezier(c(0.9, 3, 9),
                                  c(9, 3, 0.9)))

curve_B <- data.frame(Hmisc::bezier(c(0.1, 4.9, 6),
                                    c(6, 4.9, 0.1)))

p <- ggplot(mapping = aes(x = x, y = y))

for(i in -2:2){
  p <- p + geom_line(data = curve_A + i, lwd = 2)
}

for(i in -2:2){
  p <- p + geom_line(data = curve_B + i, lwd = 2, color = 2)
}

p <- p + theme_classic() + theme(panel.background = element_rect(colour = "black", size = 1))
p

imagen

However, the main problem is that I had to fine tune the values of curve_B. Maybe there is a better way to define the curves...

I will add it to the enhancements list of the Readme.md and I will give it a try when possible. Thanks for your suggestion!

@bangecon
Copy link

Hi. I created a function (and a shiny app) that does some cool things with an Edgeworth Box, assuming a Cobb-Douglass utility function. https://github.com/bangecon/EdgeworthBox
Comments Welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants