To calculate point-biserial correlattion in R, you can use cor.test() function. The point-biserial correlation coefficient measures the strength and direction of the association between a continuous variable and a binary variable.

The following method shows how you can do it with syntax.

Method: Use cor.test() Function

cor.test(vector1,vector2)


The following example shows how to calculate point-biserial correlation in R.

## Using cor.test() Function

Let’s see how we can calculate point-biserial correlation using cor.test() function.

# Create data frame
df <- data.frame(Machine_name=c("A","B","C","D","E","F","G","H"),
Pressure=c(12.39,11.25,12.15,13.48,13.78,12.89,12.21,12.58),
Status=c(1,1,2,1,2,2,1,2))

# Calculate Point-Biserial Correlation
x <- cor.test(df$Pressure,df$Status)

# Display Point-Biserial Correlation
print(x)


Output:

	Pearson's product-moment correlation

data:  df$Pressure and df$Status
t = 0.90356, df = 6, p-value = 0.401
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.4742473  0.8447437
sample estimates:
cor
0.3460827


Here the output shows Point-Biserial Correlation which calculated using cor.test() function.