tailieunhanh - Computational Statistics Handbook with MATLAB phần 6

Điều này có thể dễ dàng mã hóa trong MATLAB bằng cách sử dụng các kết quả trước đó và là trái như một bài tập cho người đọcLoại thứ hai của khoảng tin cậy bằng cách sử dụng bootstrap được gọi là bootstrap-t. Chúng tôi đầu tiên tạo ra các mẫu bootstrap B, và được tính cho mỗi mẫu bootstrap số lượng như sau: | 0 - - - - - - 0 2 3 -3 -2 -1 FIGURE . We obtain the above kernel density estimate for n 10 random variables. A weighted kernel is centered at each data point and the curves are averaged together to obtain the estimate. Note that there are two bumps where there is a higher concentration of smaller densities. -4 4 Notice that the places where there are more curves or kernels yield bumps in the final estimate. An alternative implementation is discussed in the exercises. PROCEDURE - UNIVARIATE KERNEL 1. Choose a kernel a smoothing parameter h and the domain the set of x values over which to evaluate f x . 2. For each Xi evaluate the following kernel at all x in the domain Ki K x - Xi h J i 1 . n . The result from this is a set of n curves one for each data point Xi. 3. Weight each curve by 1 h . 4. For each x take the average of the weighted curves. 2002 by Chapman Hall CRC Example In this example we show how to obtain the kernel density estimate for a data set using the standard normal density as our kernel. We use the procedure outlined above. The resulting probability density estimate is shown in Figure . Generate standard normal random variables. n 10 data randn 1 n We will get the density estimate at these x values. x linspace -4 4 50 fhat zeros size x h nA -1 5 hold on for i 1 n get each kernel function evaluated at x centered at data f exp - 1 2 hA2 x-data i .A2 sqrt 2 pi h plot x f n h fhat fhat f n end plot x fhat hold off As in the histogram the parameter h determines the amount of smoothing we have in the estimate fKer x . In kernel density estimation the h is usually called the window width. A small value of h yields a rough curve while a large value of h yields a smoother curve. This is illustrated in Figure where we show kernel density estimates fKer x at various window widths. Notice that when the window width is small we get a lot of noise or spurious structure in the estimate. When the window width is

TỪ KHÓA LIÊN QUAN