Re: [R] singular information matrix in lrm.fit

2008-10-12 Thread Prof Brian Ripley
I believe lrm has a criterion appropriate to single-precision calculations (as S-PLUS used to use). Try reducing 'tol' from its default of 1e-7. But your design matrix *is* near singular kappa(cbind(1,x)) [1] 557390.5 so try centring/scaling your variables. On Sun, 12 Oct 2008, Gad

Re: [R] subsetting dataframe by rownames to be excluded

2008-10-12 Thread Prof Brian Ripley
On Sat, 11 Oct 2008, Alexy Khrabrov wrote: Is there a way to select a subset of a dataframe consisting of all those rows with rownames *except* from a subset of rownames to be excluded? Example: Yes: DF[is.na(match(row.names(DF), exclude_me)), ] a - data.frame(x=1:10,y=10:1) a -

Re: [R] svm models in a loop

2008-10-12 Thread Prof Brian Ripley
You need to use substitute() on the call. Something like sapply(1:5,function(i) eval(substitute(svm(person_oid ~ ., data=zrr[1:N,]), list(N=100*i)) ) On Sun, 12 Oct 2008, Alexy Khrabrov wrote: I want to train svm models on increasingly large training data subsets of some zrr as

Re: [R] step() and stepAIC()

2008-10-12 Thread Prof Brian Ripley
On Sun, 12 Oct 2008, Murray Jorgensen wrote: The birth weight example from ?stepAIC in package MASS runs well as indeed it should. However when I change stepAIC() calls to step() calls I get warning messages that I don't understand, although the output is similar. Why would you do this?

[R] R: specifying a function in nls

2008-10-12 Thread Joseph Kambeitz
I am encoutering s similar problem to the one described before in specifying a function in nls. I defined a function plot_it2 in the following way: plot_it2-function(SOA,t1weight, t2weight, d1weight, d2weight){ sapply(SOA,plot_it,t1weight, t2weight, d1weight, d2weight) } fit should

Re: [R] svm models in a loop

2008-10-12 Thread Alexy Khrabrov
On Oct 12, 2008, at 2:26 AM, Prof Brian Ripley wrote: You need to use substitute() on the call. Something like sapply(1:5,function(i) eval(substitute(svm(person_oid ~ ., data=zrr[1:N,]), list(N=100*i)) ) Thanks! On Sun, 12 Oct 2008, Alexy Khrabrov wrote: I want to train

[R] Avoid overlap of labels in a scatterplot

2008-10-12 Thread Nicola Sturaro Sommacal
Dear R users, I realise a scatterplot by plot(x,y) and I add the labels by text(x,y,labels,pos=1). How can I avoid, automatically, that labels overlap, like happen in SPSS? Thank you. Nicola Sturaro __ R-help@r-project.org mailing list

Re: [R] Sweave-LaTEX question

2008-10-12 Thread Dieter Menne
cls59 sharpsteen at mac.com writes: The final piece is a good TeX-aware editor, for windows I prefer WinEdt: I would like to add Tinn-R. However, if you are running something like an optimization routine which takes five minutes, you will be waiting five minutes every time you typeset the

[R] using predict() or fitted() from a model with offset

2008-10-12 Thread sam_oi
Dear R-users, I have come across some difficulties using the offset argument in a model. There is not much information in ?offset, ?lm, ?glm and therefore have resorted to post here. Offset appears to work in the models I run becuase I get the expected coefficients when comparing offset and

[R] false convergence (8) after removal of the two-way interaction

2008-10-12 Thread Fucikova, Eva
Dear All, I am working with a generalized linear mixed-effects model with poisson error using the lme4 package in R. I created a model with the lmer function including some main effects, three two way interactions and two random effects. The model works well, but I have troubles when removing

Re: [R] step() and stepAIC()

2008-10-12 Thread Murray Jorgensen
Prof Brian Ripley wrote: On Sun, 12 Oct 2008, Murray Jorgensen wrote: The birth weight example from ?stepAIC in package MASS runs well as indeed it should. However when I change stepAIC() calls to step() calls I get warning messages that I don't understand, although the output is similar.

Re: [R] Conditionally skip over for(..){ and }??

2008-10-12 Thread Ted Harding
On 12-Oct-08 11:32:31, Barry Rowlingson wrote: 2008/10/12 Ted Harding [EMAIL PROTECTED]: Hi Folks, I'm wondering if there's a secret trick to achieve the following. I have some big code for analysis related to a named variable, which will be one of several in the columns of a dataframe, and

Re: [R] Avoid overlap of labels in a scatterplot

2008-10-12 Thread Jim Lemon
Nicola Sturaro Sommacal wrote: Dear R users, I realise a scatterplot by plot(x,y) and I add the labels by text(x,y,labels,pos=1). How can I avoid, automatically, that labels overlap, like happen in SPSS? Hi Nicola, thigmophobe.labels in the plotrix package tries to avoid label crashes, and

[R] numeric derivation

2008-10-12 Thread Oliver Bandel
Hello, I don't understand the description / help-text for the numericDeriv() function. Why is there a new environment used? And what is meant with an environment here? Is it similar or the same as a local workspace, like an environment in functional languages? And why is it needed here?

Re: [R] Avoid overlap of labels in a scatterplot

2008-10-12 Thread Felix Andrews
2008/10/12 Jim Lemon [EMAIL PROTECTED]: Nicola Sturaro Sommacal wrote: Dear R users, I realise a scatterplot by plot(x,y) and I add the labels by text(x,y,labels,pos=1). How can I avoid, automatically, that labels overlap, like happen in SPSS? Hi Nicola, thigmophobe.labels in the

Re: [R] Conditionally skip over for(..){ and }??

2008-10-12 Thread Barry Rowlingson
2008/10/12 Ted Harding [EMAIL PROTECTED]: Hi Folks, I'm wondering if there's a secret trick to achieve the following. I have some big code for analysis related to a named variable, which will be one of several in the columns of a dataframe, and I would like to be able to choose between a run

Re: [R] Sweave-LaTEX question

2008-10-12 Thread Liviu Andronic
On Sun, Oct 12, 2008 at 1:39 AM, Felipe Carrillo [EMAIL PROTECTED] wrote: Does LATEX have to be installed on your computer? How does the xtable package and Sweave work together? How can I make the code below create a table as pdf file? Please check the documentation of RcmdrPlugin.Export

Re: [R] graphics

2008-10-12 Thread Prof Brian Ripley
On Sun, 12 Oct 2008, Jim Lemon wrote: Darja Poklukar wrote: I just want to ask how to enlarge the resolution of my plots in R. For ex. for publising I would like a picture of resolution minimal 500 dpi, all I managed was picture of dim 5,28 X 5,83 with 118 pixels/cm. Hi Darja, The usual

Re: [R] Copyright Symbol

2008-10-12 Thread Dr Eberhard W Lisse
Brian, I use: R version 2.7.2 (2008-08-25) i386-apple-darwin8.11.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] plotrix_2.4-7RdbiPgSQL_1.14.0 Rdbi_1.14.0 I didn't think of it as a Mac specific issue,

Re: [R] Conditionally skip over for(..){ and }??

2008-10-12 Thread Gabor Grothendieck
On Sun, Oct 12, 2008 at 7:32 AM, Barry Rowlingson [EMAIL PROTECTED] wrote: 2008/10/12 Ted Harding [EMAIL PROTECTED]: Hi Folks, I'm wondering if there's a secret trick to achieve the following. I have some big code for analysis related to a named variable, which will be one of several in the

Re: [R] graphics

2008-10-12 Thread Jim Lemon
Darja Poklukar wrote: I just want to ask how to enlarge the resolution of my plots in R. For ex. for publising I would like a picture of resolution minimal 500 dpi, all I managed was picture of dim 5,28 X 5,83 with 118 pixels/cm. Hi Darja, The usual answer is to increase the size of the

[R] Overdispersion in the lmer models

2008-10-12 Thread Fucikova, Eva
Dear All, I am working with linear mixed-effects models using the lme4 package in R. I created a model using the lmer function including some main effects, a three-way interaction and a random effect. Because I work with a binomial and poisson distribution, I want to know whether there is

Re: [R] numeric derivation

2008-10-12 Thread Gabor Grothendieck
On Sun, Oct 12, 2008 at 7:24 AM, Oliver Bandel [EMAIL PROTECTED] wrote: Hello, I don't understand the description / help-text for the numericDeriv() function. Why is there a new environment used? And what is meant with an environment here? ?environment or

[R] qt with df1

2008-10-12 Thread Enrico Rossi
Hello, The function qt returns NaN for degrees of freedom 1. For example: qt(0.5,0.5) [1] NaN Warning message: In qt(p, df, lower.tail, log.p) : NaNs produced But qt(0.5,0.5) should be 0, since the distribution is symmetric. pt(0,0.5) [1] 0.5 It actually fails with any value, as long as

[R] Post hoc in repeated measures anova

2008-10-12 Thread Migle Purzelyte
Hi, I found a problem dealing with repeated measures anova post hoc. I'm desperate in finding how to use it in R. The problem is that an Error term in aov() creates class of aovlist and that's why I cannot use TukeyHSD() which needs aov class. I really appreciate your help. Migle

[R] qt with df1 (repost)

2008-10-12 Thread Enrico Rossi
Sorry about the html-formatted message. Here it is again in plain text. Hello, The function qt returns NaN for degrees of freedom 1. For example: qt(0.5,0.5) [1] NaN Warning message: In qt(p, df, lower.tail, log.p) : NaNs produced But qt(0.5,0.5) should be 0, since the distribution is

Re: [R] numeric derivation

2008-10-12 Thread Oliver Bandel
Zitat von Gabor Grothendieck [EMAIL PROTECTED]: On Sun, Oct 12, 2008 at 7:24 AM, Oliver Bandel [EMAIL PROTECTED] wrote: [...] The input to numericDeriv is not values but an expression. See the Examples section at the end of ?numericDeriv The expression given as the first arg ultimately

Re: [R] numeric derivation

2008-10-12 Thread Gabor Grothendieck
If you simply want successive differences use diff: x - seq(4)^2 diff(x) tx - ts(x) diff(tx) On Sun, Oct 12, 2008 at 9:19 AM, Oliver Bandel [EMAIL PROTECTED] wrote: Zitat von Gabor Grothendieck [EMAIL PROTECTED]: On Sun, Oct 12, 2008 at 7:24 AM, Oliver Bandel [EMAIL PROTECTED] wrote: [...]

Re: [R] qt with df1 (repost)

2008-10-12 Thread Prof Brian Ripley
Please do RTFM, for the help says df: degrees of freedom ( 0, maybe non-integer). 'df = Inf' is allowed. For 'qt' only values of at least one are currently supported. On Sun, 12 Oct 2008, Enrico Rossi wrote: Sorry about the html-formatted message. Here it is again

Re: [R] numeric derivation

2008-10-12 Thread Oliver Bandel
Zitat von Gabor Grothendieck [EMAIL PROTECTED]: If you simply want successive differences use diff: x - seq(4)^2 diff(x) tx - ts(x) diff(tx) [...] Oh, cool, thanks. But what about diff / delta_t ? Do I have to calculate it by my own, or is there already a function for making a

Re: [R] numeric derivation

2008-10-12 Thread Gabor Grothendieck
?deltat On Sun, Oct 12, 2008 at 9:45 AM, Oliver Bandel [EMAIL PROTECTED] wrote: Zitat von Gabor Grothendieck [EMAIL PROTECTED]: If you simply want successive differences use diff: x - seq(4)^2 diff(x) tx - ts(x) diff(tx) [...] Oh, cool, thanks. But what about diff / delta_t ? Do

Re: [R] Conditionally skip over for(..){ and }??

2008-10-12 Thread Ted Harding
Following up on Barry's suggestion led on to a more straightforward approach: VarNames - NULL # VarNames - c(VarNames, Var1) # VarNames - c(VarNames, Var2) # VarNames - c(VarNames, Var3) # [...] for(i in (1:length(VarNames))){ VarName - VarNames[i] [...] Then any one or some of those

Re: [R] qt with df1 (repost)

2008-10-12 Thread Peter Dalgaard
Prof Brian Ripley wrote: Please do RTFM, for the help says df: degrees of freedom ( 0, maybe non-integer). 'df = Inf' is allowed. For 'qt' only values of at least one are currently supported. On Sun, 12 Oct 2008, Enrico Rossi wrote: Sorry about the html-formatted

Re: [R] proper use of textConnection

2008-10-12 Thread Peter Dalgaard
Dennis Fisher wrote: Colleagues, Using R2.7.0 in OS X, I am having trouble understanding the command textConnection. My situation is as follows: 1. I am trying to read a lengthy file (45000 lines) that has headers ~ every 1000 lines. read.table (or its variants) fail because of the

Re: [R] proper use of textConnection

2008-10-12 Thread Gabor Grothendieck
Try one of these: Lines - readLines(myfile.dat) Lines - Lines[-grep(whatever, Lines)] DF - read.table(textConnection(Lines), ...other.args...) or # use findstr /v instead of grep -v if you are on Windows DF - read.table(pipe(grep -v whatever myfile.dat), ...other.args...) On Sun, Oct 12,

Re: [R] R vs SPSS contrasts

2008-10-12 Thread Chuck Cleland
On 10/11/2008 3:31 PM, Ted Harding wrote: Hi Folks, I'm comparing some output from R with output from SPSS. The coefficients of the independent variables (which are all factors, each at 2 levels) are identical. However, R's Intercept (using default contr.treatment) differs from SPSS's

Re: [R] bivariate non-parametric smoothing

2008-10-12 Thread David Winsemius
On Oct 10, 2008, at 6:32 PM, Verschuere Benjamin wrote: Hi, I was wondering if there is a function in R which performs bivariate non parametric smoothing which allows for the possibility of including some weights in the smoothing (for each data points in my grid I have some predefined

Re: [R] R vs SPSS contrasts

2008-10-12 Thread Gabor Grothendieck
Looks like the contrast matrix for indicator is contr.SAS(n), for deviation is contr.sum(n) and for simple is: (diag(n) - 1/n)[, -1] That works at least for the n = 3 example in the link. Perhaps the others could be checked against SPSS for a variety of values of n to be sure. On Sun, Oct 12,

Re: [R] R vs SPSS contrasts

2008-10-12 Thread Gabor Grothendieck
The formula should be (diag(n) - 1/n)[, -n] On Sun, Oct 12, 2008 at 1:36 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Looks like the contrast matrix for indicator is contr.SAS(n), for deviation is contr.sum(n) and for simple is: (diag(n) - 1/n)[, -1] That works at least for the n = 3

Re: [R] R vs SPSS contrasts

2008-10-12 Thread Gabor Grothendieck
I found this link: http://webs.edinboro.edu/EDocs/SPSS/SPSS%20Regression%20Models%2013.0.pdf which indicates that the contrast in SPSS that is used depends not only on the contrast selected but also on the reference category selected and the two can be chosen independently. Thus one could have

Re: [R] Sweave-LaTEX question

2008-10-12 Thread Liviu Andronic
On Sun, Oct 12, 2008 at 12:23 PM, Liviu Andronic [EMAIL PROTECTED] wrote: Please check the documentation of RcmdrPlugin.Export [1]; it contains several suggestions on using LyX, a cross-platform LaTeX GUI, together with Sweave. I've just stumbled on another LyX Sweave-related link, this time

Re: [R] R vs SPSS contrasts

2008-10-12 Thread Ted Harding
Very many thanks, Chuck and Gabor, for the comments and the references to on-line explanations. It is beginning to become clear! Most grateful. Ted. On 12-Oct-08 18:03:53, Gabor Grothendieck wrote: I found this link: http://webs.edinboro.edu/EDocs/SPSS/SPSS%20Regression%20Models%2013.0.pd f

Re: [R] Conditionally skip over for(..){ and }??

2008-10-12 Thread jim holtman
A safer way is: for (i in seq_along(VarNames)){ What happens when VarNames is length zero: x - NULL 1:length(x) [1] 1 0 seq_along(x) integer(0) On Sun, Oct 12, 2008 at 11:00 AM, Ted Harding [EMAIL PROTECTED] wrote: Following up on Barry's suggestion led on to a more straightforward

Re: [R] Creating GUIs for R

2008-10-12 Thread Duncan Temple Lang
Liviu Andronic wrote: I risk to fall far from answering your question, but this may be of interest. On Sun, Oct 12, 2008 at 10:53 PM, cls59 [EMAIL PROTECTED] wrote: Basically, I would like to start with just a plain vanilla R session running inside a Qt widget. Any suggestions? From the old

Re: [R] Creating GUIs for R

2008-10-12 Thread Duncan Temple Lang
cls59 wrote: On a related note... does anyone know good resources for binding a C++ program to the R library? I am thinking of writing an R GUI in Qt. I use a Mac and have looked at the Coca GUI source which binds Objective C to R. However, there is a lot of extra stuff going on- tab

Re: [R] Creating GUIs for R

2008-10-12 Thread cls59
I have thought about wxWidgets, and I will definitely check that manual out. My interest in Qt stems from heavy use of GIS and Fortran in my field of study. As an Environmental Engineering student, I routinely solve simulation and optimization problems which take as their input spatially

Re: [R] Sweave-LaTEX question

2008-10-12 Thread Johannes Hüsing
Am 12.10.2008 um 01:39 schrieb Felipe Carrillo: Does LATEX have to be installed on your computer? Not necessarily, but you'd have to have a graphic imagination to get an idea of how your document will look printed on paper. The general idea is that you don't have to (separation of content

Re: [R] Ecological Niche Modelling on R [SEC=UNCLASSIFIED]

2008-10-12 Thread Jin.Li
Hi Miltinho, There is a brief review on issues about and a new method for modelling presence-only data in DOI 10.1007/s10531-007-9270-7. Hope it is useful. Cheers, Jin Jin Li, PhD Spatial Modeller/ Computational Statistician Marine Coastal

[R] png(): Linux vs Windows

2008-10-12 Thread Ted Harding
Hi Folks, Quick question. I have the following line in an R code file which runs fine on Linux: if(PNG) png(GraphName,width=12,height=15,units=cm,res=200) I learn that, when the same code was run on a Windows machine, there was the following error: Error in

Re: [R] png(): Linux vs Windows

2008-10-12 Thread jim holtman
Seem to work fine on my R 2.7.2 version of Windows: png(file=myplot.png, bg=transparent, units='cm', width=12,height=15, res=200) plot(1:10) rect(1, 5, 3, 7, col=white) dev.off() Did you check the version they are using. On Sun, Oct 12, 2008 at 6:02 PM, Ted Harding [EMAIL PROTECTED]

Re: [R] Sweave-LaTEX question

2008-10-12 Thread Liviu Andronic
Hello Felipe, On Mon, Oct 13, 2008 at 12:55 AM, Felipe Carrillo [EMAIL PROTECTED] wrote: Liviu: I installed RcmdrPlugin.Export but couldn't figure out how to make it work. What do I need to do with the Export objects using xtable command? Do I need to have pdflatex in order to create pdf'f

Re: [R] singular information matrix in lrm.fit

2008-10-12 Thread Gad Abraham
Prof Brian Ripley wrote: I believe lrm has a criterion appropriate to single-precision calculations (as S-PLUS used to use). Try reducing 'tol' from its default of 1e-7. But your design matrix *is* near singular kappa(cbind(1,x)) [1] 557390.5 so try centring/scaling your variables.

[R] OT: irises

2008-10-12 Thread Thomas Lumley
Attention conservation notice: a digression on Fisher's iris data, related only tangentially to R. The package announcement for hwriter points to a webpage created with the package, http://www.ebi.ac.uk/~gpau/hwriter/ based on the Fisher/Anderson iris data, including pictures.

Re: [R] Creating GUIs for R

2008-10-12 Thread Bos, Roger
Ricardo, I forgot to mention to you the web site: www.rpad.org. You can view that site to see how well Rpad will look using your configuration. I only have Windows and I recall that under Firefox my page didn't work quite as well as it did with IE, but I don't know if that was my limited

Re: [R] numeric derivation

2008-10-12 Thread David Winsemius
Two follow-up questions: A) I get an error message when using Harrell's describe() function on one of my variable, telling me that sum() is not meaningful for a difftime object. Why should sum() not be meaningful for a collection of interval lengths? describe(pref900) Error in

Re: [R] Creating GUIs for R

2008-10-12 Thread Dirk Eddelbuettel
On 12 October 2008 at 12:53, cls59 wrote: | On a related note... does anyone know good resources for binding a C++ | program to the R library? RCpp, at http://rcpp.r-forge.r-project.org, formerly known as RCppTemplate, is pretty mature and testing having been around since 2004 or 2005.

Re: [R] numeric derivation

2008-10-12 Thread Gabor Grothendieck
I think the problem is that difftime objects have a units attribute so when converting to plain numbers you need to supply a unit with respect to which it is to be converted: d - Sys.Date() + 1:10 dd - diff(d) sum(as.double(dd, units = days)) On Sun, Oct 12, 2008 at 7:46 PM, David Winsemius

Re: [R] Overdispersion in the lmer models

2008-10-12 Thread David Winsemius
Have you considered using glm() with family = quasipoisson or family = quasibinomial ? I know from experience that the quasipoisson choice reports an index of dispersion. ?family -- David Winsemius On Oct 12, 2008, at 4:55 AM, Fucikova, Eva wrote: Dear All, I am working with linear

[R] sep. dataset

2008-10-12 Thread Sherri Heck
Hi everyone- I have a dataset that I created using the aggregate command: Hour LevelC2 1 1 1 -3.517117e+00 2 2 1 -2.536083e+00 3 3 1 -1.429000e+00 4 4 1 -1.148667e-01 5 5 1 1.345333e+00 6 6 1

Re: [R] sep. dataset

2008-10-12 Thread Jorge Ivan Velez
Dear Sherri, If your data set is called mydata, you can separate it by Levels with something like # Separating the data by Level -- new.data is a list new.data=split(mydata,mydata[,2]) new.data # or level1 = mydata[mydata$Level==1,] level2 = mydata[mydata$Level==2,] Now, if you want to plot

Re: [R] predicting from a local regression and plotting in lattice

2008-10-12 Thread Alex Karner
Thanks for your response, Dieter. I realize these limitations. However, I know that my actual dataset is reasonably well behaved in the range I want to predict, and I'm not using the predicted values for any further analysis, only for schematic purposes in the plot. I'm still curious if this

[R] Logistic Regression - Interpreting SENS (Sensitivity) and SPEC (Specificity)

2008-10-12 Thread Maithili Shiva
Hi Hi I am working on credit scoring model using logistic regression. I havd main sample of 42500 clentes and based on their status as regards to defaulted / non - defaulted, I have genereted the probability of default. I have a hold out sample of 5000 clients. I have calculated (1) No of

Re: [R] Oja median

2008-10-12 Thread Rahul-A.Agarwal
i have tried the code. The first function (which computes the Oja median) has a slight problem: If you try four points that create a square centred at (2,2) oja.median(cbind(c(1,3,1,3),c(1,1,3,3))) gives (-2,-2) instead of (2,2). Probably just a sign switch somewhere. The second function

Re: [R] predicting from a local regression and plotting in lattice

2008-10-12 Thread Gabor Grothendieck
locfit can extrapolate: library(locfit) X - seq(min(time(Nile)), max(time(Nile))+50) plot(range(X), range(Nile), type = n) lines(Nile) fit - locfit(Nile ~ time(Nile)) lines(X, predict(fit, new = X), col = red) On Fri, Oct 10, 2008 at 4:42 PM, Alex Karner [EMAIL PROTECTED] wrote: Hi R