corvo7/Data_Analysis
1
1import streamlit as st2 3# Function to display the main content4def show_content(topic):5 if topic == "Introduction":6 st.title("STATISTICS")7 st.subheader("Data")8 st.write("""9 "Data" refers to raw facts, information, or observations that are collected, recorded, or measured. Data can take various forms, including numbers, text, images, audio, and more.10 11 It is a collection of real facts in numerical figures known as data.12 13 Data is a piece of information or facts that can be collected. The data can be any form such as numbers, text, images, sounds, and more.14 """)15 st.write("Add some examples here.")16 if st.button("Next"):17 st.session_state.page = "Types of Data"18 19 elif topic == "Types of Data":20 st.subheader("Types of Data")21 st.image("images/page_1_img_1.png")22 st.write("""23 Quantitative data: The data which is measured in numerical figures.24 Ex: Ages, weights, heights25 This is divided into 2 types.26 - Individual Data or ungrouped data: which can take some individual values.27 Ex: 1,2,3,4,5 [n=5] If n<30 we take individual data If n>= 30 we go to grouped data.28 - Grouped data or frequency data: When the observations are the number of occurred (appeared) times is known as the frequency of observations.29 This is again divided into:30 1. Discrete frequency data: Which can take some distinct values and maintain some gap between the values is called discrete frequency data.31 """)32 st.image("images/page_2_img_1.png")33 st.write("""34 2. Continuous frequency data: Which can take any functional values within the specified range is called continuous frequency data.35 This again divided into:36 - Exclusive continuous frequency data: In this format, the upper bound of any class is the same as the lower bound of the next class is known as exclusive continuous frequency data. Here the lower bounds are included, the upper bounds are excluded.37 """)38 st.image("images/page_2_img_2.png")39 st.write("""40 - Inclusive continuous frequency data: In this format, the upper bound of any class is not the same as the lower bound of the next class is known as inclusive continuous. Here lower bound and upper bound are included.41 So we convert into exclusive continuous because of partial continuation. Inclusive to Exclusive:42 Difference between upper bound of any class and lower bound of next class d =1.43 Correlation factor c.f = d/2 = 1/2 = 0.544 Then lower bound - c.f and upper bound +c.f45 """)46 st.image("images/page_3_img_1.png")47 st.write("""48 Qualitative data: Also known as categorical data, describes the data that fits into the categories. Qualitative data are not numerical. The categorical information involves categorical variables that describe the features such as a person’s gender, home town, etc. Categorical measures are defined in terms of natural language specifications, but not in terms of numbers. Sometimes categorical data can hold numerical values (quantitative value), but those values do not have a mathematical sense. Examples of the categorical data are birthdate, favorite sport, school postcode. Here, the birthdate and school postcode hold the quantitative value, but it does not give numerical meaning.49 """)50 st.write("""51 Nominal: Is a type of qualitative data that puts things into categories or groups, but these categories don’t have any natural order or ranking. Ex: colors, names, city names.52 Nominal data is one of the types of qualitative information which helps to label the variables without providing the numerical value. It’s the simplest form of data and is commonly used for the purpose of classification or categorization. Nominal data is also called the nominal scale. It cannot be ordered and measured. But sometimes, the data can be qualitative and quantitative. Examples of nominal data are letters, symbols, words, gender, etc.53 """)54 st.write("""55 Ordinal: Is a type of qualitative data that has a natural order or ranking between the categories. In other words, ordinal data allows us to rank or order the different categories in terms of their relative position or importance.56 Ordinal data/variable is a type of data that follows a natural order. The significant feature of the nominal data is that the difference between the data values is not determined. This variable is mostly found in surveys, finance, economics, questionnaires, and so on. For example, consider a survey that asks respondents to rate their satisfaction with a restaurant on a scale of 1 to 5, where 1 means “very dissatisfied” and 5 means “very satisfied”. The responses here represent ordinal data because they categorise the respondents by satisfaction level and the categories have a clear order (1 < 2 < 3 < 4 < 5), but the difference between each category is not quantitatively defined (the difference in satisfaction between 1 and 2 might not be the same as between 4 and 5). The ordinal data is commonly represented using a bar chart. These data are investigated and interpreted through many visualisation tools. The information may be expressed using tables in which each row in the table shows the distinct category.57 """)58 if st.button("Next"):59 st.session_state.page = "Data Collection"60 61 elif topic == "Data Collection":62 st.subheader("Data Collection in Statistics")63 st.write("""64 In statistics, data is usually collected in two ways: as a population or as a sample:65 1. Population Data: This refers to data that relates to all members of a particular group or set. The population is the entire group that you want to draw conclusions about. For example, if you wanted to know the average height of all adult men in India, the population would be all adult men in India.66 2. Sample Data: This refers to data collected from a subset of the population. A sample is a group of subjects selected from the population. For example, if it’s not feasible to measure the height of every adult man in India, you might measure the heights of a sample of 1000 men selected randomly from across the country. The idea is that the sample represents the population and can give you a good estimate of the population parameter.67 In both cases, the goal is usually to learn something about the population. When it’s not practical or possible to study the entire population, then a sample is used, and statistical inference is used to draw conclusions about the population based on the sample.68 """)69 #st.image("images\page_7_img_1.png")70 st.write("Examples:")71 st.write("1. Educational levels (e.g., elementary school, high school, bachelor’s degree, master’s degree).")72 st.write("2. Satisfaction levels (e.g., very satisfied, somewhat satisfied, neither satisfied nor dissatisfied, somewhat dissatisfied, very dissatisfied).")73 if st.button("Next"):74 st.session_state.page = "Introduction to Statistics"75 76 elif topic == "Introduction to Statistics":77 st.subheader("Introduction to Statistics")78 st.write("""79 Statistics is a branch of mathematics that involves collecting, analyzing, interpreting, presenting, and organizing data. It helps us make sense of the information we gather and make informed decisions. In simpler terms, statistics is like a toolbox of methods and techniques we use to understand and describe the world around us by studying numerical information.80 """)81 if st.button("Next"):82 st.session_state.page = "Types of Statistics"83 84 elif topic == "Types of Statistics":85 st.subheader("Types of Statistics")86 st.write("""87 The study of statistics can be organized in a variety of ways. One of the main ways is to subdivide statistics into two branches: descriptive statistics and inferential statistics. To understand the difference between descriptive and inferential statistics, definitions of population and sample are helpful.88 """)89 st.write("""90 Descriptive statistics summarize and organize characteristics of a data set. A data set is a collection of responses or observations from a sample or entire population.91 In quantitative research, after collecting data, the first step of statistical analysis is to describe characteristics of the responses, such as the average of one variable (e.g., age), or the relation between two variables (e.g., age and creativity).92 The next step is inferential statistics, which help you decide whether your data confirms or refutes your hypothesis and whether it is generalizable to a larger population.93 """)94 st.write("""95 This is again divided into 4 parts:96 1. 1st order measurements or measures of central tendency97 2. 2nd order measurements or measures of dispersion98 3. 3rd order measurements or measures of skewness99 4. 4th order measurements or measures of kurtosis100 """)101 st.write("""102 Key points:103 - Descriptive statistics summarize or describe the characteristics of a data set.104 - Descriptive statistics consist of three basic categories of measures: measures of central tendency, measures of variability (or spread), and frequency distribution.105 - Measures of central tendency describe the center of the data set (mean, median, mode).106 - Measures of variability describe the dispersion of the data set (variance, standard deviation).107 - Measures of frequency distribution describe the occurrence of data within the data set (count).108 """)109 st.write("""110 1st order measurements or measures of central tendency:111 To concentrate on the central part of the data is known as central tendency112 And these measures are called measures of central tendency.113 The 3 most common measures of central tendency are the mode, median, and mean.114 Mean is again divided into:115 1. Arithmetic mean116 2. Geometric mean117 3. Harmonic mean118 Mode: the most frequent value.119 Median: the middle number in an ordered dataset.120 Mean: the sum of all values divided by the total number of values.121 """)122 123# Set up sidebar navigation124topics = [125 "Introduction",126 "Types of Data",127 "Data Collection",128 "Introduction to Statistics",129 "Types of Statistics"130]131 132st.sidebar.title("Statistics Topics")133selection = st.sidebar.radio("Go to", topics)134 135# Initialize session state if not already done136if 'page' not in st.session_state:137 st.session_state.page = selection138 139# Update session state if sidebar selection is changed140if st.sidebar.button("Navigate"):141 st.session_state.page = selection142 143# Display the selected content144show_content(st.session_state.page)145 