This answer is essentially the same as that of Phil Tosteson, written before I saw that post. I also mention a non-Cohen-Macaulay example at the end. If $R$ is Cohen-Macaulay (but not necessarily generated in degree one), then $R$ has associated with it a *canonical module* $\Omega(R)$ which can be graded so its Hilbert function agrees with $(-1)^d p_R(-n)$ for $n$ sufficiently large, where $d$ is the Krull dimension of $R$ or $\Omega(R)$. If $R$ has $n$ generators then it can be regarded as a module over the polynomial ring $A=k[x_1,\dots,x_n]$. One can then define $\Omega(R) = \mathrm{Ext}^{n-d}_A(R,A)$. If $R$ is not Cohen-Macaulay, then there are "correction terms" to the formula $p_R(-n) = (-1)^d\mathrm{HQ}(\Omega(R))$, where $\mathrm{HQ}$ denotes Hilbert quasipolynomial. Namely, $$ p_R(-n) = (-1)^d \sum_{i=0}^d (-1)^i\mathrm{HQ}\left( \mathrm{Ext}^{n-d+i}_A(R,A)\right). $$ (If $R$ is Cohen-Macaulay, then only the term indexed by $i=0$ doesn't vanish.) I don't know where this result is stated in precisely this form, but it is equivalent to Theorem 6.4 of my book *Combinatorics and Commutative Algebra*, second ed. Theorem 8.2 gives an example, stated in terms of Hilbert series rather than Hilbert quasipolynomials.