Building a microeconometrics app in shiny

Hi

I've been a subscriber for a ling time, but this is my first time posting here.

I've been using R the last years for personal projects and some professional tasks (little modeling. Mainly wrangling, cleaning and plotting data).

I'm interested in making a Shiny app to solve microeconometric models. I was an associate teacher of microeconometrics for a time, and in class we solved models with Eviews. It is a nice tool, but if the students wanted more advanced interesting outcomes beyond your average marginal effects, they had to do a bit of programming.

I want to create an app that does that, and is user friendly, and shows a variety of results beyond marginal effects and raw probabilities. For instance, a plot for average probabilities separated by category. Something like this.

And more results and contrasts (Hosmer-Lemeshow, etc.).

I think it would be an interested project and also good to practice with shiny.

My concert is that I'm a beginner with shiny. I've made some projects in different curses, but nothing more. I don't know if this project could be too big for a beginner(actually, my initial goal is to include only logit and probit. If things go ok, I would then include count, multivariate depenent, and censurated and truncated models).

Do you think a project like this is appropiate for a person with experience with R but not too much with shiny?

Regarding, thr project itself, any suggestions are welcome :slight_smile:

2 Likes

Sounds like a good beginner project. I think most people learn by doing and Shiny is great for that.

There are a couple approaches you could consider. You could sketch out what you want the app to look like on a piece of paper. That should help focus your concept and give you a target interface.

Since you are a beginner to Shiny but not R, you may want to write some code that achieves your desired output. Once you’re happy, you could copy your code into reactivate functions, inputs and output. You’re essentially mapping dynamic inputs to your static code. Because this is for students and isn’t a Production-type app, you probably don’t need much in the way of error handling.

Finally you will need to host the app somewhere. The scalability of your app is something you may need to consider from a concurrency perspective. Open source Shiny server is not going to handle 25 concurrent connections. You could host it on your own server if that isn’t an issue, Shinyapps, or just send the code to students.

Hope this helps!

6 Likes

Very good indeed! I’m thinking doing it with public expenditures.

Best and keep going

1 Like

Thanks for the advice :slight_smile:

I've already made a sketch and have a clear Idea in mind. I have begun to code directly in shiny, but I think I'll take your approach and program the "static" parts separately before doing it in Shiny.

I thought about including also some basic exploratory analysis, but I think that would complicate the project, so I think I'm going to focus first in the model itself, and take a modular approach: it the basic project ends well, maybe I add additional features, like exploratory analysis and maybe a learning tool.

2 Likes

Sounds like you have a solid plan in place. Keep in mind that the more dynamic and flexible you want an app to be, the more error handling you need to bake in. People are always going to find clever ways to manipulate your app in ways you didn't expect.

One way to push against this is to use Shiny modules to containerize your code. Think of it like creating a Shiny app as a function. This would allow you to independently write a data exploration module and add it to your existing app with little effort.

1 Like