open resource: check it out!
A simple R script to create and analyze a data file:part two: A tutorial by D.M. Wiig
In part one I discussed creating a simple data file containing the height and weight of 10 subjects. In part two I will discuss the script needed to create a simple scatter diagram of the data and perform a basic Pearson correlation. Before attempting to continue the script in this tutorial make sure that you have created and save the data file as discussed in part one.
To conduct a correlation/regression analysis of the data we want to first view a simple scatter plot. Load a library named ‘car’ into R memory. Use the command:
Then issue the following command to plot the graph:
> plot(Height~Weight, log=”xy”, data=Sampledatafile)
The output is seen below:
We can calculate a Pearson’s Product Moment correlation coefficient by using the command:
> # Pearson rank-order…
View original post 214 more words