Functions > Data Analysis > Smoothing > Example: Kernel Smoothing
Example: Kernel Smoothing
Use the ksmooth function to smooth a data set.
1. Define a random data set.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Define the bandwidth for the kernel smoothing.
Click to copy this expression
* 
It is important to select the bandwidth carefully. Too large a bandwidth will wash out details as it averages over the whole data set. Too small a bandwidth may create artificial details in the smoothed data.
3. Call the ksmooth function to perform kernel smoothing on the data set.
Click to copy this expression
4. Plot the data set before and after smoothing.
Click to copy this expression
Was this helpful?