Imagine we have collected a dataset containing a covariate X and a response Y, assuming they are both continuous. We wou
Posted: Thu Jan 13, 2022 5:46 am
. K is the number of Gaussian distributions in the mixture model. u= (41.....K), where is the mean of the 4th Gaussian distribution. o = (01,...,OK), where is the standard deviation of the kith Gaussian distribution. • 1 = (T1,..., AK), where k is the probability that an observation is generated from the kth Gaussian distribution. Hence, probability density function of X follows K f(x; 7,4,6) = N(4,0%), (10) k=1 where N (40) is the likelihood function of the lith Gaussian distribution. To account for the uncertainty associated with X, we consider the modified version of the MLEs of Bo and B1 defined by equations (11)-(13) below. Bo=y-Bjā', (11) B = Li-1 (0-7)(yi - y) (12) ΣΕ (- ')2 with ****$(|, , 02)dx S+(x[7,4, 02)dt and (13) . Write a function, called boot UncertReg, that calculates the standard errors of Bo and ŝi, using the bootstrap method and equations (11)-(13). The bootUncertReg function have the following features. Arguments: .X is a numeric vector representing the values of covariate X. • mu is a numeric vector containing the means =(M1, ..., UK) of the Gaussian mixture model. • sigma is a numeric vector containing the standard deviations o = (01,...,OK) of the Gaussian mixture model. pi is a numeric vector representing = (T1,..., TK). eta is a positive numeric value representing n in equation (13). • bootCount is a positive integer representing the number of bootstrap replicates to be used. • tiCount is a positive integer representing the number of equal size sub-intervals for evaluating the integral in equation (13) using the trapezoidal rule. Computation: Use the bootstrap method to calculate se(Bo) and sel B1), which are the standard errors of Bo and ſi respectively. IMPORTANT: You must use the trapezoidal rule in Section 2 Question 2 of Assignment 1' to evaluate the integral in equation (13) for your calculations to be considered correct. Return: • A numeric vector, where the first element is the standard error of se(Bo), and the second element is the standard error of se(81).