Tag: R
-
Simple code for the probability weighting function according to prospect theory
Prospect theory made its debut back in 1979 and was one of the first major attempts to address empirical deviations from expected utility theory. One of the key ingredients in operationalizing prospect theory involve conversion of probabilities to “weighted probabilities”. It should be noted that while there are more advanced libraries which are designed to…
-
Computing a competitive equilibrium with multiple goods in R
In the previous blog post titled “Computing the demand for multiple goods in R.” I discussed how we can use embedded for loops along with the command solnl() from the NlcOptim package in r to derive multiple demand curves and make comparisons of cross price changes. What we will do now is add a supply side…
-
Computing the demand for multiple goods in R.
Note to reader: If you are new to optimization in R be sure to check out a short video I made on the topic here.The solving of economic models on on the blackboard is very different than programming it. Some things that take getting used to are: In this blog we embark on a journey…
-
Computing dynamic economic models in R for dummies: using deSolve to get qualitative solutions to Euler equations.
Note: A video explaining the content of this blog can be found here The computation of macroeconomic models is one which both fascinates and mystifies new students and scholars in this field. It certainly was a topic which seemed completely inaccessible to me without an advanced knowledge of algorithms and computational expertise. On an outset…
-
Computing A Simple Model of Competitive Equilibrium in R
In the previous posts we have learned how to compute a supply curve and a demand curve. What do we need to do to derive a competitive equilibrium? Before we answer that directly, lets first define what a competitive equilibrium is so to get everyone on the same page. Def: A Competitive Equilibrium CE={x,p} is…
-
Deriving the Supply Curve from the Profit Function in R
In this blog post we will discuss the derivation of a microfounded supply curve in R. Specifically we are interested in seeing how we can compute the supply curve from our firms objective problem. In this case we will consider solving for the supply curve from the following profit function: We note that in this…
-
Deriving the Demand Curve from the Consumer’s Objective Problem in R.
Note: This blog builds off of what was discussed previously here Continuing with our adventures with the NlcOptim package for R we start with trying to use it for deriving useful objects like the demand curve. Since we are economists we’re not going to simply define a downward sloping demand curve, rather we want to…