Let $M$ be a finitely presented module over the ring $R$. Suppose that for all primes $P\subset R$ the $k(P)$ vector space $M\otimes \_Rk(P)$ has a dimension $d(P)$ independent of $P$.  

 Can I conclude that $M$ is flat over $R$?  

I am asking because I want to better understand the criterion for a family of projective schemes to be flat over some base in terms of invariance of their Hilbert polynomial.  

I checked some examples. 
For example let $M$ be the ideal of a point $P$ of an affine curve $C$.  

Here $d(P)$ is the dimension of the Zariski tangent space of $C$at $P$ so that the proposed criterion for flatness holds. 



Flatness from constancy of dimension of fibers
Yes if $R$ is *reduced* (no nilpotent elements). This is (for instance) Lemma 1 p. 51 in Mumford's *Abelian Varieties* (2nd edition). No in general: just take $R=k[\varepsilon ]/(\varepsilon ^2)$, $M=k$. 


