#a&pclass
Explore tagged Tumblr posts
dolivia · 11 months ago
Text
https://vervecollege.edu/difficult-aspect-aandp-class/
Mastering anatomy and physiology, one of the more difficult prerequisite classes for pre-health and nursing students requires dedication and hard work to understand and retain all of its vast amounts of information.
0 notes
codeshive · 3 months ago
Text
STAT451 HW04: Practice with feature engineering...solved
HW04: Practice with feature engineering, splitting data, and fitting and regularizing linear models 1. Feature engineering (one-hot encoding and data imputation) 1a. Read the data from http://www.stat.wisc.edu/~jgillett/451/data/kaggle_titanic_train.csv. Retain only these columns: Survived, Pclass, Sex, Age, SibSp, Parch. Display the first 7 rows. These data are described…
0 notes
draxgod · 4 months ago
Text
Titanic Passenger List
Survival EDA Report
Introduction:
The sinking of the Titanic is one of the most infamous shipwrecks in history.
On April 15, 1912, during her maiden voyage, the widely considered “unsinkable” RMS Titanic sank after colliding with an iceberg. Unfortunately, there weren’t enough lifeboats for everyone onboard, resulting in the death of 1502 out of 2224 passengers and crew.
While there was some element of luck involved in surviving, it seems some groups of people were more likely to survive than others.
About Dataset:
Dataset Overview:
The dataset contains 891 rows and 12 columns.
The columns include passenger information such as ID, survival status, class, name, sex, age, family information (SibSp, Parch), ticket details, fare, cabin, and embarkation point.
Missing Data:
Age has 177 missing values (19.9% of the data).
Cabin has 687 missing values (77.1% of the data).
Embarked has 2 missing values (0.2% of the data).
Survival Rate:
The overall survival rate is approximately 38.4% (mean of the 'Survived' column).
Passenger Class Distribution:
The mean of 'Pclass' is 2.31, indicating that there are more passengers in the lower classes (2nd and 3rd) than in the 1st class.
Age Distribution:
The average age of passengers is about 29.7 years, with a standard deviation of 14 years.
Fare Distribution:
The average fare is 32.2, with a large standard deviation of 49.7, suggesting a wide range of ticket prices.
Observations
This bar plot clearly shows that passengers in higher classes had a better chance of survival:
1st class passengers had the highest survival rate, around 63%.
2nd class passengers had a survival rate of about 47%.
3rd class passengers had the lowest survival rate, approximately 24%.
Tumblr media
This visualization reveals a stark difference in survival rates between males and females:
Females had a much higher survival rate, around 74%.
Males had a significantly lower survival rate, about 19%.
Tumblr media
3.The histogram of age distribution shows:
The majority of passengers were between 20 and 40 years old.
There's a noticeable peak around age 30.
There were fewer children and elderly passengers compared to young and middle-aged adults.
Tumblr media
Conclusion:
These visualizations provide valuable insights into the factors that influenced survival on the Titanic. The passenger's class, sex, and to some extent, age, all played roles in determining their chances of survival. This information could be useful for further analysis or building predictive models.
1 note · View note
chaolinchang · 5 months ago
Text
Milestone Assignment 3: Preliminary Results: titanic
1. Descriptive Statistics:
We began by examining the distribution of key variables in the dataset. Below are some summary statistics:
Survival Rate: Approximately 38% of passengers in the dataset survived the sinking of the Titanic.
Socio-economic Status (Pclass): The majority of passengers were in third class (55%), followed by first class (24%) and second class (21%).
Gender (Sex): There were more male passengers (64%) than female passengers (36%).
Age: The average age of passengers was approximately 29 years, with a standard deviation of around 14 years.
Cabin Location: A large proportion of cabin information is missing in the dataset, but among those available, cabins were distributed across various decks of the ship.
2. Relationships Between Variables:
Next, we explored how different variables were associated with the likelihood of survival using visualizations. Here are some key plots:
Survival by Socio-economic Status (Pclass):
This bar plot illustrates the survival rates among passengers of different socio-economic statuses. We observe that passengers in first class had the highest survival rate, followed by second class, and then third class.
Survival by Gender:
This pie chart shows the distribution of survivors by gender. Interestingly, we see that a higher proportion of females survived compared to males.
Age Distribution of Passengers:
This histogram displays the distribution of passenger ages. We notice that the majority of passengers were between 20 and 40 years old.
Survival by Age:
This box plot compares the age distributions of survivors and non-survivors. It appears that younger passengers had a slightly higher chance of survival compared to older passengers.
Conclusion:
These preliminary analyses provide a glimpse into the complex dynamics of survival aboard the Titanic. While socio-economic status, gender, and age seem to play significant roles, further analyses using advanced statistical techniques will help us better understand the underlying patterns and make more accurate predictions. Stay tuned for more insights as we delve deeper into the data!
0 notes
workforcesolution · 6 months ago
Text
Battle of the Programming Languages: R vs Python
Tumblr media
Battle of the Programming Languages: R vs Python
We are going to compare Functions exist in both R and Python for same operations. And for this we took the Titanic dataset which contains the Passenger details. Importing a CSV Reading Data in both the languages is similar, but the only difference is for python we have to import pandas library for reading the Data. Once the importing is done we can look into the data by applying the below functions.RPythontitanicimport pandas as pd
titanic = pd.read_csv("train.csv")
Dimension and Shape If we want to look the Dimension of the above imported Data. You can get it from the below functions.RPythondim(titanic)titanic.shape[1] 891 12(891, 12)
The above code brings you the number of passengers in titanic ship and the number of columns present in data. Head and Tail If you want to see some of the data like top rows (Any number of rows by default it gets 5 rows) or bottom rows form the Data frame. There are functions in similar functions in both R and Python.RPythonhead(titanic,2)titanic.head(2)PassengerId Survived Pclass
1 1 0 3
2 2 1 1
 PassengerId Survived Pclass 0 1 0 3 1 2 1 1tail(titanic,2)titanic.tail(2) PassengerId Survived Pclass
890 890 1 1
891 891 0 3
PassengerId Survived Pclass 889 890 1 1
890 891 0 3
Here head and tail functions applied on Titanic dataset to look at the first two rows of Data. If you observe clearly the index values are different in both R and Python. It is because Python index starts with '0'. Basic Statistics of Data (Summary and Describe)RPythonsummary(titanic)titanic.describe()PassengerId SurvivedPassengerId SurvivedMin. : 1.0 Min. :0.0000
1st Qu.:223.5 1st Qu.:0.0000
Median :446.0 Median :0.0000
Mean :446.0 Mean :0.3838
3rd Qu.:668.5 3rd Qu.:1.0000
Max. : 891.0 Max. :1.0000count 891.000000 891.000000
mean 446.000000 0.383838
std 257.353842 0.486592
min 1.000000 0.000000
25% 223.500000 0.000000
50% 446.000000 0.000000
75% 668.500000 1.000000
max 891.000000 1.000000
The above two functions are for determining some basic statistics column wise. Whereas python gives two more statistic values compared to R function. The main difference between these functions is R contains Separate functions and for Python we have to call the required methods on the Data as it is more of object oriented type programming. Slicing the Datatitanic[1:5,1:3]titanic.iloc[0:5,0:3]PassengerId Survived Pclass
1 1 0 3
2 2 1 1
3 3 1 3
4 4 1 1
5 5 0 3PassengerId Survived Pclass
0 1 0 3
1 2 1 1
2 3 1 3
3 4 1 1
4 5 0 3
Sub setting Data Here in this case for sub setting the Data I took only some columns from the titanic Dataset. For the convenience of displaying the output. Using sam_data sam_data = titanic[['PassengerId', 'Survived','Sex','Age']] for Python I created sam_data for applying subset function. subset(sam_data,Survived == 1& Sex == 'male')sam_data[(sam_data.Sex == 'male') & (sam_data.Survived ==1)].head(2)PassengerId Survived Sex Age
18 18 1 male NA 22 22 1 male 34 24 24 1 male 28 37 37 1 male NA 56 56 1 male NA 66 66 1 male NAPassengerId Survived Sex Age
17 18 1 male NaN 21 22 1 male 34.00 23 24 1 male 28.00 36 37 1 male NaN 55 56 1 male NaN 65 66 1 male NaN
The important thing here is the representation of NA in Python is NaN. Ordering the Data We ordered the Sample Dataset By arrange(sam_data, Survived, desc(Age))sam_data.sort_index(by=['Survived', 'Age'], ascending=[True, False])PassengerId Survived Sex Age 1 852 0 male 74.0 2 97 0 male 71.0 3 494 0 male 71.0 4 117 0 male 70.5 5 673 0 male 70.0 6 746 0 male 70.0PassengerId Survived Sex Age 851 852 0 male 74.0 493 494 0 male 71.0 96 97 0 male 71.0 116 117 0 male 70.5 672 673 0 male 70.0 745 746 0 male 70.0
Joins For Performing join operations we created three different data frames from the titanic Dataset df_Survived df_Sex df_Age df_Survived = sam_data[['PassengerId', 'Survived']] df_Sex = sam_data [['PassengerId', 'Sex']] df_Age = sam_data [[ 'PassengerId', 'Age']] Inner
JoinTable_Inner_J = merge ( merge(df_Survived, df_Sex, key = "PassengerId" ),
df_Age ,
key = "PassengerId")Table_Inner_J = pd.merge ( pd.merge(df_Survived, df_Sex, on = "PassengerId" , how = "inner" ),
df_Age ,
on = "PassengerId" , how = "inner")Outer JoinTable_Outer_J = merge ( merge(df_Survived, df_Sex, key = "PassengerId" , all =TRUE),
df_Age ,
key = "PassengerId", all = TRUE)Table_Outer_J = pd.merge ( pd.merge(df_Survived, df_Sex, on = "PassengerId" , how = "outer"),
df_Age ,
on = "PassengerId", how = "outer")Left
JoinTable_Left_J = merge ( merge(df_Survived, df_Sex, key = "PassengerId" , all.x =TRUE),
df_Age ,
key = "PassengerId", all.x = TRUE)Table_Left_J = pd.merge ( pd.merge(df_Survived, df_Sex, on = "PassengerId" , how = "left"),
df_Age ,
on = "PassengerId" , how = "left")Right
JoinTable_Right_J = merge ( merge(df_Survived, df_Sex, key = "PassengerId", all.y = TRUE),
df_Age ,
key = "PassengerId", all.y = TRUE )Table_Right_J = pd.merge ( pd.merge(df_Survived, df_Sex, on = "PassengerId" , how = "right"),
df_Age ,
on = "PassengerId" , how = "right")
The major Difference in R and Python for joining operation is both can be done using merge function. But for python we have to import pandas library for using the merge function to perform these join functions. We can join three Data frames at a time by applying merge function two times. Missing Values Treatment: In Missing Values treatment first thing we have to do is identify the NA values by running the first block of code in below table. After getting the variables where missing values are there then you can impute them with the mean value of that respective column. Here, second block of code replaces the NA values with the respective mean values. tail(is.na(sam_data))sam_data.isnull().tail()PassengerId Survived Sex Age [886,] FALSE FALSE FALSE FALSE [887,] FALSE FALSE FALSE FALSE [888,] FALSE FALSE FALSE FALSE [889,] FALSE FALSE FALSE TRUE [890,] FALSE FALSE FALSE FALSE [891,] FALSE FALSE FALSE FALSEPassengerId Survived Sex Age 886 False False False False 887 False False False False 888 False False False False 889 False False False True 890 False False False Falsesam_data["Age"][is.na(sam_data["Age"])]meanAge = np.mean(sam_data.Age)
sam_data.Age = sam_data.Age.fillna(meanAge)PassengerId Survived Sex Age
[886,] FALSE FALSE FALSE FALSE
[887,] FALSE FALSE FALSE FALSE
[888,] FALSE FALSE FALSE FALSE
[889,] FALSE FALSE FALSE FALSE
[890,] FALSE FALSE FALSE FALSE
[891,] FALSE FALSE FALSE FALSEPassengerId Survived Sex Age
886 False False False False
887 False False False False
888 False False False False
889 False False False False
890 False False False False
Tumblr media Tumblr media
About Rang Technologies: Headquartered in New Jersey, Rang Technologies has dedicated over a decade delivering innovative solutions and best talent to help businesses get the most out of the latest technologies in their digital transformation journey. Read More...
0 notes
titanticdata · 7 months ago
Text
Wesleyan University - Regression Modelling in Practice
Modul 4 - Step 1 Logistic Regression:
I made a logistic Regression including the response variable Survived and the explanatory variables age, Pclass and Sex (0=male, 1=female).
Tumblr media
Results are:
The p value is 0.000, therefore all variables are significant.
Tumblr media
The Odds Rations are:
Sex 0.08, Age 0.96, Pclass 0.27
The Confidence Intervals for the odds ratios are:
Tumblr media
Interpretation of Odds ratios:
the odds for surviving for a male person is just 8% (Confidence 5 to 12%) compared to female people. The bar chart shows also that female people survived more.
Tumblr media
As passenger class increases by one unit (1 st to 2 nd or 2 nd to 3 rd), the odds of surviving decrease (OR=0.27, 95% CI: (0.21,0.36)). Someone in 3 rd class has about one third the odds of surviving compared to someone in 2 nd class
Tumblr media
As age increases, the odds for surviving also decreases
Tumblr media
Modul 4 - Step 2:
My hypothesis was that young and female people have bigger chances of survival. Therefore my hypothesis was quite good. But also the Pclass had an influence, more chances in Pclass 1 (which is also expected, maybe that paid more to get rescued first).
Modul 4 - Step 3:
I tested on confounding.
1. Variable Sex missing -> no confounding variable
Tumblr media
2. Variable Age missing -> no confounding variable
Tumblr media
3. Variable Pclass missing -> confounding variable found because Age is not longer significant
Tumblr media
0 notes
joseferreira2 · 1 year ago
Text
Titanic survivors
This work was done for Data Management and Visualization WK4
Bellow you can find the code for statistical analysis of relation between:
survived, sex, age and class.
The results are present in table and plots:
Code:
import pandas as pd import numpy as np import random as rnd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline
print("Results start here")
train_df = pd.read_csv('train.csv') test_df = pd.read_csv('test.csv') combine = [train_df, test_df]
print(train_df.columns.values)
Display statistics for each variable
print("Statistics for Pclass:") print(train_df['Pclass'].describe())
print("\nStatistics for Sex:") print(train_df['Sex'].describe())
print("\nStatistics for Age:") print(train_df['Age'].describe())
print("Statistics for Survived:") print(train_df['Survived'].describe())
Calculate percentage of survived by class
a = train_df[['Pclass', 'Survived']].groupby(['Pclass']).mean().sort_values(by='Survived') a1 = train_df[['Pclass', 'Survived']].groupby(['Pclass']).count() a['CumulativeFrequency'] = a1['Survived'].cumsum() a['CumulativePercentage'] = (a['CumulativeFrequency'] / a1['Survived'].sum()) * 100 print("% of survived by class", a)
Calculate percentage of survived by sex
b = train_df[["Sex", "Survived"]].groupby(['Sex']).mean().sort_values(by='Survived', ascending=False) b1 = train_df[['Sex', 'Survived']].groupby(['Sex']).count() b['CumulativeFrequency'] = b1['Survived'].cumsum() b['CumulativePercentage'] = (b['CumulativeFrequency'] / b1['Survived'].sum()) * 100 print("% of survived by sex", b)
Drop unnecessary columns
train_df = train_df.drop(['Ticket', 'Cabin'], axis=1) test_df = test_df.drop(['Ticket', 'Cabin'], axis=1)
"After", train_df.shape, test_df.shape, combine[0].shape, combine[1].shape
Create AgeBand and calculate percentage of survived by Age class
train_df['AgeBand'] = pd.cut(train_df['Age'], 5) c = train_df[['AgeBand', 'Survived']].groupby(['AgeBand']).mean().sort_values(by='AgeBand') c1 = train_df[['AgeBand', 'Survived']].groupby(['AgeBand']).count() c['CumulativeFrequency'] = c1['Survived'].cumsum() c['CumulativePercentage'] = (c['CumulativeFrequency'] / c1['Survived'].sum()) * 100 print("% of survived by Age class", c)
train_df.head()
Age class
age_bins = [0, 2, 18, 30, 65, 100]
Age class description
age_labels = ['Baby', 'Child', 'Young', 'Adult', 'Elderly']
Create the AgeGroup column based on age bins
train_df['AgeGroup'] = pd.cut(train_df['Age'], bins=age_bins, labels=age_labels)
Calculate percentage of survived by AgeGroup
d = train_df[['AgeGroup', 'Survived']].groupby(['AgeGroup']).mean() d1 = train_df[['AgeGroup', 'Survived']].groupby(['AgeGroup']).count() d['CumulativeFrequency'] = d1['Survived'].cumsum() d['CumulativePercentage'] = (d['CumulativeFrequency'] / d1['Survived'].sum()) * 100 print("% of survived by AgeGroup", d)
Analyze relationship between Survived and Sex
survived_sex_analysis = train_df.groupby(['Sex', 'Survived']).size().reset_index(name='Count') survived_sex_analysis['RelativeFrequency'] = survived_sex_analysis['Count'] / survived_sex_analysis['Count'].sum() print("\nAnalysis of Relationship between Survived and Sex:") print(survived_sex_analysis)
Visualize relationship between Survived and Sex
plt.figure(figsize=(6, 4)) sns.barplot(data=survived_sex_analysis, x='Survived', y='RelativeFrequency', hue='Sex', dodge=True) plt.title("Relationship between Survived and Sex") plt.xlabel("Survived") plt.ylabel("Relative Frequency") plt.xticks([0, 1], ['Not Survived', 'Survived']) plt.show()
Analyze relationship between Survived and Pclass
survived_pclass_analysis = train_df.groupby(['Pclass', 'Survived']).size().reset_index(name='Count') survived_pclass_analysis['RelativeFrequency'] = survived_pclass_analysis['Count'] / survived_pclass_analysis['Count'].sum() print("\nAnalysis of Relationship between Survived and Pclass:") print(survived_pclass_analysis)
Visualize relationship between Survived and Pclass
plt.figure(figsize=(6, 4)) sns.barplot(data=survived_pclass_analysis, x='Survived', y='RelativeFrequency', hue='Pclass', dodge=True) plt.title("Relationship between Survived and Pclass") plt.xlabel("Survived") plt.ylabel("Relative Frequency") plt.xticks([0, 1], ['Not Survived', 'Survived']) plt.show()
Analyze relationship between Survived and AgeGroup
survived_agegroup_analysis = train_df.groupby(['AgeGroup', 'Survived']).size().reset_index(name='Count') survived_agegroup_analysis['RelativeFrequency'] = survived_agegroup_analysis['Count'] / survived_agegroup_analysis['Count'].sum() print("\nAnalysis of Relationship between Survived and AgeGroup:") print(survived_agegroup_analysis)
Visualize relationship between Survived and AgeGroup
plt.figure(figsize=(10, 6)) sns.barplot(data=survived_agegroup_analysis, x='Survived', y='RelativeFrequency', hue='AgeGroup', dodge=True) plt.title("Relationship between Survived and AgeGroup") plt.xlabel("Survived") plt.ylabel("Relative Frequency") plt.xticks([0, 1], ['Not Survived', 'Survived']) plt.show()
print("Results end here")
The results for each relation are presented on bellow:
Tumblr media Tumblr media Tumblr media Tumblr media
The results with count, cumulative count, frequency and cumulative frequency are showed bellow:
Tumblr media Tumblr media Tumblr media
Here it was defined class, by age:
Tumblr media Tumblr media
In next step, it was analyzed the relationship between survived and Sex, Survived and Pclass and Survived and Age class:
Tumblr media Tumblr media Tumblr media Tumblr media
In the Survived: the 1 value is Survived and 0 is not Survived.The results show that female have the high rate of survive when compared with male. The 1st class have a higher rate of rate of survive when compared with other 2, but even in 2nd class, the rate of survive is higher than 3rd class.The agegroup show no correlation between age and survive.
0 notes
david-towo · 2 years ago
Text
Chi square assignment
{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "eb7a26f1", "metadata": {}, "outputs": [], "source": [ "# Statistcs in Python\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "417e3723", "metadata": {}, "outputs": [], "source": [ "# How to check the normal or gaussian distribution of our data in Python?" ] }, { "cell_type": "code", "execution_count": 3, "id": "effb110e", "metadata": {}, "outputs": [], "source": [ "# import libraries\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import seaborn as sns\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 4, "id": "f573f2b8", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#normal distribution - how to draw\n", "\n", "def pdf(x):\n", " mean = np.mean(x)\n", " std = np.std(x)\n", " y_out = 1/(std * np.sqrt(2 * np.pi)) * np.exp( - (x - mean)2 / (2 * std2))\n", " return y_out\n", "\n", "# to generate an array of X\n", "x = np.arange(-2, 2, 0.1)\n", "y = pdf(x)\n", "\n", "#plotting the normal curve / bell curve or gaussian distribution\n", "\n", "plt.style.use('seaborn')\n", "plt.figure(figsize=(5,5))\n", "\n", "plt.plot(x, y, color = 'blue', linestyle = 'dashed')\n", "\n", "plt.scatter(x, y, marker='o', s=25, color='red')" ] }, { "cell_type": "code", "execution_count": 5, "id": "8e7a294d", "metadata": {}, "outputs": [], "source": [ "# Normal Distribution and its tests" ] }, { "cell_type": "code", "execution_count": 6, "id": "ac5ef1e2", "metadata": {}, "outputs": [], "source": [ "\n", "#1.import dataset\n", "#2.subsetting a dataset\n", "#3.visual test for normal distribution\n", "#iHistogram\n", "#iiqq-norm plot\n", "#4.statistical test" ] }, { "cell_type": "code", "execution_count": 7, "id": "92331097", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "survivedpclasssexagesibspparchfareembarkedclasswhoadult_maledeckembark_townalivealone003male22.0107.2500SThirdmanTrueNaNSouthamptonnoFalse111female38.01071.2833CFirstwomanFalseCCherbourgyesFalse213female26.0007.9250SThirdwomanFalseNaNSouthamptonyesTrue311female35.01053.1000SFirstwomanFalseCSouthamptonyesFalse403male35.0008.0500SThirdmanTrueNaNSouthamptonnoTrue
\n", "" ], "text/plain": [ " survived pclass sex age sibsp parch fare embarked class \\n", "0 0 3 male 22.0 1 0 7.2500 S Third \n", "1 1 1 female 38.0 1 0 71.2833 C First \n", "2 1 3 female 26.0 0 0 7.9250 S Third \n", "3 1 1 female 35.0 1 0 53.1000 S First \n", "4 0 3 male 35.0 0 0 8.0500 S Third \n", "\n", " who adult_male deck embark_town alive alone \n", "0 man True NaN Southampton no False \n", "1 woman False C Cherbourg yes False \n", "2 woman False NaN Southampton yes True \n", "3 woman False C Southampton yes False \n", "4 man True NaN Southampton no True " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Import a dataset\n", "kashti = sns.load_dataset('titanic')\n", "kashti.head()" ] }, { "cell_type": "code", "execution_count": 8, "id": "b56d7115", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "sexagefare0male22.07.25001female38.071.28332female26.07.92503female35.053.10004male35.08.0500
\n", "" ], "text/plain": [ " sex age fare\n", "0 male 22.0 7.2500\n", "1 female 38.0 71.2833\n", "2 female 26.0 7.9250\n", "3 female 35.0 53.1000\n", "4 male 35.0 8.0500" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], " "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# qq plot\n", "#pip install statsmodels \n", "from statsmodels.graphics.gofplots import qqplot\n", "\n", "#q-q norm plot\n", "qqplot(kashti['age'])\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 12, "id": "c8c6e856", "metadata": {}, "outputs": [], "source": [ "# Normality Tests\n", "##There are many statistical tests that we can use to quantify whether a sample of data looks as though it was drawn from a Gaussian distribution.\n", "## Each test makes different assumptions and considers different aspects of the data.\n", "## We will look at 3 commonly used tests in this section that you can apply to your own data samples.." ] }, { "cell_type": "code", "execution_count": 13, "id": "4bd80986", "metadata": {}, "outputs": [], "source": [ "# 1. Shapiro-Wilk Test\n", "# 2. D’Agostino’s K^2 Test\n", "# 3. Anderson-Darling Test" ] }, { "cell_type": "code", "execution_count": 14, "id": "9d6d3f70", "metadata": {}, "outputs": [], "source": [ "# p <= alpha: reject H0, not normal.\n", "# p > alpha: fail to reject H0, normal." ] }, { "cell_type": "code", "execution_count": 15, "id": "be54c9e2", "metadata": {}, "outputs": [], "source": [ "# 1. Shapiro-Wilk Test\n", "# The Shapiro-Wilk test evaluates a data sample and quantifies how likely it is that the data was drawn from a Gaussian distribution, named for Samuel Shapiro and Martin Wilk.\n", "\n", "# In practice, the Shapiro-Wilk test is believed to be a reliable test of normality, although there is some suggestion that the test may be suitable for smaller samples of data, e.g. thousands of observations or fewer.\n", "\n", "# The shapiro() SciPy function will calculate the Shapiro-Wilk on a given dataset. The function returns both the W-statistic calculated by the test and the p-value.\n", "\n", "# Assumptions\n", "\n", "# ** Observations in each sample are independent and identically distributed.\n", "\n", "# Interpretation\n", "\n", "# ** H0: the sample has a Gaussian distribution.\n", "# ** H1: the sample does not have a Gaussian distribution." ] }, { "cell_type": "code", "execution_count": 16, "id": "11ec9031", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "stat=nan, p=1.000\n", "Probably Gaussian or Normal Distribution\n" ] } ], "source": [ "# shapirowilk test\n", "\n", "#import library\n", "from scipy.stats import shapiro\n", "\n", "stat, p = shapiro(kashti['age'])\n", "print('stat=%.3f, p=%.3f' % (stat, p))\n", "\n", "# make a coditional argument for further use\n", "if p > 0.05:\n", "\tprint('Probably Gaussian or Normal Distribution')\n", "else:\n", "\tprint('Probably not Gaussian nor normal distribution')" ] }, { "cell_type": "code", "execution_count": 17, "id": "0b0f7d65", "metadata": {}, "outputs": [], "source": [ "# 2. D’Agostino’s K^2 Test\n", "# The D’Agostino’s K^2 test calculates summary statistics from the data, namely kurtosis and skewness, to determine if the data distribution departs from the normal distribution, named for Ralph D’Agostino.\n", "\n", "# Skew is a quantification of how much a distribution is pushed left or right, a measure of asymmetry in the distribution.\n", "# Kurtosis quantifies how much of the distribution is in the tail. It is a simple and commonly used statistical test for normality.\n", "# The D’Agostino’s K^2 test is available via the normaltest() SciPy function and returns the test statistic and the p-value. Assumptions\n", "\n", "# Observations in each sample are independent and identically distributed.\n",
0 notes
braetiderunner · 6 years ago
Text
Song.
The Light coursed through her, thrumming, vibrant, poignant, alive. It carved Its own drumbeat alongside the rhythm of her heart, It carried her through this life with rising crescendos and tumbling diminuendos. Its melody had carried her beyond the veil of this plane and into the brazen, brilliant, blazing embrace of what lay beyond.
Your song is not yet sung.
Back she had come–breathing, fighting, snarling.
The Light moved through her like a song, and it was with her own song that she called It to her, shielding, bolstering, rallying those around her as her voice carried over the field, over the din of battle, over the agony of the dying. Ancient hymns and Holy texts long adapted, regimental musicians at her flank as she sang until her voice gave out and her throat bled but pushing on regardless because
All the world responds to a song, Acolyte. There is nothing that stands before the face of the Light that cannot, will not, has not been influenced by a song. Knows yours, and know them well, and you might move to rally a nation.
The Light burned within her like a prayer, and Bastionward’s words felt a thousand years and a million miles away as she stood within her tent, humming lowly as she worked tirelessly to mend her armor. The Light flowed, as It ever did, with her somber tune, imbuing the renewed inscriptions with Its might, and she lost herself to her work.
Be a boon to your people. Influence them, inspire them, rally them when the hour is dire and the night appears darkest. Hymnsinger, Relic-Mender, Secret-Keeper–The Light is your song, make certain they know it!
The Light thrummed within her like a spring tightly coiled, all pent-up energy and the rogue, crackling threat of excess in need of redirection. Redirection that would come, she was resigned to admitting, with one toe gingerly dipped within the sphere of politics as the Magistry leaned on her unfaltering devotion, pious image, and gilded tongue to head the Division of the Faith.
In all ways, you were made for this. In the vanguard or within a council-room, your song rises–For the Light, for Quel’thalas, for the Sin’dorei.
Make certain they know it.
16 notes · View notes
dolivia · 2 years ago
Link
Learning from world-leading experts in anatomy and physiology classes will make it easier than learning from books. All the tips mentioned above will help you prepare for the anatomy test in the minimum amount of time available to you before the test.
0 notes
razxion · 7 years ago
Text
Vinchenzho: The Dragon’s Mark Pt.2
(Part 2 to Vinchenzho’s Waywatcher Assassin Prestige Class Story.) (Part 1 found here.)
Tumblr media
A few days passed from Vinchenzho accepting a job with the Uncrowned, and after his ballista was destroyed by fel bats, he became too injured to pursue his target.  A struggle to stay within his cave so he could heal his wounds on his own, was thwarted by his brother Reynllin's persistence. Though this allowed others a small glimpse of their secret.
He followed the mender's orders, for the most part: rest for his body and mind while at home, and no transforming.  But Vinchenzho had to acquire the information still on his ‘test’.  Just as that man had mentioned, his information was attached to a package of clay he receiving in Silvermoon.  Though after running into the mender that healed him, he had to endure a light scolding from them before he could return home.
More days had passed, and one of the monk’s personal problems had begun to arise.  The voices within his mind had become louder.  This time though he was unable to do as he usually has done for the past 10,000 years: transform and bash his head into rocks until there was silence again.
He became exhausted quickly as he attempted to use only meditation to keep the voices at bay.  But his luck turned for the better as the day he was to check in with the mender, Aenys came to see him.  A discussion with a lightly Light filled touch, and his mind had become clear enough he could pursue his task again.
After some tea.
5 notes · View notes
mymlstudies · 3 years ago
Text
Classification Tree
Project title:  Applied SAS classification tree using known dataset online (Week 1 Assignment)
Tumblr media
Decision tree analysis was performed to test nonlinear relationships among a series of explanatory variables and a binary, categorical response variable. All possible separations (categorical) or cut points (quantitative) are tested. A popular dataset for classification tree was used for illustration purpose only. Titanic dataset is perfect to try to create a decision tree. The goal is to create a relatively easy to make decision tree that will represent the response variable who will survived on the titanic illustrated using the decision tree. I took the liberty of excluding some columns from the original dataset that are considered to be unique text type data to focus on categorical and numerical data that are relevant to the decision tree. The following explanatory variables were included as possible contributors to a classification tree model evaluating survived experimentation (my response variable), PassengerId, Pclass, Sexnum, Age, SibSp, Parch, Fare, Embarkednum are the only columns used and coded. For the this survived analyses, the entropy “goodness of split” criterion was used to grow the tree and a cost complexity algorithm was used for pruning the full tree into a final subtree. Decision tree model shows AUC values of range 0.88 ~ 0.89 indicating considerable acceptable results. While also checking different random seed still giving similar decision tree and AUC to check bias-variance.
Tumblr media
The Sexnum was the first variable to separate the sample into two subgroups. Split between male and female. Giving relative & importance scores of (1, 11). Proving to be the most significant explanatory variable. From the train dataset females tends to survive 74% compared to males with only 19%. Of the Sexnum (gender), a further subdivision was made with the Pclass variable of 1st 2nd 3rd class. Wherein 1st and 2nd class more likely to survive for females. For males 2nd or 3rd class has a slight chance to survive.  The last important explanatory variable is Age. Showing high chance to survive for female above the age of 25 and very minimal chance for males ages 9 to 28. 
Tumblr media Tumblr media Tumblr media
Dataset for reference only
https://www.kaggle.com/c/titanic  
2 notes · View notes
chaolinchang · 5 months ago
Text
Milestone Assignment 2: Methods
Titanic
1. Sample:
Population and Sample Selection Criteria: The population from which the sample was drawn comprises passengers aboard the RMS Titanic during its maiden voyage in 1912. For this analysis, the sample includes the data available from the Titanic dataset sourced from Kaggle. The dataset contains information on 891 passengers.
Sample Size: The sample consists of 891 observations, each representing a passenger aboard the Titanic.
Description of the Sample: The sample includes individuals of various ages, genders, socio-economic statuses, and cabin locations. It encompasses a diverse range of passengers, from first-class elites to third-class immigrants, reflecting the socio-economic diversity aboard the Titanic.
2. Measures:
Description of Variables: The variables to be included in the analysis are as follows:
Survived: A binary variable indicating whether the passenger survived (1) or not (0) the sinking of the Titanic.
Pclass: A categorical variable representing the socio-economic status of the passenger, with values 1, 2, or 3 (first, second, or third class).
Sex: A categorical variable denoting the gender of the passenger, with values "male" or "female".
Age: A quantitative variable representing the age of the passenger in years.
Cabin: A categorical variable indicating the cabin location of the passenger.
Embarked: A categorical variable representing the port of embarkation for the passenger, with values "C" (Cherbourg), "Q" (Queenstown), or "S" (Southampton).
Variable Management: For the analysis, missing values in the "Age" variable will be imputed using appropriate techniques such as mean or median imputation. Additionally, the "Cabin" variable may be simplified or grouped into broader categories based on deck levels to enhance interpretability.
3. Analyses:
Statistical Methods: The analysis will involve descriptive statistics to summarize the characteristics of the sample, including measures of central tendency and dispersion for quantitative variables, and frequency distributions for categorical variables. Furthermore, inferential statistics such as chi-square tests and logistic regression will be employed to examine the relationships between the independent variables (e.g., socio-economic status, age, gender) and the dependent variable (survival).
Data Splitting: The dataset will be split into training and testing subsets to assess the performance of predictive models. The training set will be used to build the models, while the testing set will be used to evaluate their predictive accuracy.
Cross-Validation: K-fold cross-validation will be utilized to validate the predictive models and ensure their robustness. This technique involves partitioning the dataset into K equal-sized folds, with each fold used once as a validation set while the K - 1 remaining folds form the training set. This process is repeated K times, with each fold used as the validation set exactly once.
0 notes
curiouslich · 7 years ago
Text
Falling Stars
Tumblr media
It had been many years since Eridrain had been issued a challenge, even more since the time he accepted one. The memories of his last match were seared into his memory and body. His ruby tipped cane was a constant reminder of that fact. Entering the grand stadium under the magic city was a bittersweet memory, rows of stands and a single light that allowed all who gathered to witness the matches, and many had shown up to see this one.
A young upstart was looking to make a name for themselves, and they say if you kill you hero, that is a good place to start. Encendius hadn’t been seen in the arena for years, but there was still his record, that as a member of the three stars, they never lost a match.
But by himself he was not so lucky. While the mage was never unmasked, the brawls took many turns against him. Long ago in a masquerade match a particularly brutal strike of ice and rage pierced his leg. Despite healing the limp never left and as he stepped into the arena the tapping of his crutch this was evident.
Stumbling along his robe kissed the ground with gentle scrapes. Blacks, reds, and golds where his normal colors which led up to the most striking feature. The mask. A bisected line of black and ivory cleaved his face with a long orange circle adorning his forehead. Unlike his other partners in the Three Stars he was the one that stood out, a tall man specialized in summoning the heart of a small sun. He was “Encendius, the Blazing Star.”
His opponent however had been eager, far too eager to face him. The man once known as Encendius was a famed pyromancer with quick spellblade. Defeating him would make a name for any would be in the underground of Dalaran, on top of untold riches. A mountain of gold was put on the return of this legend to win, and for a few copper he could beat the odds.
Tap….tap….tap…
With slow methodical time Eridran marched, and now at the handful of stairs that lead up to the arena floor he came face to face with his masked advisory.
A silver face atop armor of steel and iron looked back. “Well well, so the ‘fallen’ Star has returned.” The voice was that of a youth, brash and looking to stir up his enemy. “I didn’t honestly think you would accept my challenge, or be this easily goaded into combat. I mean after all you denied so many before me?”
The silver mask brought met Encendius’ gaze. Pacing away he tsked as he chuckled. “Though I doubt this will be much of a match, a cane? You can barely walk,” Spinning to face Eridran he thrust out his finger in an accusing jab.”You should have stayed in retirement.”
The sneer on his face was apparent, he had already won this match in his mind, and finally bringing down this ‘star’ would bring untold glory. “But seeing as you felt the need to accept, I will return you to that state, shamed, and all the gold richer.” Throwing his hands up in the air those that had gathered cheered. Everyone wanted an upset, against the odds to watch a legend come back and fall, that would be worth paying.
Encendius gave his head a shake at the showboating. pushing off the ground he climbed the trio of stairs. Now on even ground with the man he rested both hands on the cane. His own mask hanging over his face. A disguise to hide emotion, thought, and identity. The hallmark of the duelists down here, and his was a reminder of what he had lost. One lover wearing the opposite of his design with a blue orb to mark the entropy, the other in a field of white to show the infinite of the stars.
“Shaking your head at me? You arrogant fool, can’t you see you lost already, you are in no shape to fight. You may have been decades ago, but you have lost that edge. You lost it when my father pierced your leg. You lost your edge the day you killed him.” The Silver youth hissed and boiled, the sight of his enemy so close was electric.
Eridran shook his head a second time. “I didn’t come here for a tale of your family problems.”
“Oh now what!? Going to posture at me you relic? You took my father, so I don’t want to be regaled with anything from you! Why don’t you remind us all of the tale of three stars.” There was no emotion given from the orange starred mask. “What was it? One Arcane, One Frost, and You. Never lost a match down here, not even once.” the crowd could hear the next jab coming. “That was, until your partners vanished. What was it that drove them away? Your rage? Your behavior with the mask gone? Maybe they were just tired of your shit? Watching you kill a man in cold blood creates rifts you know.”
Pacing closer and closer the silver mask taunted him, the slits of eyes gave away nothing but the sound of disdain and hatred. daring action from a crippled old elf. “Or was it something else, people found out who they were under the mask didn’t they?And with all those background bets and upsets that  got back to you. What do you expect happened to them? Left alone to defend for themselves…. I bet they screamed for you, you caused their death after all”
And here was the point of it all. A challenge for a fight was one thing, to insult him, his family, his work, none of that mattered. What did matter though, was the memories, of Vae, of Ara. closing his eyes for a moment he recalled their smiles. It was a pleasant thought. Against the claim that his hands held their blood. Truth was Eridran couldn’t say what happened to them, they both… just vanished.
“Ha~ I knew it! You are going to cry aren’t you! Weak old man clinging to the same that was stolen from me! Rumor was you were all lovers and once they were gone you were left a pathetic shell. The three of you were nothing without your tricks, and I plan to unmask you here, once and for all! So that everyone here can know the final star, and the identity behind everything!”
“You have committed a grave mistake. You brought up some memories I had long put behind me. And so yes, I accept your challenge. But I think we should give the crowd a real show. How about this, we fight to the end. Not of mana starvation, not of exhaustion, the final end. If you are so sure you can beat this ‘pathetic shell’ and his tricks, then why hide behind the safety of a mask?”
A chill ran down Silver’s spine. A fight to the death? It must have disturbed him, but it didn’t matter, he was injured, crippled by his father. And his tricks, a pair of flanking fire balls, that was far to played out, what could he do? This would be easy, and the bets quadrupled in a death match, he’d never have to work again. “So be it Encendius, I’ll enjoy killing you.”
A third shake of his head and the warlock tapped his cane. Raising a hand to the mask he pulled it away from his face, forfeiting the match before it even began. Tossing the concealment away his cold fel eyes fell on silver. “No, not Encendius, I accept the challenge under my name. Lord Eridan Dawnblade, Second in line for the Throne of Dawn. This is your last chance to surrender, go home with your tail between your legs before I have to teach you a lesson.”
Plated gloves clenched, the man’s face was all too familiar, this man had taught him in Dalaran, learned the basics of magic, and when his father was killed and he was left with no way to fund his education he even confided in this bastard. He was a role model, a mentor, and now, he was the enemy. He didn’t back down. “I accept this challenge, no way I can give up when justice and glory are in my hands.”
A final shake of his head, this was too much. “So be it then, I would say I like to teach my students lessons, but you won’t learn from this one.” Meeting the blank eyes of the Silver mask, “But you will be an example of your mistakes.”
Anger brimming inside Silver’s chest he practically spat out his thoughts. “Time to put you into the ground you relic!.”
Bringing a hand up to his glasses the former teacher threw them out of the ring, it forced him to squint at his rival.. Quickly following he tossed away the cane, a wobble came to his injured leg. Finally he pulled away at his robe, the cloth would hinder him, but it came with a brief shiver.
“You might want all of that… Oh, oh that’s it then, this is a death wish, unmasked, unequipped, and ready to die… what a treat, thank you ‘My teacher’.”
Eridran rose his hand to the officiator and with the cast of a barrier the match began. Saying nothing to the other gladiator as he danced his fingers in the shame of an 8, two loops binding and twisting.
Narrowing his eyes Silver started to channel his own spell, this was the same trick as always, and he had the perfect counter..
A faint voice and a memory of silver blonde hair whispered to him “...we’ll always be here for you Eridran!”
“Now don’t forget we love you…” the second just as melodious. Frost and stars danced around him, cold and warm, distant and close, just out of reach, but always around him.
A brief pair of tears fell down his face and with a smiling nod. “I’ll be there soon.”
His spell complete he thrust his hand forward and as predicted the pair of blazing orbs sprang to life. Quickly growing in mass they orbited around one another. Tossing each other in a helix before true to his name the suns were upon Silver.
“Pffft, same old tricks.” He know it, and clenching his plated gloves once more Silver shimmered against the spells and a cloak of purple white crept over him. A barrier to protect him from the heat, from their wrath, it was such an easy counter. What was he thinking this would neve…
It was sudden, it was quick, and it was over. The glimmering fel blade erupted from his back and streams of blood started to stain the steel armor. With the stars fading away they had never touched him. The sword though, that had hit his mark. Coughing up more blood his blurring vision once more fell on his old teacher “....how?”
Dismissing the spellblade Eridran let the dying boy fall to the ground. His smile unwavering even as his clothing was saturated with blood. He looked, at peace as his student bleed out.
“....Because not all masks are physical.”
@stormandozone @brothersemberfell @thesunguardmg
20 notes · View notes
titanticdata · 7 months ago
Text
Wesleyan University - Regression Modelling in Practice
Modul 3 - Step 1 Multiple Regression:
Iam having a response variable which is categorical=Survived. Therefore I chose a quantitative variable which is the Age.
I would think that there could be a connection to the variables Survived / Pclass / Fare. I think with lower Age there must be a higher chance of survival. Also younger people tend to have less money and have a lower Pclass and paid less Fare.
Result:
Tumblr media
Significant variables are based on the p-Values:
Survived p=0, ß=-6.71
Pclass p=0, ß=-11.5 for Pclass 2 and ß=-17.3 for Pclass 3
SibSp p=0, ß=-4.06
No significant variables are:
Sex
Embarked
Fare
Parch
The Model has a R2 of 27,9%.
less Age -> increased change of survival
less Age -> lower Passengerclass
Less Age -> decreased number of Siblings
Modul 3 - Step 2 Check Hypothesis:
My hypothesis was that with lower age they chance of survival should increase, the Pclass is low and the fare is low.
Compared to the results the fare is not significant and the Number of Siblings is also relevant, which makes sense.
Modul 3 - Step 3 Confounding variable available:
I checked the model again without the variable Survived:
Tumblr media
There you see that the variables Sex and Embarked getting significant as well. Therefore the variable Survived seems to be an confounding variable.
Modul 3 - Step 4 a. q-q plot:
Tumblr media
Modul 3 - Step 4 b. standardized residuals for all observations:
Tumblr media
Modul 3 - Step 4 c. leverage plot:
Tumblr media
Modul 3 - Step 4 d. Interpretation of Plots:
q-q plot:
The Residuals plot show at the left and right side of the plot a deviation against the normal distribution. There might be some interference with a different variable which is not in the model or it also could be that there is also an quadratic influence by a variable.
standardized residuals for all observations:
The residuals overall look good, no increased deviations, it looks like there are no outliers within the dataset.
Leverage plot:
There are no points with high leverage and high residiuals, therefore no outlier in the data available. The are only datapoints available with high leverage which influence the model.
0 notes
korammstonehoof · 7 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Nature Elementalist All Shamans have their preference of elements, even if they are unwilling to say so. Some lean towards the destructive sides of fire and earth, knowing that the elements will assist them in protecting that which needs protected. Some try and gain an equal understanding of all the elements, so that they may best assist any element which calls them to duty. And yet others will dive deep into the elements that they attune to the most, forging so strong a connection that it will never be severed. It is even said that these Shamans, these Elementalists, sometimes take on traits from their patron elements, showing vividly a connection so deep that it goes beyond mere description.
This was done for the Dawnmender Art in Action mission, to use images to illustrate out view of a Sunguard p-class. I decided to take a particular view of the Elementalist p-class, one that focuses on the healing aspects of water and earth, and their ability to help not only the sentient races of Azeroth, but also the natural world. After all, what are plants but the harmonious union of earth and water? This particular view of the p-class is one that I can see Koramm possibly taking in the future, as he deepens and regains his connection with the elements, and continues his work in trying to understand the various mysteries of Azeroth’s flora.
12 notes · View notes