Publications by Lin Li
Document
A box contains 54 red marbles, 9 white marbles, and 75 blue marbles. If a marble is randomly selected from the box, what is the probability that it is red or blue? Express your answer as a fraction or a decimal number rounded to four decimal places. P(red or blue) = 0.9348 You are going to play mini golf. A ball machine that contains 19 green g...
5043 sym
Document
Problem Set 1. library(knitr) Verify using R that SVD and Eigenvalues are related as worked out in the weekly module. Given a 3 × 2 matrix A \(\quad A \ =\quad \begin{bmatrix} \ \ \ \ 2\ \ \ 2 \ \ \ 3 \ \ \\ -1\ \ 0 \ \ \ 4 \end{bmatrix}\) \(\begin{bmatrix} \ \ \ \ 1\ \ \ -1 \ \ \\ -2\ \ \ \ 0\ \\3\ \ \ \ \ 4\end{bmatrix}\) Write code...
883 sym R (1968 sym/13 pcs)
Document
Problem Set 1 # 1. What is the rank of matrix A? library(quhomology) A <- matrix( c(1,2,3,4, -1,0,1,3, 0,1,-2,1, 5,4,-2,-3), nrow = 4, ncol = 4, byrow = TRUE ) # a. Transform matrix A to reduced row echelon form: reduced_echelon <-rref(A, verbose = F) reduced_echelon ## [,1] [,2] [,3] [,4] ## [1,] 1 0 ...
37 sym R (2582 sym/12 pcs)
Document
1. Problem Set 1 # 1. Calculate the dot product u.v where u = [0.5; 0.5] and v = [3; −4] u <- c(0.5, 0.5) v <- c(3, -4) DotProduct <- u %*% v DotProduct ## [,1] ## [1,] -0.5 # 2. What are the lengths of u and v? Please note that the mathematical notion of the length of a vector is not the same as a computer science definition. Len_of_u <-...
64 sym R (2273 sym/13 pcs)
Document
Introduction Climate change presents significant challenges to ecological conservation, scientists are looking to model projections of species distributions under climate change to learn species’ resilience and response to changes in the environment, thus to inform management strategies. Species distribution models can be constructed in a varie...
1397 sym R (5118 sym/27 pcs) 3 img
Document
Problem Set 2 # Write an R function to factorize a square matrix A into LU or LDU # A = U * L matrix_factorization <- function(A) { L <- matrix( c(1, 0, 0, NA, 1, 0, NA, NA, 1), nrow = 3, ncol = 3, byrow = TRUE ) L21 <- -A[2,1] / A[1,1] A[2,] <- A[2,] + A[1,] * L21 L31 <-...
21 sym R (868 sym/3 pcs)
Document
#Introduction to Probability-Exercise 1 page 12 #1 Modify the program CoinTosses to toss a coin n times and print out after every 100 tosses the proportion of heads minus 1/2. Do these numbers appear to approach 0 as n increases? CoinTosses <- function(n){ coin <- c("heads","tails") toss <- sample(coin, size = n, replace = TRUE) count...
1363 sym R (524 sym/4 pcs)
Document
library(knitr) Choose independently two numbers B and C at random from the interval [0, 1] with uniform density. Prove that B and C are proper probability distributions. Note that the point (B,C) is then chosen at random in the unit square. Find the probability that B + C < 1/2. The probability is 0.5. We define B + C = Z. This is equivalent to ...
1361 sym R (164 sym/3 pcs) 1 img
Document
Obtained data behind the story *Higher Rates Of Hate Crimes Are Tied To Income Inequality from FiveThirtyEight: *The acutal study used multivarite linear regression to figure out which of the variable(s) are significant in hate incidents across the country. For the purpose of this exercise, a simple linear regression was generated to see the rel...
918 sym R (3978 sym/9 pcs) 3 img
Document
Using the “cars” dataset in R, build a linear model for stopping distance as a function of speed and replicate the analysis of your textbook chapter 3 (visualization, quality evaluation of the model, and residual analysis.) The ‘mtcars’ dataset # load and explore dataset: data("mtcars") head(mtcars) ## mpg cyl disp h...
1099 sym R (1877 sym/10 pcs) 4 img