WARNING: This post contains an excessive amount of math. If you find math unbearable and/or difficult to understand, do not attempt to read this.
A little bit ago, I decided to combine a New Keynesian model with Rotemberg style pricing and a Cash-Credit goods model. Here is a derivation of that model:
Households
Households maximize
$$ U = E_0 \sum^\infty_{t=0} \beta^t \left(\theta \log c^1_t + (1 - \theta) \log c^2_t - \gamma \log n_t \right) $$
subject to
$$ M_{t-1} + R_{t-1} B_{t-1} + W_t n_t = P_t C_t + B_t + M_t + P_t \tau_t $$
$$ M_t \geq P_t c^1_t $$
$$ C_t = c^1_t + c^2_t $$
Where $c^1_t$ is the part of the consumption good that the household buys in the cash market, $c^2_t$ is the part of the consumption good that the household buys in the credit market, $C_t$ is total spending on the consumption good, $W_t$ is the nominal wage rate, $n_t$ is hours worked by the household, $M_t$ is the nominal money supply, $B_t$ is the supply of government bonds, $P_t$ is the price of the consumption good, and $\tau_t$ is lumps sum taxes/transfers from the government.
The households maximization problem can be written as
$$ \mathcal{L} = U + \lambda^0_t \left(M_{t-1} + R_{t-1} B_{t-1} + W_t n_t - P_t C_t - B_t - M_t - P_t \tau_t \right) + \lambda^1_t \left(M_t - P_t c^1_t \right) + \lambda^2_t\left(C_t - c^1_t - c^2_t \right) $$
Solving the Lagrangian gives the following First Order Conditions:
$$ (1) \: \frac{1}{c^2_t} = \beta E_t \frac{1}{c^2_{t+1}} R_t E_t \frac{P_t}{P_{t+1}} $$
$$ (2) \: \frac{W_t}{P_t} = \frac{\gamma}{1 - \theta} \frac{c^2_t}{n_t} $$
$$ (3) \: \frac{\theta}{c^1_t} = \frac{1-\theta}{c^2_t} \left(2 - \frac{1}{R_t}\right) $$
$$ (4) \: M_t = P_t c^1_t $$
Retail Firms
Retail firms maximize profits, $P_t Y_t - \int^1_0 P_t(i) y_t(i) di $ subject to the production technology $ Y_t = \left[\int^1_0 y_t(i)^\frac{\epsilon-1}{\epsilon}di\right]^\frac{\epsilon}{\epsilon-1} $.
Substituting the production technology into the profit function yields
$$ P_t \left[\int^1_0 y_t(i)^\frac{\epsilon-1}{\epsilon}di\right]^\frac{\epsilon}{\epsilon-1} - \int^1_0 P_t(i) y_t(i) di $$
Taking the derivative of this with respect to $y_t(i)$ gives the retail firm's first order condition:
$$ y_t(i) = Y_t \left(\frac{P_t(i)}{P_t}\right)^{-\epsilon}$$
Since the retail firm is perfectly competitive, its profits are equal to zero. We can therefore set profit equal to zero and plug in the first order condition to get the definition of the price level
$$ P_t^{1-\epsilon} = \int^1_0 P_t(i)^{1-\epsilon} $$
Wholesale Firms
There is a continuum of monopolistically competitive wholesale firm who are subject to the quadratic price adjustment cost
$$ \frac{\varphi}{2}\left(\frac{P_t(i)}{P_{t-1}(i)} - 1 \right)^2 Y_t $$
First, each wholesale firm minimizes total costs, $ \frac{W_t}{P_t} n_t(i) $ subject to the production function $y_t(i) = a_t n_t(i)$. This problem can be set up as
$$ \mathcal{L} = -\frac{W_t}{P_t} n_t + mc_t \left( a_t n_t(i) - y_t(i)\right) $$
which yields
$$ (5) \: \frac{W_t}{P_t} = mc_t n_t(i) $$
The Lagrangian multiplier in this problem is the marginal cost of production (hence the name $mc_t$).
Each retail firm now maximizes the expected sum of all future profits which is discounted by the 'stochastic discount factor' with the real interest rate replacing the time preference rate and is subject to the retail firm's demand function, $ y_t(i) = Y_t \left(\frac{P_t(i)}{P_t(i)}\right)^{-\epsilon}$. Since the maximization problem for this is so obscenely long, I won't write it down, I'll just skip to the first order condition.
$$ 0 = (1-\epsilon)\frac{Y_t}{P_t} + \epsilon mc_t \frac{Y_t}{P_t(i)} - \varphi \left(\frac{P_t(i)}{P_{t-1}(i)} - 1 \right)\frac{Y_t}{P_{t-1}(i)} + \beta E_t \left( \frac {c^2_{t+1}}{c^2_t} \right)^{-1}\varphi \left(\frac{P_{t+1}(i)}{P_t(i)} - 1 \right)\frac{P_{t+1}(i) Y_t}{P_t(i)^2} $$
Consider the fact that, since each firm has the same level of technology, the same demand curve, and the price adjustment costs, every firm chooses the same price. Given this as well as the fact that the rate of inflation, $\pi_t$ is equal to $\frac{P_t}{P_{t-1}}$, the 'New Keynesian Phillips Curve' above can be written as
$$ (6) \: 0 = (1-\epsilon) + \epsilon mc_t - \varphi \pi_t (1 + \pi_t) + \beta E_t \left( \frac {c^2_{t+1}}{c^2_t} \right)^{-1}\varphi\pi_{t+1}(1+\pi_{t+1})\frac{Y_{t+1}}{Y_t} $$
Equilibrium
Equations 1-6 can be combined with a description of government policy to complete this model. The money supply and the wage have been rewritten in real terms.
$$ (1) \: \frac{1}{c^2_t} = \beta E_t \frac{1}{c^2_{t+1}} \frac{R_t}{1 + \pi_{t+1}} $$
$$ (2) \: w_t = \frac{\gamma}{1 - \theta} \frac{c^2_t}{n_t} $$
$$ (3) \: \frac{\theta}{c^1_t} = \frac{1-\theta}{c^2_t} \left(2 - \frac{1}{R_t}\right) $$
$$ (4) \: m_t = c^1_t $$
$$ (5) \: w_t = mc_t n_t $$
$$ (6) \: 0 = (1-\epsilon) + \epsilon mc_t - \varphi \pi_t (1 + \pi_t) +
\beta E_t \left( \frac {c^2_{t+1}}{c^2_t}
\right)^{-1}\varphi\pi_{t+1}(1+\pi_{t+1})\frac{Y_{t+1}}{Y_t} $$
$$ (7) \: \log R_t = \frac{\beta - 1}{\beta} + \phi_\pi \pi_t + \upsilon_t $$
$$ (8) \: \log a_t = \rho \log a_{t-1} + \varepsilon^a_t $$
$$ (9) \: Y_t = C_t + \varphi \pi_t^2 Y_t $$
$$ (10) \: C_t = c^1_t + c^2_t $$
$$ (11) \: \upsilon_t = \rho \upsilon_{t-1} + \varepsilon^i_t; $$
Impulse Response Functions
Here is the impulse response function (in log deviations from steady state) for the technology shock, $\varepsilon^a_t$ where $V$ is the velocity of money:
And here is the impulse response function for the monetart policy shock, $\varepsilon^i_t$: