Write a R code for the following
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 11001300. Create third new variable “GPALevel” and assign the value of “GPALevel” as 1 when GPA<=2.8, 2 when 2.83.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.
Below is the R code of operations performed on Stat2Data package.
# Installing the package and loading the data
install.packages("Stat2Data")
library(Stat2Data)
data("SATGPA")
head(SATGPA)
# PART 1) Creating the given three variables
SATGPA$SAT <- SATGPA$MathSAT + SATGPA$VerbalSAT
SATGPA$SATLevel <- ifelse(SATGPA$SAT <= 1100, 1, 2)
SATGPA$GPALevel <- ifelse(SATGPA$GPA <= 2.8, 1, 2)
# Arranging data based on GPALevel and SAT
SATGPA[order(-SATGPA$GPALevel, SATGPA$SAT),]
# PART 2)
# Chi-square test to conclude the two variable SATLevel and GPALevel are independent.
chisq.test(SATGPA$SATLevel, SATGPA$GPALevel, correct = FALSE)
# Pearson's Chi-squared test
# data: SATGPA$SATLevel and SATGPA$GPALevel
# X-squared = 0.050526, df = 1, p-value = 0.8221
# PART 3)
# Finding mean and variance of GPA for each GPALevel.
aggregate(SATGPA$GPA, by = list(SATGPA$GPALevel), FUN = mean)
aggregate(SATGPA$GPA, by = list(SATGPA$GPALevel), FUN = var)
# Correlation matrix of the given dataset
cor(SATGPA)
# PART 4)
# Performing t-test to compare the mean of two given variable.
t.test(SATGPA$MathSAT, SATGPA$VerbalSAT, conf.level = 0.95)
# Welch Two Sample t-test
# data: SATGPA$MathSAT and SATGPA$VerbalSAT
# t = 2.2466, df = 45.753, p-value = 0.02954
# alternative hypothesis: true difference in means is not equal to 0
# 95 percent confidence interval:
# 5.5836 101.9164
# sample estimates:
# mean of x mean of y
# 619.1667 565.4167
Code screenshot
Output screenshot


Write a R code for the following Using the SATGPA data set in Stat2Data package. Test...
A set of data (test scores), can be summarized by a frequency distribution chart. For example, if the list of test scores is: 90 85 100 50 50 85 60 70 55 55 80 95 70 60 95 80 100 75 70 95 90 90 70 95 50 65 85 95 100 65 then the frequency distribution chart looks like the one below: value frequency ------ ------------ 100 3 95 ...
HELP WITH SAS Run the following DATA step to create a SAS data set called ABC_CORP. Create a new sas data set called AGES that contains all the variables in ABC_CORP plus three new variables. One is AGE_ACTUAL, which is the exact age from DOB to January 15, 2005. The second is AGE_TODAY, which is the age as of the date the program is run, rounded to the nearest tenth of the year. The third is AGE, with the fractional...
Exercise 1. For this exercise use the bdims data set from the openintro package. Type ?bdims to read about this data set in the help menu. Of interest are the variables hgt (height in centimeters), wgt (weight in kilograms), and sex (dummy variable with 1-male, 0-female). Since ggplotO requires that a categorical variable be coded as a factor type in R, run the following code: library (openintro) bdíms$sex2 <-factor (bdins$sex, levels-c (0,1), labels=c('F', 'M')) (a) Use ggplot2 to make a...
C. Test scores that are greater than (Round to one decimal place as needed.) X-12 7. Consider a value to be significantly low if its z score less than or equal to 2 or consider a value to be significantly high if its z score is greater than or equal to 2 A data set lists weights (grams) of a type of coin. Those weights have a mean of 5.46596 g and a standard devi 0.06162 g. Identify the weights...
using C geany. Please Dr. exercise # 1 and 2
During the lab: PART I: PROGRAMMING EXERCISES a. Using Geany, write a C program that prompts and asks the user for two assignment marks (al and a2) and two test marks (ti and t2). All four variables are integer variables and are in % (out of 100). You program should display the four marks properly lalebed to check if the input has been successful. b. Next, calculate and display the...
Please write queries based on the following requirements using DML In-Class Data Set. For each question, you are required to submit 1) SQL query code; 2) a screen shot of your query result.You should copy and paste your SQL query code to the word document instead of taking a screenshot of your code. Missing either part for each question will result in 0 for this question. 1.List unique itemclasses stored in my database. 2.List the warehouse number and the number...
(a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table() function. Check the first five rows. (b) Create a new dataframe called tips by randomly sampling 6 records from the dataframe tips_df. Refer to the sample() function documentation. (c) Add a new column to tips called idx as a list ['one', 'two', 'three', 'four', 'five', 'six'] and then later assign it as the index of tips dataframe. Display the dataframe. (d) Create a new...
WRITE THIS PROGRAM IN JAVA CODING ONLY ! Program 1: In Order Using an IF/ELSE IF/ELSE structure, write a program that will prompt the user for three numbers and displays them in ascending order. First, the program will prompt the user for each of the three numbers. Next, find the smallest value of the three. Then decide which of the other two is the next smallest. Then have the program display the three numbers in ascending order. Be sure to...
In C++, Modify the following code of a single linked list, so insted of doing sort insert in descending order, to do it in ascending order: template <class T> void IntSLList<T>::sortInsert(T val) { //if empty the list if (head == 0) { //add as node to head with data as val addToHead(val); } //if not empty else { //create to pointers to the list IntSLLNode<T>...
O test and Chi Square Complete the following exercises individually followed by a discussion and review of your answers your group 1 Neonates gain (on average) 100 grams/wk in the first 4 weeks. A sample of 25 infants given a new nutrition formula gained 112 grams/wk (on average) with a standard deviation = 30 grams. Is this statistically significant? 2. The mean serum cholesterol level of 25 men ages 65-74 is 231, with a sample standard deviation of So. For...