Re: [R] Lattice + Word: Changing .wmf files to .pdf files

2008-06-05 Thread Soukup, Mat
Hi All,

I'm by no means an expert on anything related to M$ products... However
I was recently forced (reluctantly at that) to put together a PPT
presentation which included multiple R graphics. So I thought I'd share
what I found to produce decent looking graphics.

I created all the graphics from R as PDF files making sure to size them
accordingly by using the height and width arguments in the pdf function.
I would then open the graphics with Acrobat Professional and use the
snapshot tool (camera icon) to copy the image. This image was then
easily pasted into PPT (or Word in your case) which looked quite well.
At least this seemed to work out all right on my Windows XP PC.

Hope this helps,

-Mat

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Mike Prager
Sent: Thursday, June 05, 2008 9:38 AM
To: [EMAIL PROTECTED]
Subject: Re: [R] Lattice + Word: Changing .wmf files to .pdf files

Jim Price [EMAIL PROTECTED] wrote:

 [...]
 Currently we are using windows metafile format for in-text tables for
 reports created in Word. However, we've discovered some artifactual
lines
 being created in our final output once the Word document is changed to
PDF.
 The process is as follows:
 [...]
 
 If any one can shed enlightenment (or suggest an alternative approach
that
 preserves decent fidelity - we've struggled with postscript files in
the
 past, but this may be our opportunity to try them out again), it would
be
 much appreciated.

The best approach depends on how much you care about the Word
files looking their best before conversion, vs. caring most
about the PDF.

If you care most about the PDF, you can save your graphics as
EPS files from R (either by using the postscript device or the
savePlot function with type = eps).  I tried one EPS file, and
found that Word 2007 imported EPS better than some older
versions. When I converted to PDF, the graphic was sharp and
clear. The downside of this approach is that before the
conversion Word displays the EPS graphic as a rough bitmapped
preview -- quite workable, but not suitable for final version.

If you want both Word and PDF versions to look good, there is no
perfect solution. You could try generating the graphics as PNG,
which will look good (but not great) in both places. That
approach will likely increase file sizes considerably.

Hope that helps.

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Appropriate measure of correlation with'zero-inflated' data?

2007-10-25 Thread Soukup, Mat
While I can't help much in the way of assessing the correlation (at
least in a numerical sense), I have provided some code below to
visualize the data bringing in an additional variable for the preseason
ranking of the team according to the AP poll as it appears here:
http://sports.espn.go.com/ncf/rankingsindex?seasonYear=2007weekNumber=1
seasonType=2) - Note that I did not double check my transcriptions of
the preseason rankings so I do not guarantee my accuracy.

Here's the R code to create the graphic.

load('BCS.RDA')
# Add pre-season ranking via the AP Top 25
BCS$preseason -
c(11,28,2,36,29,8,3,9,NA,35,6,1,26,46,40,29,23,13,4,5,12,18,NA,
   32,7,34,16,14,24,7,44,43,41,25,NA,NA,37,NA,17)
   
rankp - c(BCS$UR, BCS$HR, 1:dim(BCS)[1], BCS$preseason)
comp - rep(BCS$Cavg, 4)
poll - rep(c('Harris','USA Today','BCS','Pre-Season'),
each=dim(BCS)[1])

dat - data.frame(Rank=rankp, Cavg=comp, poll=poll,
school=rep(rownames(BCS),4))

dat$schoolordered - factor(dat$school, levels=rownames(BCS),
labels=rownames(BCS), order=TRUE)

bigcavg - sort(BCS$Cavg)[29:39]

library(lattice)
new.back - trellis.par.get(background)
new.back$col - white
newcol - trellis.par.get(superpose.symbol)
newcol$col - c('red','blue','black','green4','black')
newcol$pch - c(4,1,16,6)
new.pan - trellis.par.get(strip.background)
new.pan$col - c('grey90','white')
trellis.par.set(background, new.back)
trellis.par.set(superpose.symbol, newcol)
trellis.par.set(strip.background,new.pan)
  
xyplot(Cavg ~ Rank|schoolordered, group=poll, 
   data=subset(dat, Rank = 20),
   type=c('p'),
   xlim=c(-1.5,21.5),
   panel=function(x,y,...){
panel.abline(h=bigcavg, col='grey80')
panel.abline(v=seq(0,20,5), col='grey60')
panel.superpose(x,y,...)
},
xlab='Poll Rank',ylab='Computer Average',
key=list(
 
points=list(col=trellis.par.get('superpose.symbol')$col[1:4],
 
pch=trellis.par.get('superpose.symbol')$pch[1:4]),
text=list(lab=sort(unique(poll)),
 
col=trellis.par.get('superpose.symbol')$col[1:4]),
columns=4, title='Poll System', cex=1)
)

Notes on the output
1) Panels are arranged in order of BCS standing which is also
characterized by the red x.
2) The top 10 Cavg scores are provided as horizontal lines in each
panel.
3) For clarity I took a subset of the original data set only looking at
rankings = 20.

Some comments
1) Arizona State: While 1-3 are consistent, AZ St. polls differ quite a
bit w/ the BCS ranking being pulled up by the computers.
2) USC and OK St. and GA: Both have lower Cavg scores, but high human
polls (Harris and USA Today) which tend to coincide w/ the preseason
ranking.
3) As for bias, #2 seems to show some bias in the human polls, though I
would not say the computer ranking is not w/o flaw.

Basically, I can't find the magic bullet, and I imagine the debate will
continue on what is the best way to determine the two best teams to play
for the championship - a far from perfect scenario. Yet another debate
of the use of Super Crunching if I may borrow from Ian Ayres. Open to
any ideas/opinions.

Cheers,

-Mat

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Horace Tso
Sent: Thursday, October 25, 2007 3:39 PM
To: R Help; Douglas Bates
Subject: Re: [R] Appropriate measure of correlation with'zero-inflated'
data?

Doug and the football fans out there,

I'm no football expert myself. But here is what my colleague said after
reading the posting. 

I can't help you with the equation, but I can say that the polls are
very poor predictors of performance.  The reason they do such a bad job
is that pollsters rank the teams even before the season starts based on
perceived talent.  That ranking system makes it hard for a team to move
up the polls as long as the teams in front of them keep winning.  Also,
polling introduces many personal biases.
 
College football could easily solve the problem with a play-off system,
but the powerful football conferences wouldn't make as much money, so
they won't agree to it.  

Cheers.

Horace

 Douglas Bates [EMAIL PROTECTED] 10/25/2007 10:58:24 AM 
I have reached the correlation section in a course that I teach and I
hit upon the idea of using data from the weekly Bowl Championship
Series (BCS) rankings to illustrate different techniques for assessing
correlation.

For those not familiar with college football in the United States
(where football refers to American football, not what is called
soccer here and football in most other countries) I should explain
that many, many universities and colleges have football teams but each
team only plays 10-15 games per season, so not every team will play
every other team.  The game is so rough that it is not feasible to
play more than one match per week and a national playoff after the
regular season is impractical.  It would take too 

[R] Position Openings at the U.S. Food and Drug Administration

2007-09-24 Thread Soukup, Mat
The Office of Biostatistics in the Office of Translational Sciences,
Center for Drug Evaluation and Research, FDA, invites applications from
statisticians with a background in biomedical, biological, or
pharmacological sciences and strong skills in statistical methodology
and communication.

The formal job announcement is available at www.usajobs.gov - enter
FDA-09-07-109 in the search box. This announcement contains details
about the position, qualifications, and information about applying. If
you have any other questions, I would be happy to assist in anyway.

Thanks,

-Mat

***
Mat Soukup, Ph.D.
Food and Drug Administration
10903 New Hampshire Ave. 
BLDG 22 RM 5329
Silver Spring, MD 20993-0002
Email: [EMAIL PROTECTED]
***


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.