Publications by Habib Khan
Data 605 - Final Examination
library(knitr) library(pracma) library(kableExtra) library(tidyr) library(ggplot2) library(data.table) library(DT) library(psych) library(scales) library(corrplot) library(dplyr) library(stringr) library(matrixcalc) library(MASS) Problem 1 1.1 Random variables Using R, generate a random variable X that has 10,000 random uniform num...
6283 sym R (26134 sym/81 pcs) 12 img 2 tbl
Data 605 - Week 15 Discussion
knitr::include_graphics('15_d.png') ...
6 sym R (35 sym/1 pcs) 1 img
Data 605 - Assignment 15
Assignment 15 1 x <- c(5.6, 6.3, 7, 7.7, 8.4) y <- c(8.8, 12.4, 14.8, 18.2, 20.8) # regression ans1 <- lm(y ~ x) summary(ans1) ## ## Call: ## lm(formula = y ~ x) ## ## Residuals: ## 1 2 3 4 5 ## -0.24 0.38 -0.20 0.22 -0.16 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (In...
70 sym R (996 sym/7 pcs) 1 img
Data 605 - Assignment 14
Assignment 14 knitr::include_graphics('14.png') Problem 1 library(pracma) eq <- function(x) {1/(1-x)} prob1 <- taylor(eq, x0=0, n=4) prob1 ## [1] 1.000029 1.000003 1.000000 1.000000 1.000000 Problem 2 eq2 <- function(x) {exp(x)} prob2 <- taylor(eq2, x0=0, n=4) prob2 ## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000 Problem 3 e...
58 sym R (424 sym/7 pcs) 1 img
Data 605 - Week 13 Discussion2
Problem 7.6 Find the volume of y = 5x from 1 to 2, rotated around the x axis I found it easier to calculate using R library(stats) step1 <- function(x){5 * x} step2 <- function(x){pi * step1(x)^2} integrate(step2,1,2) ## 183.2596 with absolute error < 2e-12 ...
123 sym R (147 sym/2 pcs)
Data 605 - Week 13 Discussion
Week 13 Discussion - Multiple Regression using R Using R, build a multiple regression model for data that interests you. Include in this model at least one quadratic term, one dichotomous term, and one dichotomous vs. quantitative interaction term. Interpret all coefficients. Conduct residual analysis. Was the linear model appropriate? Why or wh...
1510 sym R (4022 sym/16 pcs) 4 img 1 tbl
Data 605 - Assignment 12
Week 13 Assignment - Multiple Regression in R # Loading the data data <- read.csv("who.csv", header = TRUE) glimpse(data) ## Observations: 190 ## Variables: 10 ## $ Country <fct> Afghanistan, Albania, Algeria, Andorra, Angola,... ## $ LifeExp <int> 42, 71, 71, 82, 41, 73, 75, 69, 82, 80, 64, 74,... ## $ InfantSurvival <dbl> ...
1311 sym R (4608 sym/21 pcs) 5 img 1 tbl
Data 605 - Week 12 Discussion
Introduction The dataset has been taken from Kaggle’s famous Titanic dataset where I will going to see linear regression between age and fare ticket. I want to see if a passenger’s age had any relationship with the affordability of fare. library(tidyr) library(dplyr) ## ## Attaching package: 'dplyr' ## The following objects are masked from...
835 sym R (2094 sym/10 pcs) 2 img
Data 605 - Week 10 Discussion
knitr::include_graphics('10.1.png') # Calculating N Q <- matrix(c(0, 0.5, 0.25, 0.5), ncol=2, byrow= T) I <- diag(2) IQ <- I - Q N <- solve(IQ) print(N) ## [,1] [,2] ## [1,] 1.3333333 1.333333 ## [2,] 0.6666667 2.666667 The expected number of nice days and snowy days before rain starts are 0.6667 and 2.667 respectively. #...
275 sym R (517 sym/7 pcs) 1 img
Data 605 - Week 9 Discussion
Problem 10 from Page 339 Find the probability that among 10,000 random digits the digit 3 appears not more than 931 times. times <- 931 random <- 10000 prob <- 1/10 mu <- random*prob a_sq <- (random*prob)*(1-prob) a <- sqrt(a_sq) answer <- (times-mu)/a pnorm(answer)*100 ## [1] 1.072411 Probability that among 10,000 random digits the dig...
210 sym R (173 sym/2 pcs)