Skip to content

Instantly share code, notes, and snippets.

@tonussi
Created September 10, 2012 02:01
Show Gist options
  • Save tonussi/3688416 to your computer and use it in GitHub Desktop.
Save tonussi/3688416 to your computer and use it in GitHub Desktop.
prob
x=c(3,5,6,7,8)
y=c(10,14,20,18,55)
x+y
z=c(x,y)
sum(x)
mean(x)
var(x) #Like var this uses denominator n - 1.
sd(x)
power(sd(x))
plot(x,y)
pie(x,col="lightred")
barplot(x,col="lightblue")
median(x,na.rm=TRUE)
ecdf(x)
mean(x) + mean(y)
mean(x) - mean(y)
mean(x) * mean(y)
mean(x) / mean(y)
mean(x) ^ mean(y)
mean(x) %% mean(y)
mean(x) %/% mean(y)
sd(4000:20000) ^ 2
x <- -1:12
x + 1
2 * x + 3
x %% 2
x %/% 5
myData=read.table("pedometer.csv", header=TRUE, sep=",")
x=hist(myData$Steps,col="lightblue")
x=hist(myData$Steps,breaks=20,col="lightblue")
plot(myData$Steps ~ myData$Observation,col="blue")
myModel=lm(myData$Steps ~ myData$Observation)
summary(myModel)
lines(fitted(myModel))
lines(fitted(loess(myModel)),col="red")
require(stats)
require(graphics)
xx <- -9:9
plot(xx,sqrt(abs(xx)), col="red")
lines(spline(xx, sqrt(abs(xx)), n=101), col="pink")
log(exp(3))
log10(1e7)
x<-10^-(1+2*1:9)
cbind(x,log(1+x), log1p(x), exp(x)-1, expm1(x))
@tonussi
Copy link
Author

tonussi commented Sep 10, 2012

prob&est

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment