Consider a dataset with a continuous response Y and only one covariate X. We model this dataset by a weighted linear reg
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Consider a dataset with a continuous response Y and only one covariate X. We model this dataset by a weighted linear reg
a is intercept, B is coefficient of covariate X, and 92 is the error variance. (7) The weighted least squares estimates of a and B are â=y-Baw, B = (usai – a)(1 – 9) 2:21 (Wiki – Tw2 N with Iw= Lizi Wix, (8) N Write a function, called bootWLRegCoef, that calculates the standard errors of â and ß, using the bootstrap method and equations (7) and (8). The bootWLRegCoef function have the following features. Arguments: • x is a numeric vector representing the values of covariate X. • y is a numeric vector representing the values of the response and has the same length as x. w is a numeric vector representing the values of the positive weights and has the same length as x. • bootCount is a positive integer representing the number of bootstrap replicates to be used. Computation: • Use the bootstrap method to calculate se(â) and se(f), which are the standard errors of â and Ê respectively. . Return: A numeric vector, where the first element is the bootstrap estimate of se(a), and the second element is the bootstrap estimate of se(B).