Room: 471 JMHH
Office: (215) 898-8222 (Leave a note with the administrator.)
Email: Click here for an image of the address. (The address 'buja@wharton...' is obsolete.)
Curriculum vitae:
[.pdf]
(a more fun alternative from
the 2004/5 MBA guide))
source("http://stat.wharton.upenn.edu/~buja/STAT-101/src-probability.R")Here are things that can be done:
X <- make.RV(1:6, rep("1/6",6)) # Create a fair die (class: "RV") Y <- make.RV(1:6, c(0.1,0.1,0.1,0.1,0.2,0.4)) # Create a loaded die ( '' ) P(X>3); P(Y>3) # Probabilities of events E(X); E(Y) # Expected values V(X); V(Y) # Variances SD(X); SD(Y) # Standard deviations par(mfrow=c(2,1)); plot(X); plot(Y) # Plot as pin graphs S <- SofI(X,Y); par(mfrow=c(1,1)); plot(S) # Sum of two independent RVs S10 <- SofIID(X,10); plot(S10) # Sum of 10 iid copies of X (works for many more => CLT) qqnorm(S10) # Normal quantile plot for RVs to check the CLT effect X.sim <- rsim(1000, X) # Simulate from X (class: "RVsim") plot(X.sim) # Plot simulated data as pin graph probs(X); props(X.sim) # Compare probabilites and simulated proportions E(X); mean(X.sim) # Compare expected value and mean SD(X); sd(X.sim) # Compare theoretical and observed std.dev. X2 <- X^2; X2; plot(X2) # univariate analytical transformation Yexp <- exp(Y); Yexp; plot(Yexp) # '' Yfair <- Y - E(Y); Yfair # Centering a RV: creates a fair game from a loaded die Z <- (X - E(X))/SD(X); Z; plot(Z) # z-scoring/standardizing a random variable Ybern <- con(ifelse(Y>3,1,0)) # Create a Bernoulli variable; 'con()' contracts values/probsCheck the header of the source file for more explanations and examples.
source("http://stat.wharton.upenn.edu/~buja/PAPERS/src-conspiracy-animation2.R")See what happens as deterministic responses Y, one linear and the other nonlinear, are fitted by a linear function of X, from dataset to dataset. The point: Y is error-free, only X has randomness.
source("http://stat.wharton.upenn.edu/~buja/association-navigator.R")
currencies <- read.csv("http://stat.wharton.upenn.edu/~buja/DATA/Currencies-2006-2016.csv")
currencies.nav <- a.nav.create(currencies)
a.nav.run(currencies.nav)
install.packages("http://stat.wharton.upenn.edu/~buja/PAPERS/PoSI_1.0.tar.gz", repos=NULL, type="source")Then play with the examples at the end of the help page,
help(PoSI)and cannibalize them for your purposes.