Re: [R] Solving equations with optim

2008-03-16 Thread Prof Brian Ripley
On Sat, 15 Mar 2008, ianfiske wrote: > > If you want to find the value of x such that f(x) = 0, then you can minimize > f^2 or abs(f) using optim. Hope this helps, For all but the (default) Nelder-Mead method you will be better off with f^2 or some other differentiable function than abs(f), sin

Re: [R] SAS data

2008-03-16 Thread Daniel Nordlund
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Samuel Okoye > Sent: Friday, March 14, 2008 8:21 AM > To: [EMAIL PROTECTED] > Subject: [R] SAS data > > Hello, > > I am trying to read the SAS file MyData.sa7bdat in R! This file is saved > under >

[R] r-metrics website

2008-03-16 Thread R.H. Koning
Hello, it seems www.rmetrics.org has been unavailable for some days. Would anyone know of a mirror? Thanks, Ruud __ 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/

Re: [R] Forward Selection with regsubsets

2008-03-16 Thread Michael Dewey
At 15:52 14/03/2008, [EMAIL PROTECTED] wrote: >Hi, > >I would like to perform a forward selection procedure on a data set >with 6 observations and 10 predictors. I tried to run it with >regsubsets (I set nvmax=number of observations) but I keep getting >these warning messages: > >Warning messages:

[R] stats/debugging question hotelling t-sq

2008-03-16 Thread toby909
Hi I spent hours looking over my formula. Somehow I cant find the reason why it gives me different answer. help appreciated. x = as.matrix(read.table("http://www.niehs.nih.gov/research/atniehs/core/microarrays/docs/heinloth.txt",1)) x = t(x)#now rows are subjects, cols are genes x = x[or

Re: [R] Anova

2008-03-16 Thread Gavin Simpson
On Sat, 2008-03-15 at 12:48 -0500, daniel jupiter wrote: > Hi all, > > I apologize for what might be a silly question. > > I am interested in doing a one way anova. > This is not too hard in and of itself, either with anova, aov or oneway.test > . > > However, I need to > 1) get pvalues, if obj

Re: [R] stats/debugging question hotelling t-sq

2008-03-16 Thread Klaus Nordhausen
Hi! I think the results agree: using simulated data: set.seed(1) library(mvtnorm) x<-rmvnorm(44,rep(0,10)) y = x[(26:45)-1,1:10] x = x[(2:25)-1,1:10] p = ncol(x); p nx = nrow(x); nx ny = nrow(y); ny n = nx+ny; n # (t(x)-colMeans(x)) %*% t(t(x)-colMeans(x)) T2 = nx*ny/n * t(colMeans(x)-colMeans

[R] pretty formatting of lists

2008-03-16 Thread Thomas Petzoldt
Hello, is there already a function in any R package which does source code formatting of deparsed lists? Let's create the following list: x <- list(a = round(rnorm(3), 2), b = round(rnorm(3), 2)) xx <-c(aa = round(rnorm(30)), f = function(a) a + b, list(x, x)) Now, I want deparse i

Re: [R] pretty formatting of lists

2008-03-16 Thread jim holtman
Is this basically what you want? > xx <-list(aa = round(rnorm(30),2), f = function(a) a + b, a=x, b=x) > xx $aa [1] 1.34 -0.21 -0.18 -0.10 0.71 -0.07 -0.04 -0.68 -0.32 0.06 -0.59 0.53 -1.52 0.31 -1.54 -0.30 [17] -0.53 -0.65 -0.06 -1.91 1.18 -1.66 -0.46 -1.12 -0.75 2.09 0.02 -1.29 -1.64 0

Re: [R] pretty formatting of lists

2008-03-16 Thread Thomas Petzoldt
jim holtman wrote: > Is this basically what you want? > >> xx <-list(aa = round(rnorm(30),2), f = function(a) a + b, a=x, b=x) >> xx > $aa > [1] 1.34 -0.21 -0.18 -0.10 0.71 -0.07 -0.04 -0.68 -0.32 0.06 -0.59 > 0.53 -1.52 0.31 -1.54 -0.30 > [17] -0.53 -0.65 -0.06 -1.91 1.18 -1.66 -0.46 -1.12

[R] Overloading %*%

2008-03-16 Thread Joe Cainey
Hi, Is it possible to supply a new method for the %*% operator? I need to provide a new method for working on variables of a newly defined class, "ad". I've had no problems overloading +, * etc.., using code such as: "+.ad" <- function(a,b = NULL) { # further code here } I've tried to do the

[R] rgl build warnings and loading error on Linux

2008-03-16 Thread Liviu Andronic
Dear useRs, I have several problems in using rgl-0.77 (and recent earlier versions) on Gentoo Linux with a custom-built v. 2.6.22 kernel. Currently I use R-2.6.1. When I build rgl, # R CMD INSTALL "/home/liviu/inst/dwn/R/rgl_0.77.tar.gz" or install.packages("rgl", dependencies=TRUE, method ="wget

Re: [R] Overloading %*%

2008-03-16 Thread knoblauch
Joe Cainey gmail.com> writes: > Is it possible to supply a new method for the %*% operator? clipped > I've tried to do the same thing with %*%: > > "%*%.ad" <- function(a,b) > { > # further code here > } > However this doesn't work; the new method is never called and the standard > %*% opera

Re: [R] rgl build warnings and loading error on Linux

2008-03-16 Thread Duncan Murdoch
On 16/03/2008 3:38 PM, Liviu Andronic wrote: > Dear useRs, > > I have several problems in using rgl-0.77 (and recent earlier > versions) on Gentoo Linux with a custom-built v. 2.6.22 kernel. > Currently I use R-2.6.1. > > When I build rgl, > # R CMD INSTALL "/home/liviu/inst/dwn/R/rgl_0.77.tar.gz

[R] (no subject)

2008-03-16 Thread Kathy Maher
Hi, I am trying to use the Fisher scoring method with a geometric distribution, with p = .07, 100 observations from the geom distrib, and 10 iterations. I cannot quite get the code to work. Can anyone see the mistake? n <- 100 p <- 0.07 x <- rgeom(n, p) s <- sum(x) f <- function(x, p)

Re: [R] rgl build warnings and loading error on Linux

2008-03-16 Thread Dirk Eddelbuettel
On 16 March 2008 at 17:00, Duncan Murdoch wrote: | On 16/03/2008 3:38 PM, Liviu Andronic wrote: | > Dear useRs, | > | > I have several problems in using rgl-0.77 (and recent earlier | > versions) on Gentoo Linux with a custom-built v. 2.6.22 kernel. | > Currently I use R-2.6.1. | > | > When I bu

Re: [R] Overloading %*%

2008-03-16 Thread Spencer Graves
Thanks, Ken. 1. How can I find S4 methods for a given function given class(es) of objects? The 'showMethods' function lists available generics for a given function; "showMethods('%*%')" just produced for me a list of 52 different signatures for "%*%". However, I don't know how to fin

[R] How to assign text string as object?

2008-03-16 Thread Ing. Michal Kneifl, Ph.D.
I have a problem I cannot get over for a long time. Imagine I have a data frame with 17 colums. 16 of them are craniometric variables of Cervus elaphus and one contains age. The data frame has 83 rows. I want to write a loop which plots the values of each craniometric variable against the age

Re: [R] How to assign text string as object?

2008-03-16 Thread jim holtman
Take a look at 'matplot'. If you want to loop, try for (i in 1:16) plot(df[[paste("V", i, sep="")]] ~ df$AGE) On 3/16/08, Ing. Michal Kneifl, Ph.D. <[EMAIL PROTECTED]> wrote: > I have a problem I cannot get over for a long time. Imagine I have a > data frame with 17 colums. 16 of them are cranio

Re: [R] How to assign text string as object?

2008-03-16 Thread Henrique Dallazuanna
You can try this also: sapply(DF[-match("AGE", names(DF))], plot, x=DF$AGE) On 16/03/2008, Ing. Michal Kneifl, Ph.D. <[EMAIL PROTECTED]> wrote: > I have a problem I cannot get over for a long time. Imagine I have a > data frame with 17 colums. 16 of them are craniometric variables of > Cervus ela

[R] setAs vs setIs

2008-03-16 Thread Christophe Genolini
Hi the list I am fighting with the twins setAs and setIs... Here are some questions and comments (comments to myself but that migth be wrong, it is why I am posting them) 1. Very surprising : using setIs define 'is', 'as<-' but not 'as' ??? 2. Using setAs define 'as', 'as<-' but not 'is'... What

Re: [R] rgl build warnings and loading error on Linux

2008-03-16 Thread Charles C. Berry
On Sun, 16 Mar 2008, Dirk Eddelbuettel wrote: > > On 16 March 2008 at 17:00, Duncan Murdoch wrote: > | On 16/03/2008 3:38 PM, Liviu Andronic wrote: > | > Dear useRs, > | > > | > I have several problems in using rgl-0.77 (and recent earlier > | > versions) on Gentoo Linux with a custom-built v. 2.6

Re: [R] setAs vs setIs

2008-03-16 Thread Charilaos Skiadas
On Mar 16, 2008, at 8:12 PM, Christophe Genolini wrote: > Hi the list > > I am fighting with the twins setAs and setIs... > > Here are some questions and comments (comments to myself but that > migth > be wrong, it is why I am posting them) > 1. Very surprising : using setIs define 'is', 'as<-'

[R] Std errors in glm models w/ and w/o intercept

2008-03-16 Thread David Winsemius
I am doing a reanalysis of results that have previously been published. My hope was to demonstrate the value of adoption of more modern regression methods in preference to the traditional approach of univariate stratification. I have encountered a puzzle regarding differences between I though

[R] stepAIC and polynomial terms

2008-03-16 Thread caspar
Dear all, I have a question regarding the use of stepAIC and polynomial (quadratic to be specific) terms in a binary logistic regression model. I read in McCullagh and Nelder, (1989, p 89) and as far as I remember from my statistics cources, higher-degree polynomial effects should not be include

Re: [R] Overloading %*%

2008-03-16 Thread Martin Morgan
Spencer Graves wrote: > Thanks, Ken. > > 1. How can I find S4 methods for a given function given class(es) > of objects? The 'showMethods' function lists available generics for a > given function; "showMethods('%*%')" just produced for me a list of 52 > different signatures for "%*%".

Re: [R] Overloading %*%

2008-03-16 Thread Spencer Graves
Dear Martin: This is wonderful. Thank you very much. It would be a great help if your suggestions could be added to "See Also" and "Examples" for "methods". Thanks again, Spencer Graves Martin Morgan wrote: > Spencer Graves wrote: > >> Thanks, Ken. >> >> 1

Re: [R] stepAIC and polynomial terms

2008-03-16 Thread Robert A LaBudde
At 08:50 PM 3/16/2008, caspar wrote: >Dear all, >I have a question regarding the use of stepAIC and polynomial >(quadratic to be specific) terms in a binary logistic regression >model. I read in McCullagh and Nelder, (1989, p 89) and as far as I >remember from my statistics cources, higher-degre

Re: [R] How to loop through all the columns in dataframe

2008-03-16 Thread Felipe Carrillo
--- jim holtman <[EMAIL PROTECTED]> wrote: > Glad I could help. You might want to post it back > to R-Help so that > others can see what was done. > > On Sun, Mar 16, 2008 at 6:02 PM, Felipe Carrillo > <[EMAIL PROTECTED]> wrote: > > Jim: I owe you man, this is great,I never thought > that > > I

Re: [R] stepAIC and polynomial terms

2008-03-16 Thread Bill.Venables
There is absolutely no reason to remove age altogether. Notice that typically age and age^2 are highly correlated. To see this, consider 100 people with mean age 35 and 95% tolerance limite between 15 and 55: > age <- rnorm(100, 35, 10) > cor(age, age^2) [1] 0.9898186 So if you use raw age and I

[R] mean for each row

2008-03-16 Thread Roslina Zakaria
Hi r-users, How do find the mean for each row? Thank you in advance for your help. 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 Day Totals 10.0 0.0 0.0 0.0 0.6 0.0 8.4 0.0 29.4 0.0 38.4 20.0 0.0 1.8 0.0 22.4 0.0 0.2 0.4 0.8 0.0

Re: [R] mean for each row

2008-03-16 Thread Hesen Peng
How about rowSums(x)/ncol(x), where x is the matrix? On Mon, Mar 17, 2008 at 1:48 PM, Roslina Zakaria <[EMAIL PROTECTED]> wrote: > Hi r-users, > How do find the mean for each row? Thank you in advance for your help. > > > 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 Day Totals >

Re: [R] generalized linear mixed models with a beta distribution [Sec=Unclassified]

2008-03-16 Thread Steve Candy
Craig A Faulhaber wrote: >I am interested in using a generalized linear mixed model with data > that best fits a beta distribution (i.e., the data is bounded between > 0 and 1 but is not binomial). .. >For clarification, here's what I'm trying to model: >I have a beta-distributed resp

[R] unable to load shared library '/usr/local/lib/R/modules//R_X11.so'

2008-03-16 Thread tomkur2006-takehome
Hi, I downloaded a binary version of R for my Solaris 10 box (from http://www.sunfreeware.com/programlistsparc10.html#R), and everything looked fine during the installation. However, I got a "X11 module cannot be loaded" error when I attempted to save a graph to be a png file. Does it look l

Re: [R] mean for each row

2008-03-16 Thread Matthias Kohl
or rowMeans ... Matthias Hesen Peng wrote: > How about rowSums(x)/ncol(x), where x is the matrix? > > > On Mon, Mar 17, 2008 at 1:48 PM, Roslina Zakaria <[EMAIL PROTECTED]> wrote: > >> Hi r-users, >> How do find the mean for each row? Thank you in advance for your help. >> >> >> 19

Re: [R] mean for each row

2008-03-16 Thread Bill.Venables
You need to omit the last column, though: RowM <- rowMeans(x[, -ncol(x)]) for example. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthias Kohl Sent: Monday, 17 March 2008 4:14 PM To: Hesen Peng Cc: R help forum Subject: Re: [R] mean for each row

Re: [R] unable to load shared library '/usr/local/lib/R/modules//R_X11.so'

2008-03-16 Thread Prof Brian Ripley
On Sun, 16 Mar 2008, [EMAIL PROTECTED] wrote: > Hi, > > I downloaded a binary version of R for my Solaris 10 box (from > http://www.sunfreeware.com/programlistsparc10.html#R), and everything > looked fine during the installation. However, I got a "X11 module > cannot be loaded" error when I at

Re: [R] Std errors in glm models w/ and w/o intercept

2008-03-16 Thread Prof Brian Ripley
On Mon, 17 Mar 2008, David Winsemius wrote: > > > I am doing a reanalysis of results that have previously been published. > My hope was to demonstrate the value of adoption of more modern > regression methods in preference to the traditional approach of > univariate stratification. I have encounte

Re: [R] generalized linear mixed models with a beta distribution [Sec=Unclassified]

2008-03-16 Thread Simon Blomberg
See this post: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/7144.html Cheers, Simon. On Mon, 2008-03-17 at 17:04 +1100, Steve Candy wrote: > > Craig A Faulhaber wrote: > > > > >I am interested in using a generalized linear mixed model with data > > > that best fits a beta distribution