Mashinali o‘qitishga kirish Nosirov Xabibullo xikmatullo o‘gli Falsafa doktori (PhD), TRET kafedrasi mudiri Ko‘p o‘zgaruvchili chiziqli regressiya Nosirov Xabibullo xikmatullo o‘gli Falsafa doktori (PhD), Dotsent, TRET kafedrasi mudiri % Calculating the regression coefficient close all x = linspace(0,1,100); % Data from your first column/independent variable y = x + rand(1, length(x)); % Data from your second column/dependent variable yhat = mean(y); xhat = mean(x); % Compute regression coefficients in the least-square sense b = (x - xhat)*(y' - yhat)/sum((x - xhat).^2); % Regression coefficient a = yhat - b*xhat; % Y-intercept figure() scatter(x, y); hold on plot(x, a + b*x, 'r'); legend(['b = ' num2str(b)]); % Your regression coefficient is b
Do'stlaringiz bilan baham: |