Write a program that graphically plots a regression line-that is, the line with the best

Chapter 8, Problem 13

(choose chapter or problem)

Write a program that graphically plots a regression line-that is, the line with the best fit through a collection of points. First ask the user to specify the data points by clicking on them in a graphics window. To find the end of input, place a small rectangle labeled "Done" in the lower-left comer of the window; the program will stop gathering points when the user clicks inside that rectangle. The regression line is the line with the following equation: y=y + m(x - x) where L XiYi - nxy m = ------==--------:-- L x - nx2 x is the mean of the x-values, y is the mean of the y-values, and n is the number of points. As the user clicks on points, the program should draw them in the graphics window and keep track of the count of input values and the running sum of x, y, x2, and xy values. When the user clicks inside the "Done" rectangle, the program then computes the value of y (using the equations above) corresponding to the x values at the left and right edges of the window to compute the endpoints of the regression line spanning the window. Mer the line is drawn, the program will pause for another mouse click before closing the window and quitting.

Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.

Becoming a subscriber
Or look for another answer

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back