Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Mean and median. One of the most basic tasks in statistics is to summarize a set of observations x1,x2,,xnR by a single number. Two popular choices for this summary statistic are:

• The median, which we’ll callμ1

• The mean, which we’ll callμ2

(a) Show that the median is the value of μthat minimizes the function

i|xi-μ|

You can assume for simplicity that is odd. (Hint: Show that for any , the function decreases if you move either slightly to the left or slightly to the right.)

(b) Show that the mean is the value of μ that minimizes the function

i(xi-μ)2

One way to do this is by calculus. Another method is to prove that for any μR,

i(xi-μ)2=i(xi-μ2)2+n(μ-μ2)2

Notice how the function for μ2 penalizes points that are far from much more heavily than the function for μ1 . Thus μ2 tries much harder to be close to all the observations. This might sound like a good thing at some level, but it is statistically undesirable because just a few outliers can severely throw off the estimate of μ2 . It is therefore sometimes said that μ1 is a more robust estimator than μ2 . Worse than either of them, however, is μ , the value of μthat minimizes the function

maxi|xi-μ|

(c) Show that μ can be computed in O(n) time (assuming the numbers are xismall enough that basic arithmetic operations on them take unit time).

Short Answer

Expert verified
  1. It can be shown that the median is the value of μ that minimizes the function ixi-μ.
  2. It can be shown that the median is the value of μ that minimizes the function ixi-μ2.
  3. Yes, the μcan be computed in O (n) time.

Step by step solution

01

Explain Mean and Median

Mean is the average of all the numbers divided by the total number of the numbers counted. Median is the middle value of the list of the numbers counted for median.

02

Step 2: Show that the median is the value of   that minimizes the given function

(a)

Consider that theμ'μ1.From the context of a sorted array, there are either more elements to the left μ' or to the right. Modify μ' to be the element to the right or left , one of the option makes the function described smaller.

If μ'is moved to the element to the left of it by the amount K. This makes the net difference to the function must either go up or down because μ'shifted K away from either more or less elements than it shifted K closer to.

By symmetry, Apply this argument to shifting to the right. One of these shifts must increase the function, and the other shift decrease the function.

Therefore, distinctly minimizes the function.

03

Step 3: Show that the mean is the value of  μ that minimizes the ∑i(xi-μ)2 function

(b) Consider the given function and expand it accordingly.

inxi-μ2=inxi-μ2+μ-μ22=inxi-μ22+2xi-μ2μ-μ2+μ-μ22=in(xi-μ2)2+n(μ-μ2)2+2(μ-μ2)in(xi)-2=in(xi-μ2)2+n(μ-μ2)2

Therefore, the given function can be minimized as above.

04

Step 4: Show that μ∞  can be computed in O(n)  time

(c)

Consider that the numbers xi are small that the basic arithmetic operations take unit time.

The μ,can be computed as follows.

μ=min(xi)+(max(xi)-min(xi))2

The above computation takes the O(n) time since the basic arithmetic operations in the computation takes unit time.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Question: An Eulerian tourin an undirected graph is a cycle that is allowed to pass through each vertex multiple times, but must use each edge exactly once.

This simple concept was used by Euler in to solve the famous Konigsberg bridge problem, which launched the field of graph theory. The city of Konigsberg (now called Kaliningrad, in western Russia) is the meeting point of two rivers with a small island in the middle. There are seven bridges across the rivers, and a popular recreational question of the time was to determine whether it is possible to perform a tour in which each bridge is crossed exactly once. Euler formulated the relevant information as a graph with four nodes (denoting land masses) and seven edges (denoting bridges), as shown here.

Notice an unusual feature of this problem: multiple edges between certain pairs of nodes.

(a) Show that an undirected graph has an Eulerian tour if and only if all its vertices have even degree. Conclude that there is no Eulerian tour of the Konigsberg bridges.

(b) An Eulerian pathis a path which uses each edge exactly once. Can you give a similar if-and-only-if characterization of which undirected graphs have Eulerian paths?

(c) Can you give an analog of part (a) for directedgraphs?

|ψ=12|00+12|11is one of the famous “Bell states,” a highly entangled state of its two qubits. In this question we examine some of its strange properties. (a) Suppose this Bell state could be decomposed as the (tensor) product of two qubits (recall the box on page ), the first in state α0|0+α1|1and the second in stateβ0|0+β1|1. Write four equations that the amplitudes α0,α1,β0andβ1must satisfy. Conclude that the Bell state cannot be so decomposed.

(b) What is the result of measuring the first qubit of |ψ?

(c) What is the result of measuring the second qubit after measuring the first qubit? (d) If the two qubits in state|ψ are very far from each other, can you see why the answer to (c) is surprising?

Question: 0.1. In each of the following situations, indicate whether f=O(g),orf=Ω(g),or both (in which case f=(g))

Show that, if c is a positive real number, then g(n) = 1 + c + c2 + · · · + cn is:

(a) Θ(1) if c < 1.

(b) Θ(n) if c = 1.

(c) Θ(cn) if c > 1.

The moral: in big-Θ terms, the sum of a geometric series is simply the first term if the series is strictly decreasing, the last term if the series is strictly increasing, or the number of terms if the series is unchanging.

Alice wants to throw a party and is deciding whom to call. She has n people to choose from, and she has made up a list of which pairs of these people know each other. She wants to pick as many people as possible, subject to two constraints: at the party, each person should have at least five other people whom they know and five other people whom they don’t know. Give an efficient algorithm that takes as input the list of n people and the list of pairs who know each other and outputs the best choice of party invitees. Give the running time in terms of n

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free