HW8

.pdf

School

University of New South Wales *

*We aren’t endorsed by this school

Course

2089

Subject

Statistics

Date

Jan 9, 2024

Type

pdf

Pages

14

Uploaded by ElderEnergyFly29

Report
HOMEWORK ASSIGNMENT 8 EGM 3344 Problems from Chapra book chapters 14, 15 Questions answered: 14.1, 14.5, 14.8, 14.11, 14.18, 15.5, 15.6, 15.5 14.1 Given the data 0.90 1.42 1.30 1.55 1.63 1.32 1.35 1.47 1.95 1.66 1.96 1.47 1.92 1.35 1.05 1.85 1.74 1.65 1.78 1.71 2.29 1.82 2.06 2.14 1.27 (a) the mean μ μ = ∑ 𝑎?? ?𝑎???? ÷ number of values = 40.61 25 = 1 .6244 (b) median 𝑀??𝑖𝑎? = ?𝑖???? ?𝑎??? = 1.65 ( c) mode 𝑀??? = ???? ?????? ?𝑎??? = 1 .35 𝑎?? 1.47 The data is multimodal. (d) range ?𝑎??? = ℎ𝑖?ℎ??? − ?????? ?𝑎??? = 2.29 − 0.9 = 1 .39 (e) standard deviation 𝜎 𝜎 = √?𝑎?𝑖𝑎??? ?𝑎?𝑖𝑎??? = 1 ? ∑(? 𝑖 − ??𝑎?) = 0.115184 𝑛 𝑖=1 𝜎 = 0 .339388 (f) variance ?𝑎?𝑖𝑎??? = 1 ? (? 𝑖 − ??𝑎?) = 0 .115184 𝑛 𝑖=1
2 (g) coefficient of variation. ?????𝑖?𝑖??? ?? ?𝑎?𝑖𝑎?𝑖?? = 𝜎 𝜇 × 100% = 0.339388 1.6244 × 100% = 20 .89
3 14.5 Use least-squares regression to fit a straight line Along with the slope and intercept, compute the standard error of the estimate and the correlation coefficient. Plot the data and the regression line. Then repeat the problem, but regress x versus y that is, switch the variables. Interpret your results. SEE MATLAB CODE question145 % Given data x = [0 2 4 6 9 11 12 15 17 19]; y = [5 6 7 6 9 8 8 10 12 12]; % Perform y vs. x regression and calculate statistics [slope_y_vs_x, intercept_y_vs_x, SEE_y_vs_x, r_y_vs_x] = performRegression(x, y); % Perform x vs. y [slope_x_vs_y, intercept_x_vs_y, SEE_x_vs_y, r_x_vs_y] = performRegression(y, x); % results for y vs. x disp( 'y vs. x:' ); fprintf( 'y = %.5fx + %.5f\n' , slope_y_vs_x, intercept_y_vs_x); fprintf( 'SEE: %.4f\n' , SEE_y_vs_x); fprintf( 'r: %.4f\n' , r_y_vs_x); % results for x vs. y disp( 'x vs. y:' ); fprintf( 'x = %.5fy + %.5f\n' , slope_x_vs_y, intercept_x_vs_y); fprintf( 'SEE: %.4f\n' , SEE_x_vs_y); fprintf( 'r: %.4f\n' , r_x_vs_y); % Function to perform regression and calculate statistics function [slope, intercept, SEE, r] = performRegression(x, y) coeff = polyfit(x, y, 1); slope = coeff(1); intercept = coeff(2); y_pred = slope * x + intercept; residuals = y - y_pred; SSR = sum(residuals.^2); SEE = sqrt(SSR / (length(x) - 2)); r = corrcoef(x, y); r = r(1, 2); end >> question145 y vs. x: y = 0.35915x + 4.88812 SEE: 0.8511 r: 0.9449 x vs. y:
4 x = 2.48614y + -11.13494 SEE: 2.2393 r: 0.9449
5 14.8 Beyond the examples in Fig. 14.13, there are other models that can be linearized using transformations. For example, 4 4 x x y e = Linearize this model and use it to estimate a4 and b4 based on the following data. Develop a plot of your fit along with the data. Code: % Given Data x = [0.1 0.2 0.4 0.6 0.9 1.3 1.5 1.7 1.8]; y = [0.75 1.25 1.45 1.25 0.85 0.55 0.35 0.28 0.18]; % Linearized Variables X and Y X = x; Y = log(y./x); % ./ is elementwise division operator p = polyfit(X,Y,1); A = p(2); B = p(1); alpha4 = exp(A); beta4 = B; % print results fprintf( 'Coefficients of fit :- \n\t alpha4 = %.4f \n\t beta4 = %.4f\n' ,alpha4,beta4) % Ploting x_plot = linspace(0.1,1.8); y_plot = alpha4*x_plot.*exp(beta4*x_plot); plot(x,y, '.' ,x_plot,y_plot, '-' ) legend( 'Data Points' , 'Fitted Curve' , 'location' , 'Best' ) ylabel( 'y' ); Output: Coefficients of fit : alpha4 = 9.6618 beta4 = -2.4733 Graph:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help