2017年9月6日星期三

When X'X is invertible

X'X is always positive semidefinite, because for any nonzero a, a'X'Xa = (Xa)'(Xa) = ||Xa||2 >= 0. Moreover, Xa = 0 (and hence ||Xa||2 = 0) if and only if the columns of X are linearly dependent, so if X has full column rank then X'X is positive definite.
Every positive definite matrix is invertible, because if Ax=0 for x =/= 0 then x'Ax = dot(x, 0) = 0 which means A is not positive definite.
Therefore, if X has full column rank then X'X is invertible

2017年9月4日星期一

A SAS macro to run restricted cubic spline Cox model

https://www.hsph.harvard.edu/donna-spiegelman/software/lgtphcurv9/

http://www.sciencedirect.com/science/article/pii/S0169260797000436

http://epidemiologymatters.org/epidemiology-we-like/methods/spline-regression/


2017年9月3日星期日

Bayesian regression compare to other regressions

https://stats.stackexchange.com/questions/252577/bayes-regression-how-is-it-done-in-comparison-to-standard-regression

2017年8月31日星期四

Review some Monte Carlo theorems

1.
Suppose the random variable U has a uniform (0,1) distribution.
Let F be a continuous distribution function. Then the random variable X = F^(-1)(U)
has distribution function F.

Note: F(x)=(x-a)/(b-a), for uniform random variable at [a,b] interval. Here F(u)=u.

2.Monte Carlo Integration

generate x1, x2,...,xn from uniform(a,b), then compute Yi = (b - a)g(Xi). Then mean Y is a consistent estimate of the integral

Note: 1. definite integral is a number.

3. Accept-Reject Generation Algorithm