11.07.2015 Views

Preface to First Edition - lib

Preface to First Edition - lib

Preface to First Edition - lib

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ANALYSIS USING R 153The results are identical for all practical purposes and we can plot the fittedmixture and a single fitted normal in<strong>to</strong> a his<strong>to</strong>gram of the data using the Rcode which produces Figure 8.7. The dnorm function can be used <strong>to</strong> evaluatethe normal density with given mean and standard deviation, here as estimatedfor the two-components of our mixture model, which are then collapsed in<strong>to</strong>our density estimate f. Clearly the two-component mixture is a far better fitthan a single normal distribution for these data.We can get standard errors for the five parameter estimates by using abootstrap approach (see Efron and Tibshirani, 1993). The original data areslightly perturbed by drawing n out of n observations with replacement andthose artificial replications of the original data are called bootstrap samples.Now, we can fit the mixture for each bootstrap sample and assess the variabilityof the estimates, for example using confidence intervals. Some suitableR code based on the Mclust function follows. <strong>First</strong>, we define a function that,for a bootstrap sample indx, fits a two-component mixture model and returnsˆp and the estimated means (note that we need <strong>to</strong> make sure that we alwaysget an estimate of p, not 1 − p):R> <strong>lib</strong>rary("boot")R> fit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!