Mashinali o‘qitishga kirish Nosirov Xabibullo xikmatullo o‘gli Falsafa doktori (PhD), tret kafedrasi mudiri


There are K = 18 regression coefficients to estimate: nine intercept terms, and nine slope terms. X is an n-element cell array of d -by- K design matrices


Download 1.54 Mb.
bet5/5
Sana02.01.2022
Hajmi1.54 Mb.
#194061
1   2   3   4   5
Bog'liq
Mashinali oqitishga kirish 10-maruza Nosirov Kh

There are K = 18 regression coefficients to estimate: nine intercept terms, and nine slope terms. X is an n-element cell array of d -by- K design matrices.

X = cell(n,1); for i = 1:n X{i} = [eye(d) x(i)*eye(d)]; end [beta,Sigma] = mvregress(X,Y,'algorithm','cwls');

beta contains estimates of the K-dimensional coefficient vector (α1,α2,…,α9,β1,β2,…,β9)′.

Multivariate Regression for Panel Data with Different Slopes

Plot the fitted regression model.

B = [beta(1:d)';beta(d+1:end)']; xx = linspace(.5,3.5)'; fits = [ones(size(xx)),xx]*B; figure; h = plot(x,Y,'x',xx,fits,'-'); for i = 1:d set(h(d+i),'color',get(h(i),'color')); end regions = flu.Properties.VarNames(2:end-1); legend(regions,'Location','NorthWest');

The plot shows that each regression line has a different intercept and slope.

Multivariate Regression With a Single Design Matrix

Load the sample data.

load('flu')

The dataset array flu contains national CDC flu estimates, and nine separate regional estimates based on Google® queries.

Extract the response and predictor data.

Y = double(flu(:,2:end-1)); [n,d] = size(Y); x = flu.WtdILI;

The responses in Y are the nine regional flu estimates. Observations exist for every week over a one-year period, so n = 52. The dimension of the responses corresponds to the regions, so d = 9. The predictors in x are the weekly national flu estimates.

Multivariate Regression With a Single Design Matrix

Create an n -by- P design matrix X. Add a column of ones to include a constant term in the regression.

X = [ones(size(x)),x];

Fit the multivariate regression model yij=αj+βjxij+ϵij,

where i=1,…,n and j=1,…,d, with between-region concurrent correlation COV(ϵij,ϵij)=σjj.

There are 18 regression coefficients to estimate: nine intercept terms, and nine slope terms.

[beta,Sigma,E,CovB,logL] = mvregress(X,Y);

beta contains estimates of the P-by-d coefficient matrix. Sigma contains estimates of the d-by-d variance-covariance matrix for the between-region concurrent correlations. E is a matrix of the residuals. CovB is the estimated variance-covariance matrix of the regression coefficients. logL is the value of the log likelihood objective function after the last iteration.

Multivariate Regression With a Single Design Matrix

Plot the fitted regression model.

B = beta; xx = linspace(.5,3.5)'; fits = [ones(size(xx)),xx]*B;

figure

h = plot(x,Y,'x', xx,fits,'-'); for i = 1:d set(h(d+i),'color',get(h(i),'color'))

end

regions = flu.Properties.VarNames(2:end-1); legend(regions,'Location','NorthWest')

The plot shows that each regression line has a different intercept and slope.


https://www.mathworks.com/help/stats/mvregress.html

Thank you! Contacts Khabibullo Nosirov, Phd Project Manager, Head Of The Department Tashkent University Of Information Technologies named after Muhammad Al-Khwarizmi Radio And Mobile Communications Faculty 100084, Amir Temur 108, Tashkent, Uzbekistan n.khabibullo1990@gmail.com +998 99 811 57 62 (WhatsApp) +998 90 911 57 62 (Telegram) www.tuit.uz www.spacecom.uz www.intras.uz


Download 1.54 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling