# Write Matlab codes to compute the 1-D nonparametric probability density function for a given set…

Write Matlab codes to compute the 1-D nonparametric probability density function for a given set of samples of a random variable. Call this function “KernelDensity.m”. The conceptual background for this procedure is described in the lecture notes. Based on that description, implement your procedure according to the following specifications:

1) Use the Matlab function randn( ) to generate 10,000 samples of a Gaussian random variate with zero mean and unit standard deviation. These samples should be stored in a single column array, x.

2) Your program should scale the sample data internally to the unit interval, [0,1]. This will help to standardize the construction of a grid for the density function as well as the selection of a smoothing parameter, s.

3) Use a uniform grid array, v, of 101 points at which the density is to be estimated. You might find the Matlab function linspace( ) helpful here. For simplicity, confine the grid to the range of data in the scaled sample population.

4) Use a Gaussian-like kernal function,, to weight the contribution of each sample, xj, to the density at vi.

K(V,,.x;,0) = exp[-(x, – v;)? / 20?]

5) Ensure that your estimated density function is properly normalized. In Matlab, this is easily done with the trapz( ) function.

6) Your program should accept three argument: the sample data, x, the smoothing parameter, s, and the number of grid points, M.

(a)Test your program by computing the estimated density function for the 10,000 standard normal samples mentioned above. Try four different values of smoothing parameter: 0.10, 0.05, 0.025, and 0.0125. Plot the resulting density functions on a single plot for easy comparison and be sure to include a legend on the plot so I know which scorresponds to each curve. Comment on your results; in particular, select what you think is the best of the four values of s and say why picked this value.

(b)From your results in (a), what do you think would be the consequence of using a value of s that is too large? Too small?

Calculate the price
Pages (550 words)
\$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with MyhomeworkGeeks
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend