Multivariate linear regression Determine Confidence Intervals for parameters, mean response, and future response

6 Ansichten (letzte 30 Tage)
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
%% 2. Multivariate Linear Regression
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)

Antworten (1)

Aditya Patil
Aditya Patil am 22 Dez. 2020
You can use Alpha argument in predict function to get confidence intervals. You can also use the coefCI function to get confidence interval of coefficients. See the example below,
load carsmall.mat
mdl = fitlm(Displacement, Horsepower);
ci = coefCI(mdl, 0.05); % 95% confidence interval
[ypred, yci] = predict(mdl, Displacement, 'Alpha', 0.05);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by