Posts

Showing posts from March, 2020

Linear Regression Prediction Model for predicting Graduate Admissions in Python with Scikit-Learn

The program code is used for prediction of  Graduate Admissions which uses the Linear Regression Model and cross-validation to split the dataset into training and testing data, including R squared to show how the data fit the model. The program code also allows the user to input it performs or scores to check whether he or she has the chance of admission. The dataset was downloaded from www.kaggle.com, below is the dataset download link; https://www.kaggle.com/mohansacharya/graduate-admissions #importing the essential libraries import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split #importing dataset df=pd.read_csv('Admission_Predict_Ver1.1.csv',index_col=0) #independent or explanatory variables feature_cols=['GRE Score','TOEFL Score','LOR','CGPA','Research'] X=np.array(df[feature_cols],dtype=np.float64) #dependent or response variable y...
Survival Analysis in Leukemia Patients Dataset in R (Practical) library(survival) library(KMsurv) library(MASS) setwd("C:\\Users\\LENOVO\\Desktop\\leukemia") leukemia <- read.delim("leukemia.txt", header = TRUE, sep = " ") leukemia #### KAPLAN-MEIER km= Surv(time = leukemia$Survtime, event = leukemia$Binary) km km1= survfit(km~1, data = leukemia) summary(km1) #### ESTIMATION OF CUMULATIVE HAZARD Km2= survfit(coxph(km~1), type="aalen") summary(Km2) plot(Km2, main=expression(paste("Kaplan-Meier-estimate ", hat(Lambda)(t))),  xlab="time(weeks)", ylab="cumulative hazard", fun="cumhaz", lwd=2) #### KAPLAN-MEIER for both group of the AG variables km3= survfit(km~AG, data = leukemia) print(km3) summary(km3) ### Logrank Test survdiff(km ~ AG,data=leukemia,rho=0)    ### Using Cox-PH to model the survival time fit = coxph(Surv(Survtime, Binary) ~ AG + WBC ,data=leukemia ,ties="b...