diff --git a/src/assets/blog/images/CustomisedHistogram.png b/src/assets/blog/images/CustomisedHistogram.png new file mode 100644 index 0000000..e43ea39 Binary files /dev/null and b/src/assets/blog/images/CustomisedHistogram.png differ diff --git a/src/assets/blog/images/Desc_R_cover.png b/src/assets/blog/images/Desc_R_cover.png new file mode 100644 index 0000000..07b7feb Binary files /dev/null and b/src/assets/blog/images/Desc_R_cover.png differ diff --git a/src/assets/blog/images/Histogram.png b/src/assets/blog/images/Histogram.png new file mode 100644 index 0000000..0034c31 Binary files /dev/null and b/src/assets/blog/images/Histogram.png differ diff --git a/src/routes/Sponsors.tsx b/src/routes/Sponsors.tsx index 7602801..3070d5f 100644 --- a/src/routes/Sponsors.tsx +++ b/src/routes/Sponsors.tsx @@ -22,33 +22,33 @@ const Sponsors = () => { }; const goldInfo: SponsorProps[] = [ - { - tier: "Gold", - image: bitgetLogo, - sponsor: "Bitget", - desc: "Established in 2018, Bitget is a global cryptocurrency exchange and Web3 company, serving over 20 million users in 100+ countries and regions. Together with Bitget Wallet - a world-class multi-chain crypto wallet that features swap, NFTs, DApps and more. Bitget wants to inspire everyone to embrace crypto, partnering with the likes of Argentinian footballer Lionel Messi and eSports event organiser PGL.", - button: "Visit website", - website: "https://partner.bitget.com/bg/KEHLYS_HackMelb", - }, + // { + // tier: "Gold", + // image: bitgetLogo, + // sponsor: "Bitget", + // desc: "Established in 2018, Bitget is a global cryptocurrency exchange and Web3 company, serving over 20 million users in 100+ countries and regions. Together with Bitget Wallet - a world-class multi-chain crypto wallet that features swap, NFTs, DApps and more. Bitget wants to inspire everyone to embrace crypto, partnering with the likes of Argentinian footballer Lionel Messi and eSports event organiser PGL.", + // button: "Visit website", + // website: "https://partner.bitget.com/bg/KEHLYS_HackMelb", + // }, ]; const silverInfo: SponsorProps[] = [ - { - tier: "Silver", - image: noMossLogo, - sponsor: "No Moss", - desc: "No Moss is a multi-disciplinary consultancy delivering bespoke agility transformation, purposeful product innovation, and empathy-led technology development.", - button: "Visit website", - website: "https://nomoss.co/", - }, - { - tier: "Silver", - image: superNormalLogo, - sponsor: "Supernormal", - desc: "Cutting-edge technology woven into every fabric of your brand. Utilise our world-class application of technology, automation, and growth strategies.", - button: "Visit website", - website: "https://www.snl-labs.com/", - }, + // { + // tier: "Silver", + // image: noMossLogo, + // sponsor: "No Moss", + // desc: "No Moss is a multi-disciplinary consultancy delivering bespoke agility transformation, purposeful product innovation, and empathy-led technology development.", + // button: "Visit website", + // website: "https://nomoss.co/", + // }, + // { + // tier: "Silver", + // image: superNormalLogo, + // sponsor: "Supernormal", + // desc: "Cutting-edge technology woven into every fabric of your brand. Utilise our world-class application of technology, automation, and growth strategies.", + // button: "Visit website", + // website: "https://www.snl-labs.com/", + // }, ]; const bronzeInfo: SponsorProps[] = [ @@ -128,7 +128,7 @@ const Sponsors = () => { {/* Silver */} -
+ {/*

{sponsorTitles[1]}

{silverInfo.length > 0 ? (
@@ -139,10 +139,10 @@ const Sponsors = () => { ) : ( )} -
+
*/} {/* Bronze */} -
+ {/*

{sponsorTitles[2]}

{bronzeInfo.length > 0 ? (
@@ -153,7 +153,7 @@ const Sponsors = () => { ) : ( )} -
+
*/} {/* Community NOT USED*/} {/*
diff --git a/src/routes/blogs/BlogsData.tsx b/src/routes/blogs/BlogsData.tsx index 697841d..481ee9a 100644 --- a/src/routes/blogs/BlogsData.tsx +++ b/src/routes/blogs/BlogsData.tsx @@ -2,6 +2,9 @@ import pythonImg from "../../assets/blog/images/python.png"; import gitcover from "../../assets/blog/images/git_tutorial_cover.png"; import GitBlog from "./Gittutorial.mdx"; import TemplateBlog from "./TemplateBlog.mdx"; +import DescRblog from "./IntroToStats.mdx"; +import rcover from "../../assets/blog/images/Desc_R_cover.png"; + export interface BlogInterface { title: string; @@ -36,7 +39,7 @@ export const BlogsData: BlogInterface[] = [ { articleId: 2, title: "Introduction to Using Git/Github", - description: "A quick summary of the Basics of Using Git/Github", + description: "", tags: ["Git", "programming", "beginner"], articleImage: gitcover, time: "25 August 2024", @@ -46,4 +49,21 @@ export const BlogsData: BlogInterface[] = [ BlogComponent: GitBlog, hidden: false, }, + + + { + articleId: 3, + title: "Introduction to Statistics in R", + description: "", + tags: ["R", "programming", "beginner"], + articleImage: rcover, + time: "8th September 2024", + author: "Anshan Arnott-Tan", + fileName: "IntroToStats.mdx", + url: "Intro-To-Stats", + BlogComponent: DescRblog, + hidden: false, + }, + + ]; diff --git a/src/routes/blogs/IntroToStats.mdx b/src/routes/blogs/IntroToStats.mdx new file mode 100644 index 0000000..b2af8cb --- /dev/null +++ b/src/routes/blogs/IntroToStats.mdx @@ -0,0 +1,332 @@ +import React from 'react'; +import { Alert, Button, Card, CardContent, CardHeader, Typography, Link, List, ListItem, Divider, Box, Grid, Paper } from '@mui/material'; + +import hist from "../../assets/blog/images/Histogram.png"; +import cust_hist from "../../assets/blog/images/CustomisedHistogram.png"; + + +##### **Basics of R and RStudio** + +###### Installation of R and RStudio + +Before we can start, you will need to download R and RStudio onto your computer. + +You can download R through this link [R Download Link](https://cran.ms.unimelb.edu.au/) + +And download RStudio through this link [RStudio Download Link](https://posit.co/download/rstudio-desktop/) + +*At the current time, We aren't able to run the code on this website, so please run it and follow along on your computer* + +###### Variables and Calculations in R + +Like most coding languages, R can store values in variables, to do so, use the assignment operator below. + +You can also do calculations with numbers in R, navigate to the console and try these. + +```R +x <- 5 * 12 + +y <- 16 / sqrt(4 * 16) + +z < x + y +``` +R will store these values and you can use them later. + +###### Defining Functions in R +We can also define functions in R, the following is a basic function to subtract two numbers. + +Note you can also use the variables from before as the inputs. +```R +subtract_numbers <- function(a, b) { + result <- a - b + return(result) +} +``` +###### Vectors (Lists in R) + +R can create vectors, which is a list of values of the same type, you can also access these values with indexing. + +*Note that R's index starts at 1 instead of 0.* + +```R +names <- c("John", "Max", "Sonia") + +accuracy <- c(80, 20, 30) +``` +Here ```accuracy[1]``` here would output 80. + +##### **Descriptive Statistics** + +One of R's strengths is its ability to describe and visualise datasets. It has various inbuilt functions that help us do this. + +The following section will explore descriptive statistics using the pre-loaded Iris dataset: + +Before we continue, please run the following code. + +We will also need to download and load the lsr package. We will go over the installation of packages in a later tutorial. + +```R +install.packages("lsr") +``` + +```R +library(lsr) +data(iris) +head(iris) +``` +###### Dataset Wrangling + +Before we can start visualise and describe data, we need to be able to access the correct rows and columns. + +To access specific columns we can use the \$ operator. + +For example: + +```R +iris$Petal.Length # To get the petal lengths vector + +iris$Petal.Length[1] # To get the petal length of the first flower + +iris$Species # To get the species names vector +``` + +### PHOTO + + +If we want to, we can also alter the data individually or we can alter the entire vector as a whole. + +For example: + +```R +iris$Petal.Length <- iris$Petal.Length + 10 +``` +```R +iris$Petal.Length +``` +```R +iris$Petal.Length[1] <- iris$Petal.Length[1] - 100 +``` +```R +iris$Petal.Length[1] +``` + +Remember to alter your data back to as it was before. + +```R +iris$Petal.Length[1] <- iris$Petal.Length[1] + 100 +``` +```R +iris$Petal.Length <- iris$Petal.Length - 10 +``` +```R +iris$Petal.Length +``` + +We can also add columns to the table if we want to. + +The following code will create a column with trues which satisfies the condition. + +```R +iris$long.petal <- iris$Petal.Length > 5 +``` + +```R +iris$long.petal +``` + +And we can remove columns with the following code. + +```R +iris$long.petal <- NULL +``` + +```R +head(iris) +``` + +#### Measures of Central Tendency + +Whilst manipulating datasets is a great tool, it is pretty hard to visualise the data well. + +Often, in communication, it is useful to describe a dataset with a single value. + +Statisticians have developed measures of central tendency and spread to describe datasets. + +There are three main measures of central tendency. + + + + Mean + + The mean is the average of the dataset. + + + It is found by adding up all the observations and then dividing by the total number of observations. + + + It is the most common measure of central tendency. + + + In R, you can calculate it using: + + + {`mean(iris$Sepal.Length)`} + + + + + + + Median + + The median is the middle observation when the data is sorted. + + + Half of the observations are greater than the median and half are smaller. + + + It is typically used when there are outliers in the dataset that skew the mean. + + + In R, you can calculate it using: + + + {`median(iris$Sepal.Length)`} + + + + + + + Mode + + The mode is the most common observation in the dataset. + + + It is often used in nominal or ordinal data. + + + In R, you can calculate it using the ModeOf function from the lsr package: + + + {`modeOf(iris$Sepal.Length)`} + + + + + +#### Measures of Spread + +Whilst measures of central tendency are extremely useful as a stand alone value, often, + +Statisticians want to understand the distribution of the data. + +Measures of spread are cruical when explaining how much the data varies. + +There are three main measures of spread in statistics. + + + + + Range + + The range is found by subtracting the minimum value from the maximum value. + + + In R, there is a built-in function that returns both the minimum and maximum values. + + + You can calculate the range in R using: + + + {`range(iris$Sepal.Length)`} + + + + + + + Interquartile Range (IQR) + + The interquartile range represents the middle 50% of the data, from the 25th to the 75th percentile. + + + It can be calculated with the IQR function and is often visualized with a boxplot. + + + In R, you can calculate the IQR and visualize it using: + + + {`IQR(iris$Sepal.Length)`} + + + + + + + Standard Deviation + + The standard deviation is the most common measure of spread. + + + It measures how far each point is from the mean. + + + About 95% of the data falls within 2 standard deviations from the mean. + + + It is also the square root of the variance. + + + In R, you can calculate it using: + + + {`sd(iris$Sepal.Length)`} + + + + + +##### Graphing with Histograms + +###### Histograms + +To visualise the sepal lengths for the dataset we can use the following code. + +Note that we are using sepal length now + +```R +hist(iris$Sepal.Length) +``` +Histogram + +###### Customized Histogram + +We can customize the functions to make the graphs clearer. + +These are just some of the popular arguments, but there are many more to explore. + +```R +hist(iris$Sepal.Length, col = "blue", + xlab = "Length of Sepal", main = "Frequency Table of Sepal Lengths") +``` + +Customised Histogram + +These are just some of the many plots R can produce. You can check the documentation for more examples. + +*Note that if you have missing values in your dataset, you will have to remove them with the argument na.rm = True.* + +###### The Summary Function: + +In this tutorial we have learnt how to find measures of both central tendency and spread to get a feel for the data. + +Whilst we have done this using the pre-built functions, we can use the summary function instead. + +```R +summary(iris$Sepal.Length) +``` + +### Photo + +References: R Documentation website [R Documentation link](https://www.r-project.org/other-docs.html)