Publications by Andrew Bowen

DATA 621: Blog 1

22.10.2023

Power Transforms in R The R-function boxCox from the car package can be used to implement maximum likelihood transformations of data when modeling. This can be used to transform data to create a more linear relationship between predictor and dependent variables. We’ll use the built-in mtcars dataset. Let’s plot our horsepower variable against o...

1236 sym Python (1443 sym/8 pcs) 10 img

DATA605 Final Project - Probability & Stats

17.05.2023

Problem 1 set.seed(1234) n <- 5 lambda <- 8 X <- rgamma(1:10000, shape=n, scale=1/lambda) Calculating our sum of exponential distributions: Y and Z: Y <- 0 for (i in 1:n){ Y <- Y + rexp(1:10000, rate=lambda) } Z <- rexp(1:10000, rate=lambda) Expected value and variance of our PDFs print(mean(X)) ## [1] 0.6228281 print(mean(Y)) ## [1] 0.6242317...

7472 sym 1 img

DATA605: Final Project - Regression

15.05.2023

Load our Datasets I uploaded the kaggle datasets to my GitHub, reading them here for reproducability. test_url <- "https://raw.githubusercontent.com/andrewbowen19/computationalMath605/main/data/test.csv" train_url <- "https://raw.githubusercontent.com/andrewbowen19/computationalMath605/main/data/train.csv" test <- read.csv(test_url) train <- read....

3082 sym 9 img

DATA605: Problem Set 14

07.05.2023

Question 1 Compute the taylor series (to order 4) of: \[\begin{aligned} f(x) = \frac{1}{1-x} \end{aligned}\] We can use the taylor function included in the calculus library within R for this. The above functon is valid everywhere except \(x=1\) f1 <- function(x){ 1 / (1 - x)} taylor(f1, var="x", order=4) ## $f ## [1] "(1) * 1 + (1.00000000000064...

839 sym

DATA605: Problem Set 13

27.04.2023

Question 1 Let’s pick our substitution function \(u = -7x\), so \(\frac{\,du}{\,dx} = -7\), meaning \(\frac{\,du}{-7} = \,dx\). Plugging in we get \[\begin{aligned} \int 4e^{-7x}\,dx = 4\int e^{-7x} \,dx\newline = 4\int \frac{1}{-7}e^{u} \,du\newline = \frac{-4}{7}\int e^u \,du \newline ...

3113 sym Python (796 sym/10 pcs) 1 img

DATA605: Univariate calculus

25.04.2023

Exercise 4.2.15 - Related Rates A company that produces landscaping materials is dumping sand into a conical pile. The sand is being poured at a rate of \(5 ft^3/s\); the physical properties of the sand, in conjunction with gravity, ensure that the cone’s height is roughly \(2/3\) the length of the diameter of the circular base. How fast is the ...

3293 sym

DATA605: Problem Set 12

22.04.2023

Read-in our CSV data # TODO: replace local file path with GitHub URL df <- read.csv("~/CUNY/computationalMath605/data/real-world-data.csv") head(df) ## Country LifeExp InfantSurvival Under5Survival TBFree PropMD ## 1 Afghanistan 42 0.835 0.743 0.99769 0.000228841 ## 2 Albania 71 ...

4222 sym 11 img

DATA605 Discussion Post Week 12

19.04.2023

Multiple Regression We can use the Seatbelts dataset built into R. First, we can set it up as a dataframe in R # Load the dataset into a dataframe df <- as.data.frame(Seatbelts) We can use the law variable as our dichotomous value, as this takes a value of 0 or 1, depending on if the seatbelt law was in effect that month. We want to predict the val...

2211 sym 6 img

DATA 605: Problem Set 11 - Regression

04.04.2023

Load the Cars Dataset First, let’s load the built-in cars dataset to a native R dataframe df <- as.data.frame(cars) head(df) ## speed dist ## 1 4 2 ## 2 4 10 ## 3 7 4 ## 4 7 22 ## 5 8 16 ## 6 9 10 Model Creation We can use R’s built-in linear model (lm) to create model <- lm(cars$dist ~ cars$speed) sum...

1601 sym 5 img

DATA605: Discussion Post Week 11

04.04.2023

Dataset For this exercise, I chose the faithful dataset which is available as an R dataset First, let’s load the built-in cars dataset to a native R dataframe df <- as.data.frame(faithful) head(df) ## eruptions waiting ## 1 3.600 79 ## 2 1.800 54 ## 3 3.333 74 ## 4 2.283 62 ## 5 4.533 85 ## 6 2....

1173 sym 4 img