Given the following data, how do i use predict to determine parameters, mean response, and future response with varying confidence intervals?
Consider the following data relating the blood pressure to the age and weight of individuals:
Age (xi1): 23 25 42 55 33 40 61 60 38
Weight(xi2): 162 141 166 150 192 156 181 201 175
Blood pressure (Yi): 125 130 135 126 152 110 148 163 128
(d) Determine the two-sided 95 percent confidence interval for β2.
(e) Estimate the average blood pressure of individuals who are 40 years old and weight160 pounds. Determine the two-sided
90 percent confidence interval for this mean response.
(f) Determine the two-sided 95 percent confidence interval for a given individual who is 55 years old and weighs 170 pounds
(i.e., for the future response).
This is as far as i could manage
clear all
clc
xi1 = [23 25 42 55 33 40 61 60 38]';
xi2 = [162 141 166 150 192 156 181 201 175]';
Y = [125 130 135 126 152 110 148 163 128]';
X =[ones(size(xi1)),xi1,xi2];
B = regress(Y,X)
SSr = (Y.'*Y) - (B.'*X.'*Y)
n = size(X,1);
m = size(X,2);
k = size(X,2) -1;
sigma2 = SSr./(n-k-1)
inverse = (X.'*X)^(-1)
TS = (sqrt(10./SSr).*B(3))./(sqrt(inverse(2,2)))
lm = fitlm(X,Y)
0 Comments
Sign in to comment.