# Rstudio | Applied Sciences homework help

Don't use plagiarized sources. Get Your Custom Essay on
Rstudio | Applied Sciences homework help
Just from \$13/Page

Download and go through Week2Part2 video and follow the process I have to demo your dataset. Start from Week2_Part2.R script, change it according to your selected datset from Quiz2. Then submit to this link:

2. A screenshot report showing the outputs from your rstudio after executing all activities.

Week2_Part2.R script:

getwd()

# Import test data

#A 5-number summary is a set of 5 descriptive statistics for summarizing a continuous univariate data set.

#It consists of the data set’s: minimum, 1st quartile, median, 3rd quartile, maximum

#Find the set, L, of data below the median. The 1st quartile is the median of L.

#Find the set, U, of data above the median. The 3rd quartile is the median of U.

print(summary(data))

print(summary(anscombe))

sd(anscombe\$X)

var(anscombe\$X)

sd(anscombe\$x1)

var(anscombe\$x1)

sd(anscombe\$x2)

var(anscombe\$x2)

sd(anscombe\$x3)

var(anscombe\$x3)

sd(anscombe\$x4)

var(anscombe\$x4)

sd(anscombe\$y1)

var(anscombe\$y1)

sd(anscombe\$y2)

var(anscombe\$y2)

sd(anscombe\$y3)

var(anscombe\$y3)

##– now some “magic” to do the 4 regressions in a loop:

ff <- y ~ x

mods <- setNames(as.list(1:4), paste0(“lm”, 1:4))

for(i in 1:4) {

ff[2:3] <- lapply(paste0(c(“y”,”x”), i), as.name)

## or ff[[2]] <- as.name(paste0(“y”, i))

## ff[[3]] <- as.name(paste0(“x”, i))

mods[[i]] <- lmi <- lm(ff, data = anscombe)

print(anova(lmi))

}

## See how close they are (numerically!)

sapply(mods, coef)

lapply(mods, function(fm) coef(summary(fm)))

## Now, do what you should have done in the first place: PLOTS

op <- par(mfrow = c(2, 2), mar = 0.1+c(4,4,1,1), oma = c(0, 0, 2, 0))

for(i in 1:4) {

ff[2:3] <- lapply(paste0(c(“y”,”x”), i), as.name)

plot(ff, data = anscombe, col = “red”, pch = 21, bg = “orange”, cex = 1.2,

xlim = c(3, 19), ylim = c(3, 13))

abline(mods[[i]], col = “blue”)

}

mtext(“Anscombe’s 4 Regression data sets”, outer = TRUE, cex = 1.5)

par(op)

plot(sort(data\$num_of_orders))

hist(sort(data\$num_of_orders))

plot(density(sort(data\$num_of_orders)))

plot(sort(data\$gender))

hist(sort(data\$sales_total))

plot(density(sort(data\$sales_total)))

library(lattice)

densityplot(data\$num_of_orders)

# top plot

# bottom plot as log10 is actually

# easier to read, but this plot is in natural log

densityplot(log(data\$num_of_orders))

densityplot(data\$sales_total)

densityplot(log(data\$sales_total))

hist(data\$sales_total, breaks=100, main=”Sales total”,

xlab=”sales”, col=”gray”)

# draw a line for the media

abline(v = median(data\$sales_total), col = “magenta”, lwd = 4)

# use rug() function to see the actual datapoints

rug(data\$sales_total)

#Boxplots can be created for individual variables or for variables by group.

#The format is boxplot(x, data=), where x is a formula and data= denotes the data frame providing

#the data.

boxplot(data\$sales_total,data=data, main=”Dis by Sales”,

xlab=”Sales”, ylab=”Total”)

# Boxplot of MPG by Car Cylinders, using one of R built-in datasets

boxplot(mpg~cyl,data=mtcars, main=”Car Milage Data”,

xlab=”Number of Cylinders”, ylab=”Miles Per Gallon”)

#in our boxplot above, we might want to draw a horizontal line at 12 where the national standard is.

abline(h = 12)

boxplot(data\$sales_total,data=data, main=”Total sales Bplot”,

xlab=”Sales”, ylab=”Total”)

# Dot chart of a single numeric vector

dotchart(mtcars\$mpg, labels = row.names(mtcars),

cex = 0.6, xlab = “mpg”)

#install.packages(“ROCR”)

#library(ROCR)

# Simple Scatterplot

attach(mtcars)

plot(wt, mpg, main=”Scatterplot Example”,

xlab=”Car Weight “, ylab=”Miles Per Gallon “, pch=19)

#The R function abline() can be used to add vertical, horizontal or regression lines to a graph

plot(data\$sales_total, data\$gender)

abline(lm(data\$sales_total~ data\$num_of_orders), col=”red”) # regression line (y~x)

lines(lowess(data\$sales_total, data\$num_of_orders), col=”blue”) # lowess line (x,y)

# Basic Scatterplot Matrix

pairs(data)

pairs(data[0:2])

# Scatterplot Matrices from the car Package

install.packages(“car”)

library(car)

install.packages(“ggplot2”)

library(ggplot2)

quit()

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.