F01.justanswer.com



2) Load the comma delimited SATScores.csv file posted on Blackboard into SAS and R. This data set presents 300 student’s various SAT scores, their sex, and their college choice (numbered 1 – 6; note, the numbers do not represent any particular college). Copy all graphs into your solutions.a) In SAS, create a histogram of the total SAT score. Again, please appropriately title and label this graph. Using what you learned this week, now get the tick marks in the right place (at the lower class limit of each bar (or every other bar)). Also, make the bar color different. Lastly, edit the y-axis so you see a tick mark every 10 students and add GRID lines.b) In SAS, add a normal density curve around the bars of the above histogram and present this as a separate graph from part (a). Make this line solid, green, and a little thicker.c) In SAS, create multiple box plots to compare SAT Math scores among the six college choices. Again, please appropriately title and label this graph. Explore editing the symbols, colors, and lines and present a graph that is different than the one you did last week.d) In R, create a scatter plot of SAT Math (on x) vs. SAT Verbal (on y). Again, please appropriately title and label this graph. Change the symbols to solid dots and make them slightly smaller and red. Add a reference line at SAT Math = 500 and SAT Verbal = 500. Make the lines gray, dashed and slightly thicker.e) In R, create multiple box plots to compare SAT Math and SAT Verbal scores among Males and Females. Again, please appropriately title and label this graph. Use a method in R to panel these graphs. Also, explore editing the look, fill color and symbols of the box plots.SAS Codesdata sat;infile 'C:\Users\***********\SAT\SATscores(2).csv' dlm=',' firstobs =2 ;input College :2. Sex :$2 Verbal :4 Math :4 Total :5;run;proc contents data=sat;run;/*Part A*/ods graphics on;proc univariate data = sat noprint;title 'Histogram for Total SAT Scores';histogram total / grid lgrid=2 vscale=count vaxis=0 to 70 by 10 vminor=1;run;/*Part A - Bar Color */ods graphics off;proc template ;define style Styles.newstyle;parent = Styles.statistical;style GraphDataDefault from GraphDataDefault /Color = cx00FF00;end;run;ods graphics on / reset = all imagename= "ovals" width = 3in height = 2in ;ods html style = styles.default;ods listing style = styles.newstyle gpath ="C:\Program Files\SASHome\Graph\V9\Images" dpi = 1000;goptions reset=all border;ods graphics off;proc univariate data = sat noprint;title 'Histogram for Total SAT Scores';histogram total / grid lgrid=2 vscale=count vaxis=0 to 70 by 10 vminor=1;run;/*Part B*/goptions reset=goptions;proc univariate data = sat noprint;title 'Histogram for Total SAT Scores With Density Curve';histogram total / NORMAL (color=green) grid lgrid=2 vscale=count vaxis=0 to 70 by 10 vminor=1 ;run;/*Part C*/title 'Box Plot for Math SAT Scores by College';proc boxplot data=sat;plot Math*College/boxstyle= SKELETAL cboxes= green cboxfill= yellow;run;#reading data into Rdata = read.csv(file="SATScores(2).csv", header=TRUE, sep=',')head(data)attach(data)#part Dplot(x=Math, y=Verbal, main='Scatter Plot for Math against English SAS Scores' ,ylab="Verbal SAS Scores", xlab='Math SAT Scores', col="red", cex=0.5, pch=19)abline(v = 500, h = 500, col = "gray", lty = "dotted", lwd=4)#Part Elibrary(ggplot2)library(ggpubr)require(magrittr)e1 <- ggplot(data, aes(x = Sex, y = Math))e1 + geom_boxplot()k1<- e1 + geom_boxplot(aes(color = Sex))+ scale_color_manual(values = c("#00AFBB", "#E7B800"))+ ggtitle("Box Plot for SAT Math By Sex")e2 <- ggplot(data, aes(x = Sex, y = Verbal))e2 + geom_boxplot()k2<- e2 + geom_boxplot(aes(color = Sex))+ scale_color_manual(values = c("#FF3300", "#9933FF"))+ ggtitle("Box Plot for SAT Verbal By Sex")#Panel Plotggarrange(k1, k2 + rremove("x.text"), labels = c("A", "B"), ncol = 2, nrow = 1) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download