I use RDIT and calculate SPI but it doesn’t equal to SPI= (rain-mean)/Sd, Why?

To quantify droughts we need to calculate different indices with different weather and climate variables. The common index of drought is Standardized Precipitation Index (SPI). The SPI drought index is an meteorological drought index which is calculated just by precipitation data. To calculate the SPI, a long-term precipitation record at the desired station is first fitted to a probability distribution (e.g. gamma distribution), which is then transformed into a normal distribution so that the mean SPI is zero (McKee et al., 1993, 1995). The SPI may be computed with different time steps (e.g. 1 month, 3 months, 24 months).

Be Careful, when you don't consider the distribution Function in the calculation of SPI and just using difference between xj (as precipitation of j month) and the mean precipitation amounts, and divide the difference to standard deviation of the precipitation values, you would only calculate Z-Score index. In RDIT, we've used Gamma distribution and you can get further information in AgMerra Drought paper

Guttman (1999) discussed that, if different probability distributions are used to describe an observed series of precipitation, then different SPI values may be obtained. Easy computation of SPI by a user still remains a primary goal, and a secondary goal of the standardization is to select one probability density function for all sites and time scales.