Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The file crickets.txt (available on eCampus) contains data for 15 crickets (use a final variable!). The first column represents the number of chirps per 15

The file crickets.txt (available on eCampus) contains data for 15 crickets (use a final variable!). The first column represents the number of chirps per 15 second (chirp frequency) and the second column represents the temperature.

Part 1 (5 points): Read the data from the file and store it in two arrays, one for the chirp frequency and another for the temperature. Use the method StdDraw.point(x, y) from the library StdDraw.java to draw a scatter plot of the data. Before you plot the points you will need to set the size of the plot and the pen size. To set the size of the plot you need to call the methods StdDraw.setXscale(minX, maxX) and StdDraw.setYscale(minY, maxY) where minX, maxX, minY, and maxY are the minimum and maximum of the chirp frequency and the temperature respectively. To set the pen size use StdDraw.setPenRadius(0.01)

Part 2 (15 points): Now that you have a scatter plot of the data, we can use linear regression to fit a line in this dataset. A simple linear regression is a very useful technique for fitting a straight line. A straight line can be defined by the formula: ?? = ?? ? ?? + ?? where ?? is the slope and ?? is the intercept with ?? ? ????????. For this assignment x is the chirp frequency and y is the temperature. In order to fit a line on the given dataset, you need to find coefficients ?? and ??. To accomplish this using simple linear regression, ?? can be calculated as: ?? = ??????????????????????(??,??) ? ????(??)/????(??) and coefficient ?? can be calculated using formula: ?? = ????????(??) ? ?? ? ????????(??) The sample standard deviation of a variable ?? (????(??)) can be calculated as: ????(??) = ? 1 ?? ? 1 ?(???? ? ????????(??)) 2 ?? ??=1 Where N is the number of samples for the variable. The correlation between two variables x and y can be calculated as: ??????????????????????(??,??) = (? ???????? ?? ??=1 ) ? ?? ? ????????(??) ? ????????(??) (?? ? 1) ? ????(??) ? ????(??) After calculating the slope and intercept for the cricket dataset display the formula in the format ?? = ?? ? ?? + ??

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are Electrophoresis?

Answered: 1 week ago