ChatGPT python code for distribution fitting

I asked ChatGPT for some python code to do distribution fitting and this is what it provided. I think I needed to edit it to fix some errors but it’s a nice solution. First, I wanted to put in some R code that will allow me to display the results in blogdown, which is what I’m using to post to this site. library(knitr) library(reticulate) knitr::knit_engines$set(python = reticulate::eng_python) The following python code was used for distribution fitting. [Read More]

Copula Example

Trying an introduction to copulas exercise, from (R-excerises), using the dataset (https://www.kaggle.com/datasets/gtouzin/samplestocksreturn) Exercise 1 We’ll start by fitting the margin. First, do a histogram of both Apple and Microsoft returns to see the shape of both distributions. returns <- read.csv("returns_00_17.csv") hist(returns$Apple) hist(returns$Microsoft) Exercise 2 Both distributions seems symmetric and have a domain which contain positive and negative values. Knowing those facts, use the fitdist() function to see how the normal, logistic and Cauchy distribution fit the Apple returns dataset. [Read More]

Random Number Generator

I wanted to generate a set of random numbers without resorting to the rand() function in excel. I didn’t want results to change each time I opened the file but I wanted a way to seed different values when needed. I found this paper by Michael Lampton, Space Sciences Lab, UC Berkeley: https://research.ssl.berkeley.edu/~mlampton/RandomSpreadsheet4.pdf The paper has a formula for producing a set of random values using a modulus function on a large number while maintaining portability of such randomly generated numbers between different software and hardware platforms. [Read More]

Google Data Analytics Certificate

I’ve finally completed the Coursera Google Data Analytics Certificate. I think the course is great for beginners in data analytics. For me it was a great refresher on SQL and R but the other sections were not all that useful. The course did motivate me to learn R (again) and this blog site is probably a result of that. I think the course could use more on statistical thinking and spending more time on probability since data analysts could really use that in their work. [Read More]