Skip to content

Commit ed58115

Browse files
committedAug 2, 2024
parsa composed ppmcc:v1 and ppmcc:v2
1 parent 8faa157 commit ed58115

File tree

10 files changed

+300
-70
lines changed

10 files changed

+300
-70
lines changed
 

‎.gitignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# the clean.py script
2-
clean.py
1+
## Julia stuff
2+
*.jl.cov
3+
*.jl.*.cov
4+
*.jl.mem
5+
deps/deps.jl
36

47
# Byte-compiled / optimized / DLL files
58
__pycache__/

‎correlation-analysis-techniques/PPMCC/Manifest.toml

-56
This file was deleted.

‎correlation-analysis-techniques/PPMCC/Project.toml

-7
This file was deleted.

‎correlation-analysis-techniques/PPMCC/src/PPMCC.jl

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name = "ppmcc"
2+
uuid = "64e3ba1c-fcbe-4a0c-824e-8c0982845989"
3+
authors = ["parsaizme "]
4+
version = "0.1.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using Statistics
2+
3+
function analyze_concrete_data()
4+
# Data
5+
temperature = [15, 16, 18, 22, 14, 25, 17, 28, 30, 26]
6+
days = [21, 20, 18, 16, 24, 15, 18, 14, 12, 14]
7+
8+
# (i) Compute Pearson's product moment correlation coefficient
9+
mean_temp = mean(temperature)
10+
mean_days = mean(days)
11+
12+
numerator = sum((temperature .- mean_temp) .* (days .- mean_days))
13+
denominator = sqrt(sum((temperature .- mean_temp).^2) * sum((days .- mean_days).^2))
14+
15+
r = numerator / denominator
16+
17+
println("(i) Pearson's correlation coefficient r = ", round(r, digits=4))
18+
19+
if r < -0.8
20+
println("There is a strong negative correlation between temperature and drying time.")
21+
elseif r < -0.5
22+
println("There is a moderate negative correlation between temperature and drying time.")
23+
elseif r < 0
24+
println("There is a weak negative correlation between temperature and drying time.")
25+
elseif r == 0
26+
println("There is no linear correlation between temperature and drying time.")
27+
elseif r <= 0.5
28+
println("There is a weak positive correlation between temperature and drying time.")
29+
elseif r <= 0.8
30+
println("There is a moderate positive correlation between temperature and drying time.")
31+
else
32+
println("There is a strong positive correlation between temperature and drying time.")
33+
end
34+
35+
# (ii) Calculate the regression equation of time on temperature
36+
b = r * (std(days) / std(temperature))
37+
a = mean_days - b * mean_temp
38+
39+
println("\n(ii) Regression equation:")
40+
println("Time = ", round(a, digits=2), " + (", round(b, digits=2), " * Temperature)")
41+
42+
# (iii) Estimate drying time for temperature of 23°C
43+
estimated_time = a + b * 23
44+
45+
println("\n(iii) Estimated drying time for 23°C:")
46+
println(round(estimated_time, digits=2), " days")
47+
end
48+
49+
# Run the analysis
50+
analyze_concrete_data()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.10.4"
4+
manifest_format = "2.0"
5+
project_hash = "7677a93b3dc63550c765af9907adbc2728be55b9"
6+
7+
[[deps.ArgTools]]
8+
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
9+
version = "1.1.1"
10+
11+
[[deps.Artifacts]]
12+
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
13+
14+
[[deps.Base64]]
15+
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
16+
17+
[[deps.CompilerSupportLibraries_jll]]
18+
deps = ["Artifacts", "Libdl"]
19+
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
20+
version = "1.1.1+0"
21+
22+
[[deps.Dates]]
23+
deps = ["Printf"]
24+
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
25+
26+
[[deps.Downloads]]
27+
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
28+
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
29+
version = "1.6.0"
30+
31+
[[deps.FileWatching]]
32+
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
33+
34+
[[deps.Glob]]
35+
git-tree-sha1 = "97285bbd5230dd766e9ef6749b80fc617126d496"
36+
uuid = "c27321d9-0574-5035-807b-f59d2c89b15c"
37+
version = "1.3.1"
38+
39+
[[deps.InteractiveUtils]]
40+
deps = ["Markdown"]
41+
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
42+
43+
[[deps.LazyArtifacts]]
44+
deps = ["Artifacts", "Pkg"]
45+
uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
46+
47+
[[deps.LibCURL]]
48+
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
49+
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
50+
version = "0.6.4"
51+
52+
[[deps.LibCURL_jll]]
53+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
54+
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
55+
version = "8.4.0+0"
56+
57+
[[deps.LibGit2]]
58+
deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"]
59+
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
60+
61+
[[deps.LibGit2_jll]]
62+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"]
63+
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
64+
version = "1.6.4+0"
65+
66+
[[deps.LibSSH2_jll]]
67+
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
68+
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
69+
version = "1.11.0+1"
70+
71+
[[deps.Libdl]]
72+
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
73+
74+
[[deps.LinearAlgebra]]
75+
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
76+
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
77+
78+
[[deps.Logging]]
79+
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
80+
81+
[[deps.Markdown]]
82+
deps = ["Base64"]
83+
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
84+
85+
[[deps.MbedTLS_jll]]
86+
deps = ["Artifacts", "Libdl"]
87+
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
88+
version = "2.28.2+1"
89+
90+
[[deps.MozillaCACerts_jll]]
91+
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
92+
version = "2023.1.10"
93+
94+
[[deps.NetworkOptions]]
95+
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
96+
version = "1.2.0"
97+
98+
[[deps.OpenBLAS_jll]]
99+
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
100+
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
101+
version = "0.3.23+4"
102+
103+
[[deps.PackageCompiler]]
104+
deps = ["Artifacts", "Glob", "LazyArtifacts", "Libdl", "Pkg", "Printf", "RelocatableFolders", "TOML", "UUIDs", "p7zip_jll"]
105+
git-tree-sha1 = "48d4429862157ad5500c4f61444db1b8c32e0a2b"
106+
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
107+
version = "2.1.17"
108+
109+
[[deps.Pkg]]
110+
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
111+
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
112+
version = "1.10.0"
113+
114+
[[deps.Printf]]
115+
deps = ["Unicode"]
116+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
117+
118+
[[deps.REPL]]
119+
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
120+
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
121+
122+
[[deps.Random]]
123+
deps = ["SHA"]
124+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
125+
126+
[[deps.RelocatableFolders]]
127+
deps = ["SHA", "Scratch"]
128+
git-tree-sha1 = "ffdaf70d81cf6ff22c2b6e733c900c3321cab864"
129+
uuid = "05181044-ff0b-4ac5-8273-598c1e38db00"
130+
version = "1.0.1"
131+
132+
[[deps.SHA]]
133+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
134+
version = "0.7.0"
135+
136+
[[deps.Scratch]]
137+
deps = ["Dates"]
138+
git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386"
139+
uuid = "6c6a2e73-6563-6170-7368-637461726353"
140+
version = "1.2.1"
141+
142+
[[deps.Serialization]]
143+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
144+
145+
[[deps.Sockets]]
146+
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
147+
148+
[[deps.SparseArrays]]
149+
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
150+
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
151+
version = "1.10.0"
152+
153+
[[deps.Statistics]]
154+
deps = ["LinearAlgebra", "SparseArrays"]
155+
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
156+
version = "1.10.0"
157+
158+
[[deps.SuiteSparse_jll]]
159+
deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
160+
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
161+
version = "7.2.1+1"
162+
163+
[[deps.TOML]]
164+
deps = ["Dates"]
165+
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
166+
version = "1.0.3"
167+
168+
[[deps.Tar]]
169+
deps = ["ArgTools", "SHA"]
170+
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
171+
version = "1.10.0"
172+
173+
[[deps.UUIDs]]
174+
deps = ["Random", "SHA"]
175+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
176+
177+
[[deps.Unicode]]
178+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
179+
180+
[[deps.Zlib_jll]]
181+
deps = ["Libdl"]
182+
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
183+
version = "1.2.13+1"
184+
185+
[[deps.libblastrampoline_jll]]
186+
deps = ["Artifacts", "Libdl"]
187+
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
188+
version = "5.8.0+1"
189+
190+
[[deps.nghttp2_jll]]
191+
deps = ["Artifacts", "Libdl"]
192+
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
193+
version = "1.52.0+1"
194+
195+
[[deps.p7zip_jll]]
196+
deps = ["Artifacts", "Libdl"]
197+
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
198+
version = "17.4.0+2"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = "ppmcc"
2+
uuid = "b0920459-b932-4b04-83ee-fb3fa13b1737"
3+
authors = ["parsaizme "]
4+
version = "0.1.0"
5+
6+
[deps]
7+
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
8+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using ppmcc
2+
3+
function main()
4+
temperature = [15, 16, 18, 22, 14, 25, 17, 28, 30, 26]
5+
days = [21, 20, 18, 16, 24, 15, 18, 14, 12, 14]
6+
7+
r, (a, b), estimated_time = analyze_concrete_data(temperature, days)
8+
9+
println("Pearson's correlation coefficient r = ", round(r, digits=4))
10+
println("Regression equation: Time = $(round(a, digits=2)) + ($(round(b, digits=2)) * Temperature)")
11+
println("Estimated drying time for 23°C: $(round(estimated_time, digits=2)) days")
12+
end
13+
14+
main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module ppmcc
2+
3+
using Statistics
4+
5+
export analyze_concrete_data
6+
7+
function analyze_concrete_data(temperature, days)
8+
# Correlation coefficient calculation
9+
r = cor(temperature, days)
10+
11+
# Regression equation
12+
b = r * (std(days) / std(temperature))
13+
a = mean(days) - b * mean(temperature)
14+
15+
# Estimation for 23°C
16+
estimated_time = a + b * 23
17+
18+
return (r, (a, b), estimated_time)
19+
end
20+
21+
end # module ppmcc

0 commit comments

Comments
 (0)
Please sign in to comment.