Re: [R] What solve() does?

2010-09-04 Thread Paul Johnson
On Wed, Sep 1, 2010 at 5:36 AM, Petar Milin pmi...@ff.uns.ac.rs wrote: Hello! Can anyone explain me what solve() function does: Gaussian elimination or iterative, numeric solve? In addition, I would need both the Gaussian elimination and iterative solution for the course. Are the two built in

[R] Please explain do.call in this context, or critique to stack this list faster

2010-09-04 Thread Paul Johnson
that compares the speed of various approaches. If you send yet more ways to do this, I will add them on and then post the result to my Working Example collection. ## stackMerge.R ## Paul Johnson pauljohn at ku.edu ## 2010-09-02 ## rbind is neat,but how to do it to a lot of ## data frames? ## Here

Re: [R] Save data as .pdf or .JPG

2010-09-04 Thread Paul Johnson
On Wed, Sep 1, 2010 at 7:56 AM, khush bioinfo.kh...@gmail.com wrote: Hi all , I have following script to plot some data. plot( c(1,1100), c(0,15), type='n', xlab='', ylab='', ylim=c(0.1,25) , las=2) axis (1, at = seq(0,1100,50), las =2) axis (2, at = seq(0,25,1), las =2) When I

Re: [R] coxph and ordinal variables?

2010-09-08 Thread Paul Johnson
run it with factor() instead of ordered(). You don't want the orthogonal polynomial contrasts that result from ordered if you need to compare against Stata. I attach an R program that I wrote to explore ordered factors a while agol I believe this will clear everything up if you study the

[R] Fast / dependable way to stack together data frames from a list

2010-09-08 Thread Paul Johnson
, and the relative speed of the different approaches has never differed much. If you run this, I hope you will feel smarter, as I do! :) ## stackListItems.R ## Paul Johnson pauljohn at ku.edu ## 2010-09-07 ## Here is a test case df1 - data.frame(x=rnorm(100),y=rnorm(100)) df2 - data.frame(x=rnorm(100

Re: [R] coxph and ordinal variables?

2010-09-10 Thread Paul Johnson
are still trying to understand what 'orthogonal polynomial' means, I suggest you run the following through. I thought it was an enlightening experience. # Paul Johnson paulj...@ku.edu Nov. 16, 2005 # Ordinal predictors with a small number of possible values # Here is R code and commentary about

Re: [R] Problems with pdf device using plot glht function on multcomp library.

2010-09-18 Thread Paul Johnson
Hi, Kenneth It is not clear if you mean that your pdf output usually works, but it does not in this special case, or that this is a first effort with pdf. The answer might depend on which is the case case. If you are just getting started, can I refer you to some lecture notes I made about

Re: [R] How to find the interception point of two linear fitted model in R?

2009-10-21 Thread Paul Johnson
On Wed, Oct 21, 2009 at 12:09 PM, FMH kagba2...@yahoo.com wrote: Dear All, Let have 10 pair of observations, as shown below. ## x - 1:10 y - c(1,3,2,4,5,10,13,15,19,22) plot(x,y) ## Two fitted  models, with ranges of [1,5] and [5,10], can be

[R] spss imports--trouble with to.data.frame

2009-11-13 Thread Paul Johnson
variables that have levels like none, 1, 2,...9, total. ## Paul Johnson ## November 13, 2009 ## A question arose in the lab. A student asks I want ## to compare the answers from two different editions ## of the European Social Survey. ## I will add this to Stuff Worth Knowing later, but ## I can

Re: [R] gregmisc library (Mandriva)

2009-11-15 Thread Paul Johnson
On Sat, Oct 3, 2009 at 9:18 AM, chi ball c...@hotmail.it wrote: Hi, I'm not able to find a rpm of gregmisc library (2.0.0)  for Linux Mandriva 2008 Spring. Any suggestion? Thanks If you don't find an up to date RPM, either you have to learn how to build an RPM or just install the package

[R] plotmath vector problem; full program enclosed

2010-07-06 Thread Paul Johnson
, thanks in advance for your help, sorry if I've made an obvious mistake or overlooked a manual. ### Filename: plotMathProblem.R ### Paul Johnson July 5, 2010 ### email me paulj...@ku.edu sigma - 10.0 mu - 4.0 myx - seq( mu - 3.5*sigma, mu+ 3.5*sigma, length.out=500) myDensity - dnorm(myx

Re: [R] how to save summary(lm) and anova (lm) in format?

2010-07-06 Thread Paul Johnson
There are R packages that can make nice R regression tables in LaTeX documents. I've used memisc and its good, there is also apsrtable and the old standby xtable. Also I use my own function outreg, but that's just a 'not invented here' attitude. Your problem is that you need this to go into

Re: [R] plotmath vector problem; full program enclosed

2010-07-07 Thread Paul Johnson
On Tue, Jul 6, 2010 at 12:41 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 06/07/2010 10:54 AM, Paul Johnson wrote: Here's another example of my plotmath whipping boy, the Normal distribution. You want as.expression(b1), not expression(b1).  The latter means the expression

Re: [R] plotmath vector problem; full program enclosed

2010-07-07 Thread Paul Johnson
: plotMathProblem.R ### Paul Johnson July 7, 2010 ### email me paulj...@ku.edu sigma - 10.0 mu - 4.0 myx - seq( mu - 3.5*sigma, mu+ 3.5*sigma, length.out=500) myDensity - dnorm(myx,mean=mu,sd=sigma) ### xpd needed to allow writing outside strict box of graph ### Need big bottom margin to add

Re: [R] permutations of a binary matrix with fixed margins

2007-10-02 Thread Paul Johnson
Jérôme, As a first attempt, how about the function below. It works (or not) by randomly sorting the rows and columns, then searching the table for squares with the corners = matrix(c(1,0,0,1),ncol=2) and subtracting them from 1 to give matrix(c(0,1,1,0),ncol=2) (and vice versa). Randomized

[R] Interaction Terms versus Interaction Effects in logistic regression

2008-03-19 Thread Paul Johnson
I would like to know more about the output from the terms option in predict(), especially for a glm. And especially when there is an interaction effect being considered. Here's why I ask. These articles were recently brought to my attention. They claim that just about everybody who has reported

[R] as.numeric(.) returns 0

2008-06-12 Thread Paul Johnson
_ Paul Johnson Robertson Centre for Biostatistics University of Glasgow Glasgow G12 8QQ, UK [EMAIL PROTECTED] http://www.stats.gla.ac.uk/~paulj/index.html http://www.rcb.gla.ac.uk/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] restricted coefficient and factor in linear regression.

2008-06-15 Thread Paul Johnson
On Sat, Jun 14, 2008 at 7:49 AM, Oh Dong-hyun [EMAIL PROTECTED] wrote: Hi, my data set is data.frame(id, yr, y, l, e, k). I would like to estimate Lee and Schmidts (1993, OUP) model in R. My colleague wrote SAS code as follows: ** procedures for creating dummy variables are omitted ** **

Re: [R] R vs. Bugs

2008-06-22 Thread Paul Johnson
Hey, good topic for a thread. I've wrestled with this over the years. I think there's some user confusion about what WinBUGS does. People who did not see BUGS before WinBUGS tend not to understand this in the same way... The unique / important contributions from WinBUGS are the collection of

[R] Trouble combining plotmath, bquote, expressions

2008-04-02 Thread Paul Johnson
and sigma are replaced with Greek and mymean and mystd are drawn from program? ### Filename: Normal1_2008.R ### Paul Johnson March 31, 2008 ### This code should be available somewhere in http://pj.freefaculty.org. If it is not ### email me [EMAIL PROTECTED] mymean - 0 mystd - 1.5 myx - seq( mymean - 3

[R] plotmath overstrikes in output on a Linux system

2008-04-08 Thread Paul Johnson
I've been testing plotmath. But I'm getting some funny output one one computer. The problem is that characters are 'jumbled' and overstrike when symbols are introduced. Sample code: mu - 440.0 sigma - 12.5 myx - seq( mu - 4*sigma, mu+ 4*sigma, length.out=500) myDensity -

Re: [R] plotmath overstrikes in output on a Linux system

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 4:29 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote: Looks likes the the laptop is using different fonts with incorrect font metrics. This could happen because it has a different screen resolution, or one of the systems is set to use scalable fonts or it is giving metrics

Re: [R] plot function / par() settings

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 12:47 PM, Pedro Mardones [EMAIL PROTECTED] wrote: Dear all; I'm trying to create a 2 x 3 plot (something I know like lattice can do better) using the plot function. However; I'm not sure how to make the width of the plots to be the same on each column. I guess the

Re: [R] simple graphing question

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 2:18 PM, stephen sefick [EMAIL PROTECTED] wrote: #copy and paste this into R f - (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702, 0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61)), .Names = c(TKN, RM), class = data.frame, row.names = 25:29))

Re: [R] distance matrix as text file - how to import?

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 1:50 PM, Hans-Jörg Bibiko [EMAIL PROTECTED] wrote: Dear all, I have -hopefully- a tiny problem. I was sent a text file containing a distance matrix à la: 1 2 3 4 5 6 Try this! I put your test data in text.txt and voila: mat - matrix(0, 3,3) mat[row(mat) =

Re: [R] Problem with NA data when computing standard error

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 12:44 PM, LeCzar [EMAIL PROTECTED] wrote: Hey, I want to compute means and standard errors as two tables like this: se-function(x)sqrt(var(x)/length(x)) The missings are not your main problem. The command var computes the variance-covariance matrix. Some

Re: [R] If statements for vectors

2008-04-09 Thread Paul Johnson
On Wed, Apr 9, 2008 at 4:07 PM, Laura Bonnett [EMAIL PROTECTED] wrote: Dear Sirs, I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the 'standard' R-package. I am trying to select a list of genes which all have expression values below a certain threshold. I have done

Re: [R] Format regression result summary

2008-04-15 Thread Paul Johnson
On Fri, Apr 11, 2008 at 11:05 AM, Thiemo Fetzer [EMAIL PROTECTED] wrote: Hello to the whole group. I am a newbie to R, but I got my way through and think it is a lot easier to handle than other software packages (far less clicks necessary). [snip] However, my wish is the output to have a

Re: [R] plotmath overstrikes in output on a Linux system

2008-04-15 Thread Paul Johnson
On Tue, Apr 8, 2008 at 1:23 PM, Paul Johnson [EMAIL PROTECTED] wrote: On Tue, Apr 8, 2008 at 4:29 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote: Looks likes the the laptop is using different fonts with incorrect font metrics. This could happen because it has a different screen resolution

Re: [R] rggobi is crashing R-2.7.0

2008-05-07 Thread Paul Johnson
On Tue, May 6, 2008 at 12:32 PM, Mark Kimpel [EMAIL PROTECTED] wrote: I am running 64-bit Ubuntu 8.04 and when I invoke rggobi the interactive graph displays but R crashes. See my sessionInfo() and a short example below. Ggobi and rggobi installed without complaints. Mark sessionInfo()

Re: [R] poisson regression with robust error variance ('eyestudy

2008-05-08 Thread Paul Johnson
On Thu, May 8, 2008 at 8:38 AM, Ted Harding [EMAIL PROTECTED] wrote: The below is an old thread: On 02-Jun-04 10:52:29, Lutz Ph. Breitling wrote: Dear all, i am trying to redo the 'eyestudy' analysis presented on the site http://www.ats.ucla.edu/stat/stata/faq/relative_risk.htm

Re: [R] poisson regression with robust error variance ('eyestudy

2008-05-08 Thread Paul Johnson
, with the HC0 type of robust standard errors in the sandwich package (thanks to Achim Zeileis), you get almost the same numbers as that Stata output gives. The estimated b's from the glm match exactly, but the robust standard errors are a bit off. ### Paul Johnson 2008-05-08 ### sandwichGLM.R system

[R] How to add space between main title to leave space for legend?

2008-05-31 Thread Paul Johnson
Hello, everybody: I recently encountered an example with in which the graph was placed in a way that did not leave room for a legend. Maybe you would describe it as legend too big, I'm not sure. I found myself wishing I could force in some space after the title. Here's working example where

Re: [R] How to add space between main title to leave space for legend?

2008-06-03 Thread Paul Johnson
On Sat, May 31, 2008 at 2:45 PM, Peter Dalgaard [EMAIL PROTECTED] wrote: Paul Johnson wrote: Hell (1) par(xpd=TRUE) allows you to write outside the plotting region O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B As usual, PD right on the money. Here's a working demo

[R] why doesn't t.test value include standard error

2009-05-07 Thread Paul Johnson
Hello, everybody! I'm back to ask the obvious on behalf of the silent majority :) Today a student asked me what standard error was used in this t.test output. I looked into it and was a little surprised that a t.test output object does not have a slot for the standard error. Of course, we can

[R] times family unavailable in postscript device (Ubuntu Linux)

2009-05-11 Thread Paul Johnson
I'm running Ubuntu 9.04. I could use some advice about fonts in postscript devices. sessionInfo() R version 2.9.0 (2009-04-17) i486-pc-linux-gnu locale:

Re: [R] fitdistr for t distribution

2009-05-16 Thread Paul Johnson
On Fri, May 15, 2009 at 6:22 AM, lagreene lagreene...@gmail.com wrote: Thanks Jorge, but I still don't understand where they come from.  when I use: fitdistr(mydata, t, df = 9) and get values for m and s, and the variance of my data should be the df/s? I jsut want to be able to confirm how

Re: [R] save the output of summary(lmList(x)) into a dataframe

2009-06-16 Thread Paul Johnson
On Tue, Jun 16, 2009 at 3:29 AM, Cecilia Carmocecilia.ca...@ua.pt wrote: Hi r-helpers! I need to save the output of summary() function that I’ve runned like this: z- lmList(y~x1+x2| x3, na.action=na.omit,data1,subset=year==1999) w-summary(z) The output (w) is something like this: Call:  

[R] R for Mac 10.3.9

2008-01-28 Thread Paul Johnson
I know nothing of Macintosh, so please be patient. My student has a Macintosh with OSX 10.3.9. The R for Mac says it is for 10.4.4 or higher. Aside from saying get a new Mac, what can be said to my student? Can you point me at the newest version of R that did work on 10.3 ? pj -- Paul E.

[R] Working up examples of barplots with customized marginal items

2009-03-11 Thread Paul Johnson
hope some students benefit from experimenting with it pj ### Paul Johnson ### Twisting the margins of a barplot ### I never thought too much about customizing barplots, but ### now I have learned some tricks to share. Step through these ### examples to see the possibilities. set.seed(424242) x

[R] Ever see Process R exited abnormally with code 4?

2009-03-13 Thread Paul Johnson
I'm on a Windows XP student's computer. When we get busy and start running R stuff, it hangs at random with the hour glass showing, but the system's cpu is not running at 100%. We sit and watch for a while, and then try alt-ctl-delete to kill the not responding program. In this case, I'm able

Re: [R] Help with Function!

2009-03-13 Thread Paul Johnson
On Fri, Mar 13, 2009 at 6:28 PM, Lars Bishop lars...@gmail.com wrote: Dear All, I need to write 'n' functions on 'm' variables. The functions should be constructed according to the values of an (nxm) matrix of '1/0' values as follows. For example, if row1 is equal to ,say [1 0  ...0 0]

Re: [R] How to combine xtable and minipage with Sweave ?

2009-03-13 Thread Paul Johnson
On Fri, Mar 13, 2009 at 12:17 PM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 3/13/2009 12:07 PM, Ptit_Bleu wrote: Thanks Dieter for the link. You can use \includegraphics explicitly yourself, and avoid the automatic code generated by Sweave.  For example, testfn, fig=true,

Re: [R] Problem with figure size when embedding fonts

2009-03-15 Thread Paul Johnson
On Sat, Mar 14, 2009 at 1:51 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Dear Colleagues: I need to make a graphic that uses the Nimbus rather than Helvetica font family so that the font can be embedded in the encapsulated postscript file.  This is to satisfy a requirement from a

Re: [R] Creating dataframe names on the fly?

2009-03-21 Thread Paul Johnson
On Fri, Mar 20, 2009 at 7:18 PM, science! karthik@gmail.com wrote: I am aware that it is easily possible to create var names on the fly. e.g. assign(paste(m,i,sep=),j) but is it possible to assign dataframes to variables created on the fly? e.g. If I have a dataframe called master and I

Re: [R] Goodness of fit for negative binomial model

2009-03-21 Thread Paul Johnson
On Fri, Mar 20, 2009 at 8:03 PM, t c mudiver1...@yahoo.com wrote: Dear r list, I am using glm.nb in the MASS package to fit negative binomial models to data on manta ray abundance, and AICctab in the bbmle package to compare model IC.  However, I need to test for the goodness of fit of the

Re: [R] Plot and Boxplot in the same graph

2009-03-21 Thread Paul Johnson
On Fri, Mar 20, 2009 at 10:02 PM, johnhj jhar...@web.de wrote: Hii, Is it possible, to use the plot() funktion and the boxplot() funktion together ? I will plot a simple graph and additionally to the graph on certain places boxplots. I have imagined to plot the graph a little bit

[R] I want to use Sweave, but only sometimes

2009-04-13 Thread Paul Johnson
Does anybody have a workable system to run an Rnw document through R-Sweave when necessary, but to just run it through LaTeX if no new R calculations are needed? I.e., the figures already exist, I do not need R to do more work for me, so I send the document straight to LaTeX. I want to leave

Re: [R] Group by in R

2009-04-14 Thread Paul Johnson
On Mon, Apr 13, 2009 at 8:56 AM, Nick Angelou nikola...@yahoo.com wrote: data   X1 X2 X3 X4 1   1  2  2  1 2   1  1  2  2 3   1  1  2  2 4   2  2  1  2 5   1  1  2  2 6   2  2  1  2 7   1  1  2  1 8   2  2  1  2 9   1  2  1  1 10  1  1  2  2 sqldf(select X1, X2, X3, X4, count(*) CNT

[R] How do you specify font family in png output; png cross-platform issues

2009-01-26 Thread Paul Johnson
For teaching purposes, I prepared a little R program. I want to give this to students who can run it and dump out many formats and then compare their use in LaTeX documents. I do not have too much trouble with xfig or postscript format, but I've really run into a roadblock where png files are

Re: [R] PCALG Package

2009-01-27 Thread Paul Johnson
This means you need to install the Rgraphviz package. Have you tried? For me, Rgraphviz is not in CRAN, but it is required for that package you want. Rgraphviz is hosted in biocondoctor, so you have to install it through that route.

[R] I want axes that cross

2009-02-13 Thread Paul Johnson
Hello, everybody. A student asked me a howto question I can't answer. We want the length of the drawn axes to fill the full width and height of the plot, like so: | | * | * | * ---|- However, when we use plot with axes=F and then use the axis

Re: [R] I want axes that cross

2009-02-13 Thread Paul Johnson
On Fri, Feb 13, 2009 at 1:51 PM, Marc Schwartz marc_schwa...@comcast.net wrote: on 02/13/2009 01:25 PM Paul Johnson wrote: Hello, everybody. A student asked me a howto question I can't answer. We want the length of the drawn axes to fill the full width and height of the plot, like so

Re: [R] I want axes that cross

2009-02-13 Thread Paul Johnson
On Fri, Feb 13, 2009 at 1:42 PM, Daniel Moreira daniel.more...@duke.edu wrote: Try defining the argument 'pos' in the axis command-line, like: x - rnorm(100) z - gl(2,50) y - rnorm(100, mean= 1.8*as.numeric(z)) plot(x,y,type=n, axes=F) points(x,y, pch=$,cex=0.7, col=z) axis(1, col=green,

Re: [R] I want axes that cross

2009-02-15 Thread Paul Johnson
On Fri, Feb 13, 2009 at 3:14 PM, Marc Schwartz marc_schwa...@comcast.net wrote: on 02/13/2009 02:19 PM Paul Johnson wrote: On Fri, Feb 13, 2009 at 1:51 PM, Marc Schwartz OK, so given all of the above, something like the following should work: set.seed(1233240) x - rnorm(100) z - gl(2,50

[R] SPSS data import: problems work arounds for GSS surveys

2009-03-02 Thread Paul Johnson
I'm using R 2.8.1 on Ubuntu 8.10. I'm writing partly to ask what's wrong, partly to tell other users who search that there is a work around. The General Social Survey is a long standing series of surveys provided by NORC (National Opinion Research Center). I have downloaded some years of the

Re: [R] vertically aligned X axis labels disappear off R Graphics window

2009-03-02 Thread Paul Johnson
On Wed, Feb 25, 2009 at 12:51 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: R User R User wrote: Hi guys, I'm evaluating R for basic data exploration. I produce a bar plot of the data, with the x axis labels aligned vertically. However, the start of labels longer than about 10

Re: [R] adding value labels on Interaction Plot

2009-03-04 Thread Paul Johnson
On Wed, Mar 4, 2009 at 10:52 AM, Dimitri Liakhovitski ld7...@gmail.com wrote: Hello - and sorry for what might look like a simple graphics question. I am building an interaction plot for d: d=data.frame(xx=c(3,3,2,2,1,1),yy=c(4,3,4,3,4,3),zz=c(5.1,4.4,3.5,3.3,-1.1,-1.3))

Re: [R] Table Transformation

2009-03-04 Thread Paul Johnson
On Wed, Mar 4, 2009 at 11:58 AM, Christian Pilger christian.pil...@gmx.net wrote: Dear R-experts, recently, I started to discover the world of R. I came across a problem, that I was unable to solve by myself (including searches in R-help, etc.) I have a flat table similar to key1    key2  

Re: [R] using a noisy variable in regression (not an R question)

2009-03-07 Thread Paul Johnson
On Sat, Mar 7, 2009 at 11:49 AM, Juliet Hannah juliet.han...@gmail.com wrote: Hi, This is not an R question, but I've seen opinions given on non R topics, so I wanted to give it a try. :) How would one treat a variable that was measured once, but is known to fluctuate a lot? For example, I

Re: [R] Plotmath with values?

2008-12-31 Thread Paul Johnson
, but isn't that always the way it goes :). ### Filename: Normal1_2008.R ### Paul Johnson March 31, 2008 ### This code should be available somewhere in http://pj.freefaculty.org. If it is not ### email me paulj...@ku.edu mu - 10.034 sigma - 12.5786786 myx - seq( mu - 3.5*sigma, mu+ 3.5*sigma

[R] Sweave documents have corrupted double quotes

2009-01-16 Thread Paul Johnson
I'm attaching a file foo.Rnw and I'm hoping some of you might run it through your R latex systems to find out if the double-quotes in typewriter font turn out as black boxes (as they do for me). If you don't use Sweave, but you have a system with a working version of R and LaTeX, the file gives

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread Paul Johnson
On Fri, Jan 16, 2009 at 10:43 AM, David Winsemius dwinsem...@comcast.net wrote: Dear Dr Johnson; I'm not sure if you get copies of your posts. If you do can you check to see if the list-server kept the attachment? My copy did not have one. -- Best David winsemius Hm. Well, I do get the

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread Paul Johnson
On Fri, Jan 16, 2009 at 11:06 AM, Vincent Goulet vincent.gou...@act.ulaval.ca wrote: Paul, The file did not make it to the list. Did you try loading Sweave with the 'noae' option, that is: \usepackage[noae]{Sweave} This *may* solve your issue. HTH Vincent Wow. That does fix it.

Re: [R] Sweave documents have corrupted double quotes

2009-01-17 Thread Paul Johnson
Hey, everybody. I am concluding that this Sweave wrecks quotation marks in typewriter font is a bug in Sweave. I've uploaded the foo.tex file so now you can see the Rnw, tex, and pdf file side by side. http://pj.freefaculty.org/latex As previous poster noted, the Sweave instruction is added at

Re: [R] Sweave documents have corrupted double quotes

2009-01-17 Thread Paul Johnson
On Sat, Jan 17, 2009 at 4:00 PM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 17/01/2009 4:29 PM, Ben Bolker wrote: Duncan Murdoch murdoch at stats.uwo.ca writes: R is open source, so this is no mystery: if you use [noae] then Sweave won't use the ae package in LaTeX. The problem you

Re: [R] PCA

2010-03-10 Thread Paul Johnson
On Wed, Mar 10, 2010 at 4:42 PM, Xanthe Walker xanthe.wal...@gmail.com wrote: Hello, I am trying to complete a PCA on a set of standardized ring widths from 8 different sites (T10, T9, T8, T7, T6, T5, T3, and T2). The following is a small portion of my data: T10 T9 T8 T7 T6 T5 T3 T2 1.33738

Re: [R] Shade area under curve

2010-03-10 Thread Paul Johnson
I use this to make illustration for some calculus notes. There are examples of shaded areas in there: ### Filename: Normal1_2009_plotmathExample.R ### Paul Johnson June 3, 2009 ### This code should be available somewhere in http://pj.freefaculty.org/R. If it is not ### email me paulj...@ku.edu

[R] Care to share an R presentation?

2010-03-17 Thread Paul Johnson
The R movement is picking up steam in the center of America. People that ignored my R-enthusiasm 10 years ago are now calling me up asking for presentations. I need to make a 2 hour presentation to a collection of faculty and grad students who might like to use R. I don't want to make it seem

[R] Does S inherit the enhancements in R language?

2010-03-19 Thread Paul Johnson
I don't know anybody who has S-plus these days, but I expect some of you might, and perhaps you won't mind telling me something. I'm working on my presentation about R for the general audience. As I survey the suggestions from this list about that project, I find myself wondering whether S-plus

[R] Question re the plotrix package

2011-07-27 Thread Paul Johnson
Dear list, I am using the  clock24.plot command in this excellent package to plot animal activity data. Does anyone know if both symbols and a line can be plotted on the same plot to show both raw data (symbols) and a line (describing a statistical model of the pattern) ? Or if more than

Re: [R] fit.mult.impute() in Hmisc

2011-08-13 Thread Paul Johnson
On Thu, Mar 31, 2011 at 2:56 PM, Yuelin Li li...@mskcc.org wrote: I tried multiple imputation with aregImpute() and fit.mult.impute() in Hmisc 3.8-3 (June 2010) and R-2.12.1. The warning message below suggests that summary(f) of fit.mult.impute() would only use the last imputed data set.

[R] seeking advice about rounding error and %%

2011-08-13 Thread Paul Johnson
A client came into our consulting center with some data that had been damaged by somebody who opened it in MS Excel. The columns were supposed to be integer valued, 0 through 5, but some of the values were mysteriously damaged. There were scores like 1.18329322 and such in there. Until he tracks

Re: [R] graphics: 3D regression plane

2011-04-27 Thread Paul Johnson
Hi. Comments below On Wed, Apr 27, 2011 at 2:32 AM, agent dunham crossp...@hotmail.com wrote: Hi, thanks, I think I've changed the previous as you told me but I'm having this error, what does it mean? model- lm(log(v1)~log(v2)+v3, data=dat) newax- expand.grid(    v2 =

Re: [R] Testing for arguments in a function

2011-09-28 Thread Paul Johnson
On Mon, Sep 26, 2011 at 2:39 PM, Gene Leynes gley...@gmail.com wrote: I don't understand how this function can subset by i when i is missing ## My function: myfun = function(vec, i){    ret = vec[i]    ret } ## My data: i = 10 vec = 1:100 ## Expected input and behavior:

Re: [R] Testing for arguments in a function

2011-09-30 Thread Paul Johnson
Just for the record, following Bill Dunlap's advice, I think this is the best answer to the question as originally posed is. myfun - function(vec, i=stop('i' must be supplied)){ vec[i] } myfun(1:40,10) [1] 10 myfun(1:10) Error in myfun(1:10) : 'i' must be supplied -- Paul E. Johnson

Re: [R] Running a GMM Estimation on dynamic Panel Model using plm-Package

2011-10-05 Thread Paul Johnson
On Sun, Jun 12, 2011 at 2:43 PM, bstudent marc.ruet...@gmx.de wrote: Hello, although I searched for a solution related to my problem I didn´t find one, yet. My skills in R aren´t very large, however. For my Diploma thesis I need to run a GMM estimation on a dynamic panel model using the pgmm

Re: [R] Tinn-R

2011-10-05 Thread Paul Johnson
On Tue, Oct 4, 2011 at 1:25 PM, Charles McClure cmccl...@atrcorp.com wrote: I am new to R and have recently tried Tinn-R with very mixed and unexpected results.  Can you point me to a Tinn-R tutorial on the web or a decent reference book? In my experience, TINN-R does not work so well, and

[R] multi-platform equivalent of x11() ?

2012-03-06 Thread Paul Johnson
I want to write an R help example that throws up 2 graphs in separate windows, for comparison. In Linux I plot one, then run x11() to spawn a new on-screen device. Is there some generic equivalent so I can write an example that will work for Windows and Mac users as well? If there is none,

Re: [R] simulate an gradually increase of the number of subjects based on two variables

2012-03-13 Thread Paul Johnson
Suggestion below: On Tue, Mar 13, 2012 at 1:24 PM, guillaume chaumet guillaumechau...@gmail.com wrote: I omit to precise that I already try to generate data based on the mean and sd of two variables. x=rnorm(20,1,5)+1:20 y=rnorm(20,1,7)+41:60 simu-function(x,y,n) {    

Re: [R] beginner's loop issue

2012-03-13 Thread Paul Johnson
On Tue, Mar 13, 2012 at 11:27 AM, aledanda danda.ga...@gmail.com wrote: Dear All, I hope you don't mind helping me with this small issue. I haven't been using R in years and I'm trying to fill in a matrix with the output of a function (I'm probably using the Matlab logic here and it's not

Re: [R] Models with ordered and unordered factors

2011-11-15 Thread Paul Johnson
On Tue, Nov 15, 2011 at 9:00 AM, Catarina Miranda catarina.mira...@gmail.com wrote: Hello; I am having a problems with the interpretation of models using ordered or unordered predictors. I am running models in lmer but I will try to give a simplified example data set using lm. Both in the

[R] how big (in RAM and/or disk storage) is each of these objects in a list?

2011-11-26 Thread Paul Johnson
Greetings, friends (and others :) ) We generated a bunch of results and saved them in an RData file. We can open, use, all is well, except that the size of the saved file is quite a bit larger than we expected. I suspect there's something floating about in there that one of the packages we are

[R] fundamental guide to use of numerical optimizers?

2011-12-15 Thread Paul Johnson
I was in a presentation of optimizations fitted with both MPlus and SAS yesterday. In a batch of 1000 bootstrap samples, between 300 and 400 of the estimations did not converge. The authors spoke as if this were the ordinary cost of doing business, and pointed to some publications in which the

[R] pls help to print out first row of terms(model) output in example program

2011-12-19 Thread Paul Johnson
] log(10 + x1) poly(x2, 2) [snip] In my working example code below , I need the help where I have ##fix me fix me## ##Paul Johnson ## 2011-12-19 ## mcDiagnose.R lmAuxiliary - function(model){ dat - as.data.frame(model.matrix(model)) ## ivnames - attr(delete.response(terms(model)), term.labels

[R] 3d plotting alternatives. I like persp, but regret the lack of plotmath.

2011-12-29 Thread Paul Johnson
I have been making simple functions to display regressions in a new package called rockchalk. For 3d illustrations, my functions use persp, and I've grown to like working with it. As an example of the kind of things I like to do, you might consult my lecture on multicollinearity, which is by far

[R] How to properly re-set a saved seed? I've got the answer, but no explanation

2012-01-06 Thread Paul Johnson
L'Ecuyer streams. The puzzle is this comment in ?Random: ‘set.seed’ is the recommended way to specify seeds. What I did not understand before, and can't make sense of now, is that set.seed does not re-set a saved seed. Here's my working example: ## Paul Johnson ## April 20, 2011 ## If you've never

[R] fix and edit don't work: unable to open X Input Method-segfault

2012-01-08 Thread Paul Johnson
I can't run fix() or edit() anymore. Did I break my system? I'm running Debian Linux with R-2.14.1. As far as I can tell, the R packages came from Debian's testing wheezy repository. I would like to know if users on other types of systems see the same problem. If no, then, obviously, it is a

Re: [R] question on model.matrix

2012-01-30 Thread Paul Johnson
Greetings On Sat, Jan 28, 2012 at 2:43 PM, Daniel Negusse daniel.negu...@my.mcphs.edu wrote: while reading some tutorials, i came across this and i am stuck. i want to understand it and would appreciate if anyone can tell me. design - model.matrix(~ -1+factor(c(1,1,2,2,3,3))) can

[R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Paul Johnson
A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names. So that has to be a character matrix. Consider: BM - matrix(0.1, 5, 5) Use data.entry(BM) or similar to set some to more abstract

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Paul Johnson
Henrik's proposal works well, so far. Thanks very much. I could not have figured that out (without much more suffering). Here's the working example in case future googlers find their way to this thread. ## Paul Johnson paulj...@ku.edu ## 2012-01-30 ## Special thanks to r-help email list

[R] trouble automating formula edits when log or * are present; update trouble

2012-05-29 Thread Paul Johnson
Greetings I want to take a fitted regression and replace all uses of a variable in a formula. For example, I'd like to take m1 - lm(y ~ x1, data=dat) and replace x1 with something else, say x1c, so the formula would become m1 - lm(y ~ x1c, data=dat) I have working code to finish that part of

Re: [R] trouble automating formula edits when log or * are present; update trouble

2012-05-29 Thread Paul Johnson
Try substitute: do.call(substitute, list(newFmla, setNames(list(as.name(x1c)), x1))) y ~ log(x1c) + x2 * x3 Damn. That's pretty. I'd say setNames a magic bullet too. Thanks very much. The approach suggested by Michael and Bert has the little shortcoming that grepping for x1 also picks up

[R] memory usage benefit from anonymous variable constructions.

2012-06-03 Thread Paul Johnson
This is an I was just wondering question. When the package dataframe was announced, the author claimed to reduce the number of times a data frame was copied, I started to wonder if I should care about this in my projects. Has anybody written a general guide for how to write R code that doesn't

Re: [R] Partial R-square in multiple linear regression

2012-06-03 Thread Paul Johnson
On Fri, Jun 1, 2012 at 2:05 PM, Jin Choi oohps...@gmail.com wrote: Hello, I am trying to obtain the partial r-square values (r^2 or R2) for individual predictors of an outcome variable in multiple linear regression. I am using the 'lm' function to calculate the beta coefficients, however, I

[R] non ascill characters in plots. no alternative but plotmath?

2012-06-06 Thread Paul Johnson
A student entered some data with text characters like epsilon and alpha. On her Windows system, the Greek letters did not display properly in a plot. There were some ordinary ASCII instead. I asked her to send me the code so I could test. For me, the plot looks ok on the screen. Format1 -

Re: [R] EM algorithm to find MLE of coeff in mixed effects model

2012-07-03 Thread Paul Johnson
On Tue, Jul 3, 2012 at 12:41 PM, jimmycloud jimmycl...@gmail.com wrote: I have a general question about coefficients estimation of the mixed model. I have 2 ideas for you. 1. Fit with lme4 package, using the lmer function. That's what it is for. 2. If you really want to write your own EM

[R] good documentation on use of Rscript. where to find?

2012-10-18 Thread Paul Johnson
What is the correct format for the shebang line and what options are allowed or necessary along with this? I find plenty of blogs and opinions, but few authoritative answers. I want an R script to run and update packages periodically, with a cron job that launches it. What is necessary to put in

[R] inverse for formula transformations on LHS

2013-05-17 Thread Paul Johnson
This is an R formula handling question. It arose in class. We were working on the Animals data in the MASS package. In order to see a relationship, you need to log brain and body weight. It's a fun one for teaching regression, if you did not try it yet. There are outliers too! Students wanted

Re: [R] inverse for formula transformations on LHS

2013-05-21 Thread Paul Johnson
On Sat, May 18, 2013 at 7:05 AM, Stephen Milborrow mi...@sonic.net wrote: Paul Johnson pauljoh...@gmail.com wrote: m1 - lm(log(y) ~ log(x), data = dat) termplot shows log(y) on the vertical. What if I want y on the vertical? plotmo in the plotmo package has an inverse.func argument, so

  1   2   >