# Quantile plots # Normal quantile qqmath( ~ Income, prestige ) qqmath( ~ Education, prestige ) qqmath( ~ Women, prestige ) qqmath( ~ Prestige, prestige ) qqmath( ~ Income, prestige , dist = qunif) qqmath( ~ Education, prestige , dist = qunif ) qqmath( ~ Women, prestige, dist = qunif ) qqmath( ~ Prestige, prestige , dist = qunif ) plot( prestige, ask = F ) # defining a function in S-Plus pow <- function( x , power = 1 ) { if ( power == 0 ) ret <- log(x) else ret <- ( x^power - 1 ) / power ret } pow pow( 1:3 ) pow(1:3, 0) pow(1:3, -2) x <- (1:10)/5 matplot(x , cbind( pow(x,2) , pow(x,1) , pow(x,1/2) , pow(x,0), pow(x,-1/2), pow(x, -1)) , type = 'l') qqmath( ~ Income, prestige ) qqmath( ~ log(Income), prestige) qqmath( ~ sqrt(Income), prestige) summary( prestige$Income ) qqmath( ~ log( Income + 1000 ), prestige ) # adding a constant 'weakens' # powering down transformations # Transforming to linearity xyplot( Income ~ Education, prestige) xyplot( Income ~ Education, prestige, panel = function(x,y,...) { panel.xyplot( x,y,...) panel.loess(x,y,span = 1/3,...) }) xyplot( log(Income) ~ Education, prestige, panel = function(x,y,...) { panel.xyplot( x,y,...) panel.loess(x,y,...) }) xyplot( log(Income + 1000) ~ Education, prestige, panel = function(x,y,...) { panel.xyplot( x,y,...) panel.loess(x,y,...) }) xyplot( sqrt(Income) ~ Education, prestige, panel = function(x,y,...) { panel.xyplot( x,y,...) panel.loess(x,y,...) })