Question

In: Computer Science

1. In R Studio create a plot with two subplots (2 rows, 1 column): a). Display...

1. In R Studio create a plot with two subplots (2 rows, 1 column):

a). Display five Gaussian pdf curves for the six mean/standard deviation pairs (0, 1), (0, 2), (0, 3), (1, 1), (1, 2), (1.3) in the upper subplot using distinct colors for each curve.
b). Repeat the same procedure for corresponding cdfs in the lower plot.

Solutions

Expert Solution

Code snippet:

mean = c(0,0,0,1,1,1)
sd = c(1,2,3,1,2,3)
x = seq(-4,4,length=200) #input data
hx = dnorm(x, mean = 0, sd = 1)
colors <- c("black", "red", "green", "blue", "lightblue","purple")

labels <- c("(0,1)", "(0,2)", "(0,3)", "(1,1)", "(1,2)","(1,3)")

par(mfrow=c(2,1))  #for subplotting

plot(x, hx, type="l", main="pdf curves")

for(i in 2:length(mean)){
lines(x, dnorm(x, mean = mean[i], sd = sd[i]), lwd=2, col=colors[i])
  }

legend("topright", title="pdf distributions",
labels, ncol = 2,fill = 1:6, col=color ,cex = 0.45)

hx1 = pnorm(x, mean = 0, sd = 1)
plot(x, hx1, type="l", xlab="x value",
ylab="Density", main="cdf curves", lty = 1)
for(i in 2:length(mean)){
lines(x, pnorm(x, mean = mean[i], sd = sd[i]), lwd=2, col=colors[i])
  }
legend("topleft", title="cdf distributions",
labels,fill = 1:6, ncol = 2, col=colors,cex = 0.45)


Related Solutions

Use the Galton dataset from the mosaicData package in R STUDIO library(mosaic) Create a scatter plot...
Use the Galton dataset from the mosaicData package in R STUDIO library(mosaic) Create a scatter plot to show the relationship between height against father’s height (x=father, y=height) What relationship did you see? (Use comments to write in your R Markdown file) Separate your plot into facets by sex Add a regression line using the “lm” method to both of your facets Generate a box plot of height by sex. Use the RailTrail data from the mosaicData package library(mosaic) Generate a...
Using R Studio: 1)Use the `mtcars` data (`data(mtcars)`) to answer these questions: a) Which rows of...
Using R Studio: 1)Use the `mtcars` data (`data(mtcars)`) to answer these questions: a) Which rows of the data frame contain cars that weigh more than 4000 pounds (the variable is `wt`, units are 1000 pounds). b) Which cars are these? (*Hint:* since rows are named by car name, use `row.names()`). c) What is the mean displacement (in inches^3^ ) for cars with at least 200 horsepower (`hp`). d) Which car has the highest fuel economy (`mpg`)? e) What was the...
How do you plot continuous versus category in r studio
How do you plot continuous versus category in r studio
1 – Create a webpage that contains a table with exactly three rows and two columns....
1 – Create a webpage that contains a table with exactly three rows and two columns. The first row will contain a table heading containing the name of a US National Park, that spans across all columns. Hint: use the colspan attribute inside the opening th tag Give the table heading an onmouseover that will change the text of the heading when it is moused over to read My Favorites Park! (Hint: use innerHTML). Use onmouseout to change it back....
1 – Create a webpage that contains a table with exactly three rows and two columns....
1 – Create a webpage that contains a table with exactly three rows and two columns. The first row will contain a table heading containing the name of a US National Park, that spans across all columns. Hint: use the colspan attribute inside the opening th tag Give the table heading an onmouseover that will change the text of the heading when it is moused over to read My Favorites Park! (Hint: use innerHTML). Use onmouseout to change it back....
Create and display an XML file in Android studio that has -One edittext box the does...
Create and display an XML file in Android studio that has -One edittext box the does NOT use material design -One edittext box that DOES use material design Provide a “hint” for each, and make sure the string that comprises the hint is referenced from the strings.xml file. Observe the differences in how the hints are displayed. Here is sample code for a material design editText: <android.support.design.widget.TextInputLayout         android:id="@+id/input_layout_price1Text"         android:layout_width="80dp"         android:layout_height="40dp"            >     <EditText             android:id="@+id/price1Text"             android:importantForAutofill="no"...
R-Studio (R Programming Language) 1. How would you create a vector `V` containing the values 0,...
R-Studio (R Programming Language) 1. How would you create a vector `V` containing the values 0, 0.25, 0.5, 0.75, and 1?    ```{r} #insert your code ``` 2. Name the elements of `V`: first, second, middle, fourth, last. Describe two ways of naming elements in `V` ```{r} #insert your code ``` 3. Suppose you keep track of your mileage each time you fill up. At your last 6 fill-ups the mileage was 65311 65624 65908 66219 66499 66821 67145 67447....
Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&... Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&-2&0)],Vector_4=[Column(1&-2&-2)]. Show tha
Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&... Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&-2&0)],Vector_4=[Column(1&-2&-2)]. Show that S={Vector_1,Vector_2,Vector_3,Vector_4} is linearly dependent. Show that Vector_3 can be written as a linear combination of Vector_1,Vector_2 and Vector_4. Show that T={Vector_1,Vector_2,Vector_4} is linearly independent. Show that the set of all linear combinations of vectors from S is the same as the set of all linear combinations of vectors from T.
Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&... Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&-2&0)],Vector_4=[Column(1&-2&-2)]. Show tha
Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&... Let Vector_1=[Column (1 &-2&1)],Vector_2=[Column(2&-1&1)],Vector_3=[Column(-2&-2&0)],Vector_4=[Column(1&-2&-2)]. Show that S={Vector_1,Vector_2,Vector_3,Vector_4} is linearly dependent. Show that Vector_3 can be written as a linear combination of Vector_1,Vector_2 and Vector_4. Show that T={Vector_1,Vector_2,Vector_4} is linearly independent. Show that the set of all linear combinations of vectors from S is the same as the set of all linear combinations of vectors from T.
Use R-Studio to plot this PAIRED SAMPLES T-TEST To motivate citizens to conserve gasoline, the government...
Use R-Studio to plot this PAIRED SAMPLES T-TEST To motivate citizens to conserve gasoline, the government is considering mounting a nationwide conservation campaign. However, before doing so on a national level, it decides to conduct an experiment to evaluate the effectiveness of the campaign. For the experiment, the conservation campaign is conducted in a small but representative geographical area. Twelve families are randomly selected from the area, and the amount of gasoline they use is monitored for 1 month before...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT