In: Advanced Math
Using the SATGPA data set in Stat2Data package. Test by using α= .05.
1) Create the following three variables and then print out all the six variables.
Create a new variable “SAT”, which is the sum of MathSAT and VerbalSAT.
Create second new variable “SATLevel”, and assign the value of “SATLevel” as 1 when
SAT<=1100, 2 when 1100<SAT<=1200, 3 when 1200<SAT<=1300, and 4 when
SAT>1300.
Create third new variable “GPALevel” and assign the value of “GPALevel” as 1 when
GPA<=2.8, 2 when 2.8<GPA<=3.3, 3 when 3.3<GPA<=3.5, and 4 when GPA>3.5
Print out all the data in the descending order of their GPALevel and the ascending order of
their SAT when GPALevel is the same.
2) Use the Chi-Square test to conclude if the SATLevel and
GPALevel are independent.
3) Compute the mean and variance of “GPA” for each level of
“GPALevel”, and compute the
correlation matrices for the four variables: MathSAT, VerbalSAT,
GPA and SAT.
4) Do the data provide sufficient evidence to indicate that the
mean of MathSAT is significantly greater
than the mean of VerbalSAT.
5) Test if the proportion of MathSAT greater than VerbalSAT is
0.6.
Demo.java
public class Demo {
public static void main(String[] args) {
Pizza p1 = new Pizza();
p1.setPrice(100.5);
p1.setTitle("Small");
p1.setTypeNumber(1);
p1.display();
Pizza p2 = new Pizza(2, 155.5, "Medium");
p2.display();
}
}
Pizza.java
public class Pizza {
private int typeNumber;
private double price;
private String title;
public Pizza() {
}
public Pizza(int typeNumber, double price, String title) {
super();
this.typeNumber = typeNumber;
this.price = price;
this.title = title;
}
public void display() {
System.out.println( "Pizza [price=" + price + ", title=" + title + ", typeNumber="
+ typeNumber + "]");
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getTypeNumber() {
return typeNumber;
}
public void setTypeNumber(int typeNumber) {
this.typeNumber = typeNumber;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
Output:
Pizza [price=100.5, title=Small, typeNumber=1]
Pizza [price=155.5, title=Medium, typeNumber=2]