Create a program in R using vectorized calculation. No use of loops is needed. Make a data frame consisting of 20 and 10 columns. Eachcolumn j should consist of 20 values from a normal distribution with mean (j-1) and standard deviation 0.5j. For example, the third column should be normal(mean=2, sd=1.5). Using this data frame, do each of the following (using code, of course): a. Find the mean and standard deviation for each column.b. Write code that counts the number of columns for which the sample mean and samplestandard deviation are within 20% of the values used to generate the data.c. Write code that writes the columns from part b to a new data frame.d. For each value in the new data frame, subtract its column mean and divide by thecolumn standard deviation.
Correlation
Correlation defines a relationship between two independent variables. It tells the degree to which variables move in relation to each other. When two sets of data are related to each other, there is a correlation between them.
Linear Correlation
A correlation is used to determine the relationships between numerical and categorical variables. In other words, it is an indicator of how things are connected to one another. The correlation analysis is the study of how variables are related.
Regression Analysis
Regression analysis is a statistical method in which it estimates the relationship between a dependent variable and one or more independent variable. In simple terms dependent variable is called as outcome variable and independent variable is called as predictors. Regression analysis is one of the methods to find the trends in data. The independent variable used in Regression analysis is named Predictor variable. It offers data of an associated dependent variable regarding a particular outcome.
Create a program in R using
column j should consist of 20 values from a
a. Find the mean and standard deviation for each column.
b. Write code that counts the number of columns for which the sample mean and sample
standard deviation are within 20% of the values used to generate the data.
c. Write code that writes the columns from part b to a new data frame.
d. For each value in the new data frame, subtract its column mean and divide by the
column standard deviation.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps