Skip to content
May 10, 2012 / tninja1980msn

showoff2.org

Let’s do a linear regression

x <- runif(1000) * 100
y <- x * 5 + rnorm(1000)
fit <- lm(y ~ x)
library(ascii)
print(ascii(summary(fit)), type='org')

|             | Estimate | Std. Error | t value | Pr(> \vert t \vert ) |
|-------------+----------+------------+---------+----------------------|
| (Intercept) | -0.03    | 0.06       | -0.43   | 0.67                 |
| x           | 5.00     | 0.00       | 4408.99 | 0.00                 |

Let’s do a pca

x <- runif(1000) * 100
y <- x * 5 + rnorm(1000)
z <- runif(1000); w <- rnorm(1000)
df <- cbind(x, y, z, w)
p <- prcomp(t(df))
plot(p)

https://tninja1980msn.files.wordpress.com/2012/05/wpid-pca.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: