AP Statistics

In 2007 the Mars Company claimed that Original Milk Chocolate M&M’s should contain 24% blue, 14% brown, 16% green, 20% orange, 13% red, and 14% yellow M&M’s

RedYellowBlueBrownGreenOrange
??????

Joe Chang is awesome lol jk

RedYellowBlueBrownGreenOrange
636042

Eugene Choi is NOT

RedYellowBlueBrownGreenOrange
960024

Dan Chu (Not Natalie Portman's husband Q.Q)

RedYellowBlueBrownGreenOrange
437115

Tomas Dabsys

RedYellowBlueBrownGreenOrange
536026

Nick De Cesare (Little Ceasar) *caesar

RedYellowBlueBrownGreenOrange
545134

Ryuta Eguchi durrrrrrrrrrrr

RedYellowBlueBrownGreenOrange
712076

Nick Ferraro

RedYellowBlueBrownGreenOrange
1032142

Dan Gonnnnnnnnnnng

RedYellowBlueBrownGreenOrange
1234021

Alex Hurtado (Can we just go another day or something?)

RedYellowBlueBrownGreenOrange
??????

Jonathan Wang Kim

RedYellowBlueBrownGreenOrange
557322

Ethan Liwanag

RedYellowBlueBrownGreenOrange
625062

Joe Love in this club

RedYellowBlueBrownGreenOrange
916042

Russell Mays (Lamblet)

RedYellowBlueBrownGreenOrange
904152

David Oh (AP is better)

RedYellowBlueBrownGreenOrange
944112

Greg Paksun

RedYellowBlueBrownGreenOrange
525045

Christian Romo

RedYellowBlueBrownGreenOrange
255190

<<<<<<<

Alex Sercel (Math-magician)

RedYellowBlueBrownGreenOrange
821335

Steve Shushnar (Professional Statistics Student)

RedYellowBlueBrownGreenOrange
827022

Armen Ter-Zakarian

RedYellowBlueBrownGreenOrange
913151

Eric Verso Supastar

RedYellowBlueBrownGreenOrange
715243

Ted Williams

RedYellowBlueBrownGreenOrange
733171

Some Java code to visualize your outcomes:

Sample.java


public class Sample 
{
	private int x;
	private int n;
	private String name;
	public Sample(String name, int x, int n){
		this.name=name;
		this.setX(x);
		this.setN(n);
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getX() {
		return x;
	}
	public void setN(int n) {
		this.n = n;
	}
	public int getN() {
		return n;
	}
	public double lower(double z){
		return pHat()-z*Math.sqrt(pHat()*(1-pHat())/n);
	}
	public double upper(double z){
		return pHat()+z*Math.sqrt(pHat()*(1-pHat())/n);
	}
	public double pHat(){
		return (double)x/n;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
}

MMIntervals.java

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;


public class BlueMMIntervals extends Applet {
	ArrayList<Sample> observations;
	double z=1.64485363; //90% ci
	double p=.24; 
	public void init(){
		observations = new ArrayList<Sample>();
		observations.add(new Sample ("Joe",19,75));
		observations.add(new Sample ("Eugene",17,72));
		observations.add(new Sample ("Tomas",21,76));
		observations.add(new Sample ("Nick D",22,71));
		observations.add(new Sample ("Ryuta",25,65));
	}
	public void paint(Graphics g){
		int count=0;
		for (int i=0;i<observations.size();i++){
			Sample obs = observations.get(i);
			int left=(int)(1000*obs.lower(z));
			int right=(int)(1000*obs.upper(z));
			int y=50+i*20;
			g.drawLine(left,y,right,y);
			g.drawString(observations.get(i).getName(), left, y);
			if (p>obs.lower(z) && p< obs.upper(z))
				count++;
		}
		g.setColor(Color.RED);
		int expectedP=(int)Math.round(1000*p);
		g.drawLine(expectedP, 40, expectedP, 20*observations.size()+50);
		String message=count+" out of "+observations.size()+" intervals contain "+p;
		message+=" ("+Math.round(100.0*(double)count/observations.size())+"% of the observations)";
		g.setColor(Color.BLUE);
		g.drawString(message, 20, 20);
	}
}