Publications by Kossi Akplaka
Final Project
Import libraries Let’s load the necessary libraries library(readr) library(e1071) library(ggplot2) library(MASS) library(mice) Quantitative right skew variable and dependent variable Let’s start by loading the train.csv file and examining the numerical variables to identify one with right skewness. We’ll then select that variable as X ...
18437 sym Python (15555 sym/65 pcs) 2 img
Document 15
Exercise 1 x <- c(5.6, 6.3, 7, 7.7, 8.4) y <- c(8.8, 12.4, 14.8, 18.2, 20.8) # Fit linear regression model model <- lm(y ~ x) # Get coefficients of the regression line intercept <- coef(model)[1] slope <- coef(model)[2] # Print the equation of the regression line cat("Regression equation: y =", round(intercept, 2), "+", round(slope, 2), ...
7303 sym
Discussion 14
This document presents the Taylor Series expansions for the given functions. 1. \(f(x) = \frac{1}{1-x}\) This function is valid for \(|x| < 1\). The Taylor Series expansion for \(f(x)\) is: \[ f(x) = \sum_{n=0}^{\infty} x^n = 1 + x + x^2 + x^3 + \dots \] 2. \(f(x) = e^x\) This function is valid for all real numbers \(x\). The Taylor Series ex...
2468 sym
Discussion 12
Multiple regression model set.seed(123) n <- 100 x1 <- rnorm(n, mean = 50, sd = 10) # Quantitative predictor x2 <- sample(0:1, n, replace = TRUE) # Dichotomous predictor y <- 2*x1 + 0.5*x1^2 + 3*x2 + 0.5*x1*x2 + rnorm(n, mean = 0, sd = 5) # Dependent variable data <- data.frame(y, x1, x2) # Multiple regression model model <- lm(y ~ x1 ...
177 sym 1 img
Week 12
Import libraries library(tidyverse) library(readr) library(ggplot2) Question 1 Scatterplot of average life expectancy for the country in years vs sum of personal and government expenditures. # Get the data who_data <- read_csv("https://raw.githubusercontent.com/Kossi-Akplaka/Data605_Computational_mathematics/main/data605/Week%2012/who.csv") ...
8670 sym 2 img
Homework 11
Load data and build a model # Load the dataset data(cars) # Fit linear regression model model <- lm(dist ~ speed, data = cars) # Summary of the model summary(model) ## ## Call: ## lm(formula = dist ~ speed, data = cars) ## ## Residuals: ## Min 1Q Median 3Q Max ## -29.069 -9.525 -2.272 9.215 43.201 ## ## C...
1800 sym 1 img
Discussion 11
Generate data and fit the linear model # Generate data set.seed(123) x <- 1:100 y <- 2*x + rnorm(100, mean = 0, sd = 10) # Fit linear regression model model <- lm(y ~ x) summary(model) ## ## Call: ## lm(formula = y ~ x) ## ## Residuals: ## Min 1Q Median 3Q Max ## -24.5356 -5.5236 -0.3462 6.4850 20.9487 ...
189 sym 1 img
Week 10 Homework
Smith is in jail and has 1 dollar; he can get out on bail if he has 8 dollars.A guard agrees to make a series of bets with him. If Smith bets A dollars,he wins A dollars with probability .4 and loses A dollars with probability .6. Find the probability that he wins 8 dollars before losing all of his money if: (a) he bets 1 dollar each time (timi...
3560 sym
Week 9 Data 605
Exercise 1 Y1 <- 100 n <- 365 mu <- 0 sigma <- sqrt(1/4) # Probabilities prob_Y365_100 <- 1 - pnorm((100 - Y1) / sqrt(n * sigma^2)) prob_Y365_110 <- 1 - pnorm((110 - Y1) / sqrt(n * sigma^2)) prob_Y365_120 <- 1 - pnorm((120 - Y1) / sqrt(n * sigma^2)) # Output cat("Estimated probabilities:\n") ## Estimated probabilities: cat("Y365 >=...
4382 sym
Week 8
library(tidyverse) ## Warning: package 'ggplot2' was built under R version 4.3.2 Question 11 Page 303 # Set the parameters num_bulbs <- 100 lifetime <- 1000 # Expected time lifetime / num_bulbs ## [1] 10 Question 14 Page 303 Given that \(X_1\) and \(X_2\) are independent random variables, each with an exponential density function with par...
4243 sym