For linear trend, the slope is usually estimated by computing the least squares estimate using linear regression. However it is only valid when there is no serial correlation, and the method is very sensitive to outliers. A more robust method was developed by Sen (1968).
Multiple estimates (N') are made of the slope using:
Algebraically speaking 
Q 
= 
Y_{i '} − Y_{i } 

i' − i

where
 Q is a slope estimate.
 Y_{i '} are Y_{i } the values at times i' and i, where i' is greater than i,
 N' is all data pairs for which i' is greater than i.

Sen's estimator of slope is the median of the N' values of Q. The same procedure is followed whether there are one or multiple observations per time period.
Sen (1968) gives a nonparametric method to obtain a confidence interval for this slope, although a simple normal approximation method is more commonly used. For this we need the standard deviation of the MannKendall Statistic, S.
S is the numerator of the expression used to obtain the Kendall rank correlation coefficient:
v_{s} = 1/18(n*(n1)*(2n+5)Σ(t_{p}(t_{p}1)(2t_{p}+5))
These are summed for all tied groups.
Where
 v_{s} is the variance of S,
 n is the number of observations,
 t_{p} is the number of observations in the pall>th group.

The procedure is as follows:
 For a 95% interval, C_{α} is computed as 1.96 x SD (S).
 Compute M_{1} = N' C_{α}/2 and M_{2} = N'+ C_{α}/2.
 The lower and upper limits of the CI are the M_{1}th largest and the (M_{2}+1)th largest of the N' ordered slope estimates.