Regression and Correlation Analysis Leilani Nora Assistant Scientist Introduction to R: Data Management and Statistical Analysis CORRELATION ANALYSIS DATAFRAME : corr.csv • Consider the data for grain yield and N,P,K content of the plant taken from several samples. DATA FRAME:GYNPK Read data file corr.csv > GYNPK <- read.table(“corr.csv",header=T, sep=",") > GYNPK GY14 N P K 1 1678 1.0 0.1 0.4 2 4265 1.2 0.1 0.4 3 2431 1.1 0.1 0.4 4 2431 1.0 0.1 0.4 5 4461 1.2 0.1 0.4 . . . 48 5483 1.7 0.2 0.3
6
Embed
Regression and Correlation Analysis - Regression and Correlation Analysis
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Regression and Correlation
Analysis
Leilani NoraAssistant Scientist
Introduction to R:
Data Management and Statistical
Analysis CORRELATION ANALYSIS
DATAFRAME : corr.csv
• Consider the data for
grain yield and N,P,K
content of the plant taken from several samples.
DATA FRAME:GYNPK
Read data file corr.csv
> GYNPK <- read.table(“corr.csv",header=T,
sep=",")
> GYNPK
GY14 N P K
1 1678 1.0 0.1 0.4
2 4265 1.2 0.1 0.4
3 2431 1.1 0.1 0.4
4 2431 1.0 0.1 0.4
5 4461 1.2 0.1 0.4
. . .
48 5483 1.7 0.2 0.3
Usage
> correlation(x, y=NULL, method=“pearson”,
alternative=“two.sided”,…)
# x and y – table, matrix or vector
# method – “pearson”, “kendall”, “spearman”
# alternative – “two.sided”, “less”, “greater”
CORRELATION ANALYSIS : correlation()
• correlation() obtains the coefficients of correlation and
p-value between all the variables of a data table. The