Kernel method is one of the most common nonparametric density estimation and recently B-spline is used for estimation of a probability density function. These two methods in some how depend on selecting a smoothing parameter that has an important effect on precision of the estimators. In this paper, we consider kernel and B-spline methods of density estimation and smoothing parameter selection for these two methods. Then, the accuracy of the obtained estimators is compared by their mean square errors. Also, the effect of the number and dispersion of data on precision of estimators are studied. The results show that for a symmetric probability density, if the dispersion of data increases, the precision of both estimators decreases. While, for an asymmetric probability density function, the precision of the estimators increases for dispersion data.