Publications by Budkhand
Fin_Inn Exercise1
Q1 library(wooldridge) data("bwght") # (i) Total women and women who smoked during pregnancy total_women <- nrow(bwght) women_smoked <- sum(bwght$smoke == 1) total_women ## [1] 1388 women_smoked ## [1] 0 # (ii) Average number of cigarettes smoked per day avg_cigarettes <- mean(bwght$cigs, na.rm = TRUE) avg_cigarettes ## [1] 2.087176 # (iii) Avera...
53 sym R (2345 sym/40 pcs)
Makeup test
library(glmnet) ## Loading required package: Matrix ## Loaded glmnet 4.1-8 set.seed(42) n <- 1000 p <- 5000 real_p <- 15 x <- matrix(rnorm(n*p), nrow=n, ncol=p) y <- apply(x[,1:real_p], 1, sum) + rnorm(n) train_rows <- sample(1:n, .66*n) x.train <- x[train_rows, ] x.test <- x[-train_rows, ] y.train <- y[train_rows] y.test <- y[-train_rows] ...
14 sym R (1955 sym/11 pcs)
Final_AFSP
Chapter 4 Q16 library(MASS) data("Boston") Boston$crim_above_median <- ifelse(Boston$crim > median(Boston$crim), 1, 0) set.seed(123) library(caTools) split <- sample.split(Boston$crim_above_median, SplitRatio = 0.7) train <- subset(Boston, split == TRUE) test <- subset(Boston, split == FALSE) logistic_model <- glm(crim_above_median ~ ., data = tra...
106 sym R (10381 sym/49 pcs) 2 img
Final Exam
Q1 library(lubridate) ## ## Attaching package: 'lubridate' ## The following objects are masked from 'package:base': ## ## date, intersect, setdiff, union library(timetk) library(purrr) library(quantmod) ## Loading required package: xts ## Loading required package: zoo ## ## Attaching package: 'zoo' ## The following objects are masked from 'p...
60 sym R (8583 sym/30 pcs)
in-class exercise 03
library(tidymodels) ## ── Attaching packages ────────────────────────────────────── tidymodels 1.2.0 ── ## ✔ broom 1.0.5 ✔ recipes 1.0.10 ## ✔ dials 1.2.1 ✔ rsample 1.2.1 ## ✔ dplyr 1.1.4 ✔ tibble 3.2....
43 sym R (11247 sym/39 pcs) 1 img
hw4
library(ISLR2) data(Smarket) names(Smarket) ## [1] "Year" "Lag1" "Lag2" "Lag3" "Lag4" "Lag5" ## [7] "Volume" "Today" "Direction" dim(Smarket) ## [1] 1250 9 summary(Smarket) ## Year Lag1 Lag2 Lag3 ## Min. :2001 Min. :-4.922000 Min. :-4.922000 ...
154 sym R (25421 sym/116 pcs) 3 img
Midterm exam
##Question 1 #(a) # Install required packages install.packages(c("psych", "tidyverse", "tidymodels", "vip", "ISLR2")) ## Installing packages into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3' ## (as 'lib' is unspecified) # Load required packages library(psych) library(tidyverse) ## ── Attaching core tidyverse packages ─────────...
106 sym R (15650 sym/61 pcs) 6 img
On class_4-18_budkhand
library(MASS) table(iris$Species) ## ## setosa versicolor virginica ## 50 50 50 lookup <- c(setosa='blue', versicolor='green', virginica='orange') col.ind <- lookup[iris$Species] pairs(iris[-5], pch=21, col="gray", bg=col.ind) lda.fit <- lda(Species ~ ., data = iris) lda.fit ## Call: ## lda(Species ~ ., data = iris) ...
18 sym R (1749 sym/13 pcs) 2 img
HW3
library(ISLR2) data(Smarket) names(Smarket) ## [1] "Year" "Lag1" "Lag2" "Lag3" "Lag4" "Lag5" ## [7] "Volume" "Today" "Direction" dim(Smarket) ## [1] 1250 9 summary(Smarket) ## Year Lag1 Lag2 Lag3 ## Min. :2001 Min. :-4.922000 Min. :-4.922000 ...
154 sym R (25421 sym/116 pcs) 3 img
Midterm exam part2
##Question 1 # Load libraries library(tidyquant) ## Loading required package: lubridate ## ## Attaching package: 'lubridate' ## The following objects are masked from 'package:base': ## ## date, intersect, setdiff, union ## Loading required package: PerformanceAnalytics ## Loading required package: xts ## Loading required package: zoo ## ## A...
110 sym R (19293 sym/55 pcs)