Memuat
Memuat
Pearson and Spearman Correlation for Psychology
0 views
Measure the strength of the relationship between loneliness score and social media duration with Pearson and Spearman correlation by age group. Pearson correlation measures the strength of the linear relationship between two numeric variables, while Spearman measures a monotonic rank-based relationship. They are used to explore relations among variables before or without a predictive model.

Measure the strength of the relationship between loneliness score and social media duration with Pearson and Spearman correlation by age group.
| Role | Variable | Unit |
|---|---|---|
| Main | Loneliness score | skor |
| Supporting 1 | Age group | - |
| Supporting 2 | Social media duration | jam/hari |
Correlation between Loneliness score and Age group: Pearson r = 0.674 (p < 0.001) and Spearman rho = 0.675; the relationship is positive and strong.
Computed from illustrative synthetic data, not from a real study.
Pearson correlation measures the strength of the linear relationship between two numeric variables, while Spearman measures a monotonic rank-based relationship. They are used to explore relations among variables before or without a predictive model.
Report the coefficient r or rho, p-value, and sample size, then interpret the strength. Remind readers that correlation does not prove causation.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats as st
rng = np.random.default_rng(28)
n = 120
age_group = rng.normal(10, 2, n)
social_media_duration = rng.normal(5, 1, n)
loneliness_score = 2 * age_group + np.exp(0.3 * social_media_duration) + rng.normal(0, 2, n)
r, p = st.pearsonr(age_group, loneliness_score)
rho, p2 = st.spearmanr(social_media_duration, loneliness_score)
print("Pearson X1-Y: r =", round(r, 3), "p =", round(p, 5))
print("Spearman X2-Y: rho =", round(rho, 3), "p =", round(p2, 5))
df = pd.DataFrame({"x1": age_group, "x2": social_media_duration, "y": loneliness_score})
corr = df.corr(method="spearman")
print(corr.round(2))
fig, ax = plt.subplots(1, 2, figsize=(10, 4))
ax[0].scatter(age_group, loneliness_score, s=10); ax[0].set_xlabel("x1"); ax[0].set_ylabel("y")
im = ax[1].imshow(corr, vmin=-1, vmax=1, cmap="coolwarm")
ax[1].set_xticks(range(3)); ax[1].set_xticklabels(corr.columns)
ax[1].set_yticks(range(3)); ax[1].set_yticklabels(corr.columns)
plt.colorbar(im, ax=ax[1])
plt.tight_layout()
plt.show()Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$19
excl. 11% VAT
Duration: 3 working days
Output: Python files + result figures
Deliverables
Package 2 · most chosen
US$53
excl. 11% VAT
Duration: 7 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$116
excl. 11% VAT
Duration: 12-15 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. Pearson and Spearman Correlation is commonly used at this level in Psychology. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output Python gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$19, Package 2 (your data analysis and interpretation) US$53 and Package 3 (full guidance) US$116, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. Python is a trademark of the Python Software Foundation.
Back to Python portfolio