Re: [R] retrieving weights from a polr object

2008-09-27 Thread Yihui Xie
Hi John, Aren't they in the component 'model' of the fitted object? ## > options(contrasts = c("contr.treatment", "contr.poly")) > house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) > head(house.plr$model) Sat Infl Type Cont (weights) 1LowLow Tower Low

Re: [R] plotting with a table right under it

2008-09-27 Thread Yihui Xie
R is Not Excel, I think... But if you insist on "drawing" a table below the graph, you may use rect() and text(). Why not add your numbers directly to your bars/lines/points/...? If you can express the information in a table, why use a plot? Regards, Yihui -- Yihui Xie <[EMAIL PROTECTED]> Phone:

Re: [R] best material for programmers?

2008-09-27 Thread Ajay ohri
someone mentioned the RCurl package recently On Sun, Sep 28, 2008 at 9:12 AM, June Kim <[EMAIL PROTECTED]> wrote: > Hello, > > What is the best material(book, pdfs, ...) for programmers, who have > extensive experience in other programming languages, to learn R > programming? I think there are ma

[R] best material for programmers?

2008-09-27 Thread June Kim
Hello, What is the best material(book, pdfs, ...) for programmers, who have extensive experience in other programming languages, to learn R programming? I think there are many materials on how to use R for specific statistical jobs, but I haven't seen any material particularly designed for R progr

Re: [R] partitioning vectors of intervals

2008-09-27 Thread jim holtman
Will this do it for you: > set.seed(1) > coarse <- runif(5,0,100) > coarse <- cbind(coarse, coarse + runif(5,1,10)) > coarse <- round(coarse,3) > fine <- runif(100,0,100) > fine <- cbind(fine, fine + runif(100,0,1)) > result <- lapply(seq(nrow(coarse)), function(.row){ + list(coarse[.row,], wh

Re: [R] FW: logistic regression

2008-09-27 Thread Frank E Harrell Jr
Darin Brooks wrote: Glad you were amused. I assume that "booking this as a fortune" means that this was an idiotic way to model the data? Dieter was nominating this for the "fortunes" package in R. (Thanks Dieter) MARS? Boosted Regression Trees? Any of these a better choice to extract si

Re: [R] FW: logistic regression

2008-09-27 Thread David Winsemius
It's more a statement that it expresses a statistical perspective very succinctly, somewhat like a Zen koan. Frank's book,"Regression Modeling Strategies", has entire chapters on reasoned approaches to your question. His website also has quite a bit of material free for the taking. -- D

[R] partitioning vectors of intervals

2008-09-27 Thread Alexy Khrabrov
I have two pairs of time intervals: coarse- and fine-grained. They're components of their respective dataframes, looking like, coarse:endtimestarttime 1t1_end t1_start 2 t2_end t2_start ... fine: is the same, except that i

Re: [R] FW: logistic regression

2008-09-27 Thread Darin Brooks
Glad you were amused. I assume that "booking this as a fortune" means that this was an idiotic way to model the data? MARS? Boosted Regression Trees? Any of these a better choice to extract significant predictors (from a list of about 44) for a measured dependent variable? -Original Messag

Re: [R] Problem to male an Index in looping

2008-09-27 Thread jim holtman
I think you want 'assign': for (i in 1:3){ assign(qrnox[i], rq(nox~factor(year)+factor(state)+pcinc+I(pcinc^2)+I(pcinc^3), tau=quant[i], data=exmp)) } better yet, use a list: result <- list() for (i in 1:3){ result[[1]] <- rq() } result[[1]] On Sat, Sep 27, 2008 at 4:24 PM, dimitrisk

Re: [R] FW: logistic regression

2008-09-27 Thread Ted Harding
On 27-Sep-08 21:45:23, Dieter Menne wrote: > Frank E Harrell Jr vanderbilt.edu> writes: > >> Estimates from this model (and especially standard errors and >> P-values) >> will be invalid because they do not take into account the stepwise >> procedure above that was used to torture the data unt

Re: [R] FW: logistic regression

2008-09-27 Thread Dieter Menne
Frank E Harrell Jr vanderbilt.edu> writes: > Estimates from this model (and especially standard errors and P-values) > will be invalid because they do not take into account the stepwise > procedure above that was used to torture the data until they confessed. > > Frank Please book this as a f

Re: [R] Installing DSE package.

2008-09-27 Thread rkevinburton
I am sorry where is the download page or index? Once I know that it is split out like this library(dse1) and library(dse2) work just fine. My question now is how did you know this? Thank you. Kevin Sarah Goslee <[EMAIL PROTECTED]> wrote: > If you look at the download page, or the index,

Re: [R] ggplot, getting two scales and one stat.

2008-09-27 Thread Tylere Couture
Thanks Hadley, unfortunately doing this gives me an error: > ggplot(polls, aes(x =Date, y = Popular_Support, colour=Party)) + + stat_smooth(span=0.5) + + geom_point(aes(shape=Source)) Error in `[.data.frame`(df, , var) : undefined columns selected if I move it back up into ggplot, then it works f

[R] reshape "Error in data[, timevar] : incorrect number of dimensions"

2008-09-27 Thread Keith Schnakenberg
I have two waves of a survey given to students at various middle schools and high schools, with student id numbers for each student. I am having difficulty reshaping the file from long to wide. My code is below: library(foreign) svy <- read.spss("studsur4.SAV") svy.wide <- reshape(svy, time

Re: [R] remove multiple elements from vector

2008-09-27 Thread baptiste auguie
Hi, ?unique should work fine for this. I think the problem in your implementation is that you modify x in the loop, in particular its length may become shorter than the stopping condition. HTH, baptiste On 27 Sep 2008, at 14:30, Bastian Offermann wrote: Hello all, one brief question

Re: [R] FW: logistic regression

2008-09-27 Thread Frank E Harrell Jr
Darin Brooks wrote: Sorry. Let me try again then. I am trying to find "significant" predictors" from a list of about 44 independent variables. So I started with all 44 variables and ran Why? What is wrong with insignificant predictors? drop1(sep22lr, test="Chisq")... and then dropped the

[R] Problem to male an Index in looping

2008-09-27 Thread dimitrisk
Hi, I am trying to use (i) as an index but R considers it as a function and not as text. To be more specific I would like for example to estimate some regressions named qrnox1, qrnox2, qrnox3,. and so on. But when I am using qrnox(i) ot qrnox[i] it tries to find the ith element of vector qr

[R] plotting with a table right under it

2008-09-27 Thread david8373
Hi guys, I'm new to R and this might be a basic question. I want to have a plot with a table right under it containing all the data in the plot. Is that possible in R? How do to it? Thanks! Yuhan -- View this message in context: http://www.nabble.com/plotting-with-a-table-right-under-it-tp197

[R] Equivalent AIC values

2008-09-27 Thread Kimberly Sheldon
Hello R-helpers. We have a question about AIC values. We ran several different GLMs (quadratic, interactions) and our lowest AIC values were the same for several different models. We don't know how to interpret this. Any thoughts? Thanks in advance. Katrina Shelding

[R] Double integration - Gauss Quadrature

2008-09-27 Thread Susanne Pfeifer
Hi, I would like to solve a double integral of the form \int_0^1 \int_0^1 x*y dx dy using Gauss Quadrature. I know that I can use R's integrate function to calculate it: integrate(function(y) { sapply(y, function(y) { integrate(function(x) x*y, 0, 1)$value }) }, 0, 1) but I would like to use

[R] remove multiple elements from vector

2008-09-27 Thread Bastian Offermann
Hello all, one brief question I would like to remove double/triple elements from a vector, e.g. 0 1 1 1 1 2 2 2 4 5 6 6 but keep one of these multiple ones. Should look like this finally: 0 1 2 4 5 6 My function does not work somehow for(i in 2 : length(x)) {

Re: [R] Installing DSE package.

2008-09-27 Thread Sarah Goslee
If you look at the download page, or the index, or the online help for dse, they all point out that dse is a bundle containing several packages, none named "dse". Have you tried library(dse1) and library(dse2) If you have, and that does not work, please send the information requested in the postin

[R] Installing DSE package.

2008-09-27 Thread rkevinburton
Hello R users, I am trying to get package 'dse' and it seems to download OK: bundle 'dse' successfully unpacked and MD5 sums checked But when I try to use it I get: > help(package="dse") Error in .find.package(pkgName, lib.loc, verbose = verbose) : there is no package called '

[R] Installing DSE package.

2008-09-27 Thread rkevinburton
Sorry, this should have the rigth subject now. [EMAIL PROTECTED] wrote: > I am trying to get package 'dse' and it seems to download OK: > > Content type 'application/zip' length 1413606 bytes (1.3 Mb) > opened URL > downloaded 1.3 Mb > > bundle 'dse' successfully unpacked and MD5 sums check

Re: [R] List of varying length suitable for use as dimnames

2008-09-27 Thread rkevinburton
I am trying to get package 'dse' and it seems to download OK: Content type 'application/zip' length 1413606 bytes (1.3 Mb) opened URL downloaded 1.3 Mb bundle 'dse' successfully unpacked and MD5 sums checked The downloaded packages are in . . . \downloaded_packages updating HTML package

Re: [R] List of varying length suitable for use as dimnames

2008-09-27 Thread jim holtman
It is easy enough to create the list, the real question is what do you want in it ( provide commented, minimal, self-contained, reproducible code). Here is the list: > x <- vector('list', 10) > names(x) <- paste("SS", 1:10, sep='') > x $SS1 NULL $SS2 NULL $SS3 NULL $SS4 NULL $SS5 NULL $SS6 N

Re: [R] ANOVA between & within variance

2008-09-27 Thread Kingsford Jones
So, rather than the estimated between and within group variances from a standard fixed-effects ANOVA (i.e. the Mean Sqs in the anova table), you are looking for the estimated variance components from a model with crossed random effects? If so, you may find the lmer function found in package lme4 t

Re: [R] Append selectively to components of a list

2008-09-27 Thread jim holtman
Is this what you want: > l <- list(a=c(1), b=c(2,3), c=c(4,5,6)) > l $a [1] 1 $b [1] 2 3 $c [1] 4 5 6 > l$b <- c(l$b, 99) > l $a [1] 1 $b [1] 2 3 99 $c [1] 4 5 6 > Or is you want to dynamically specify the list element: > x <- 'a' > l[[x]] <- c(l[[x]], -99) > l $a [1] 1 -99 $b [1] 2

[R] retrieving weights from a polr object

2008-09-27 Thread John Fox
Dear list members, The polr() function in the MASS package takes an optional weights argument for case weights. Is there any way to retrieve the case weights from the fitted "polr" object? Examining both the object and the code, I don't see how this can be done, but perhaps I've missed something.

[R] Append selectively to components of a list

2008-09-27 Thread Bodea, Tudor D
Dear R users: Is there a way to append selectively to components of a list (if possible, loops are to be avoided)? To illustrate the point, in the example below, I would like to append 99 to vector b of the list l. > l <- list(a=c(1), b=c(2,3), c=c(4,5,6)) > l $a [1] 1 $b [1] 2 3 $c [1] 4 5 6

Re: [R] Bug in "is" ?

2008-09-27 Thread Martin Maechler
I'm replying to this on the R-devel mailing list and the Subject "On modes, types and R documentation" Martin __ 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/po

Re: [R] bar and line plot

2008-09-27 Thread Felipe Carrillo
Hi Jim: Thanks for your suggestion from the plotrix package. That's exactly what I was looking for, however, I can't see the dates along the X axis and neither the temp line (I only see the thicks). Is there a way to actually plot the temp line? I have been using the ggplot2 package and I am abl

[R] List of varying length suitable for use as dimnames

2008-09-27 Thread John Sorkin
Windows XP R 2.7.2 I would like to create a list of varying length (length n) suitable for use as dimnames for a matrix whose size will vary, i.e. SS1 SS2 SS3 . . . SSn Ansy suggestions for accomplishing this would be appreciated. Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and I

[R] Logistic regression problem

2008-09-27 Thread milicic.marko
I have a huge data set with thousands of variable and one binary variable. I know that most of the variables are correlated and are not good predictors... but... It is very hard to start modeling with such a huge dataset. What would be your suggestion. How to make a first cut... how to eliminate m

[R] List of varying length suitable for use as dimnames

2008-09-27 Thread John Sorkin
Windows XP R 2.7.2 I need to create a list of varying length of the form SS1 SS2 SS3 . . . SSn I will be using the list for the dimnames of a matrix that will have varying dimensions. Any suggestions for a good way to accomplish this would be appreciated. Thanks, John Confidentiality Statemen

Re: [R] Regression and data types

2008-09-27 Thread Ted Harding
On 27-Sep-08 15:18:32, Gavin Simpson wrote: > On Fri, 2008-09-26 at 13:17 +0100, GRANT Lewis wrote: >> Dear All >> I have three data sets, X1, X2 and Y. X1 is data, X2 and Y were >> generated in (different) R programs. All three vectors have one >> column of 60 data points. >> I am using the code l

Re: [R] Bug in "is" ?

2008-09-27 Thread John Kane
Yes. Also a redundent , following the first ) --- On Fri, 9/26/08, Roy Mendelssohn <[EMAIL PROTECTED]> wrote: > From: Roy Mendelssohn <[EMAIL PROTECTED]> > Subject: Re: [R] Bug in "is" ? > To: "R help" <[EMAIL PROTECTED]> > Received: Friday, September 26, 2008, 12:24 PM > From the R-web pages

Re: [R] A Book for SAS, SPSS and R students

2008-09-27 Thread John Kane
Thank you, an interesting interview and I have used the original pdf version more than once though I tend to use it to think about how convert R to SAS rather than SAS to R. --- On Fri, 9/26/08, Ajay ohri <[EMAIL PROTECTED]> wrote: > From: Ajay ohri <[EMAIL PROTECTED]> > Subject: [R] A Book

Re: [R] Moving windows solution

2008-09-27 Thread Gabor Grothendieck
Try this: > BOD # comes with R Time demand 118.3 22 10.3 33 19.0 44 16.0 55 15.6 67 19.8 > rollapply(as.zoo(as.matrix(BOD)), 3, sum) 2 6 37.6 3 9 45.3 4 12 50.6 5 16 51.4 rollapply has many more options and capabilities. See ?rollapply On Sat, Sep 27,

[R] multiple plots - editing ggplot2 plot

2008-09-27 Thread Pedro Barros
Hi All, I am trying to build a composite plot, with multiple categories, using ggplot2. In principle, it could be done using facetting, but I do not seem to be able to get past the defaults, so I try building each plot separately, then putting them all together using frameGrob and placeGrob. For

Re: [R] Regression and data types

2008-09-27 Thread Gavin Simpson
On Fri, 2008-09-26 at 13:17 +0100, GRANT Lewis wrote: > Dear All > I have three data sets, X1, X2 and Y. X1 is data, X2 and Y were > generated in (different) R programs. All three vectors have one column > of 60 data points. > I am using the code lm(Y~X1)$coef and lm(Y~X2)$coef. Others have repli

Re: [R] Moving windows solution

2008-09-27 Thread milicic.marko
Thanks Gabor, But the function I intend to apply requires data.frame object ... not zoo() object have you had expirience with this kind of problems. On Sep 27, 3:59 pm, "Gabor Grothendieck" <[EMAIL PROTECTED]> wrote: > rollapply in the zoo package does that. See ?rollapply and the > three accom

[R] Using "by" to create individual variance-covariance matrices

2008-09-27 Thread Josh B
Hello R list subscribers, I am trying to use the "by" command to create line-specific variance covariance matrices (where "x" is the original data matrix): by(x, x$line, function(d) { d.clean <- d[,-1]}) write.table(d.clean$line[1,1], sep = ",", file = "covariances.csv", col.names = FALSE, row.

Re: [R] Moving windows solution

2008-09-27 Thread Gabor Grothendieck
rollapply in the zoo package does that. See ?rollapply and the three accompanying vignettes. > library(zoo) > z <- zoo(1:10) > rollapply(z, 3, sum) 2 3 4 5 6 7 8 9 6 9 12 15 18 21 24 27 On Sat, Sep 27, 2008 at 10:45 AM, milicic.marko <[EMAIL PROTECTED]> wrote: > Is there an implementat

[R] Moving windows solution

2008-09-27 Thread milicic.marko
Is there an implementation of moving window functionality so I can apply any function while sliding trough window. Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pr

Re: [R] cca constraining variables table

2008-09-27 Thread Gavin Simpson
On Fri, 2008-09-26 at 06:11 -0700, glaporta wrote: > I performed canonical correspondence analysis (cca) with the example data of > vegan, but I'm not able to obtain a table like scores() for the constraining > variables. I can see them in the summary() mode, but it would be great to > have in a se

Re: [R] quantile / centile

2008-09-27 Thread Peter Dalgaard
Donald Braman wrote: Thanks, for the response! Unfortunately, I was unclear; my problem is not that I need to know what the percentile ranges are, but that I need to assign an appropriate percentile range to each of the records in my dataframe. My dataframe contains somewhere between 1000 and 9

Re: [R] FW: logistic regression

2008-09-27 Thread Kevin E. Thorpe
Darin Brooks wrote: > Sorry. > > Let me try again then. > > I am trying to find "significant" predictors" from a list of about 44 > independent variables. So I started with all 44 variables and ran > drop1(sep22lr, test="Chisq")... and then dropped the highest p value from > the run. Then I rer

[R] Double integration - Gauss Quadrature

2008-09-27 Thread Susanne Pfeifer
Hi, I would like to solve a double integral of the form \int_0^1 \int_0^1 x*y dx dy using Gauss Quadrature. I know that I can use R's integrate function to calculate it: integrate(function(y) { sapply(y, function(y) { integrate(function(x) x*y, 0, 1)$value }) }, 0, 1) but I would like to use

Re: [R] ggplot, getting two scales and one stat.

2008-09-27 Thread hadley wickham
On Sat, Sep 27, 2008 at 1:08 AM, Tylere Couture <[EMAIL PROTECTED]> wrote: > I have a simple plot: > > ggplot(polls, aes(x =Date, y = Popular_Support, colour=Party, shape=Source)) > + > stat_smooth(span=0.5) + > geom_point() > > How can I get the smooth to only render along one of the scales? ie, I

[R] FW: logistic regression

2008-09-27 Thread Darin Brooks
Sorry. Let me try again then. I am trying to find "significant" predictors" from a list of about 44 independent variables. So I started with all 44 variables and ran drop1(sep22lr, test="Chisq")... and then dropped the highest p value from the run. Then I reran the drop1. Model: MIN_Mstocked

Re: [R] quantile / centile

2008-09-27 Thread Donald Braman
Thanks, for the response! Unfortunately, I was unclear; my problem is not that I need to know what the percentile ranges are, but that I need to assign an appropriate percentile range to each of the records in my dataframe. My dataframe contains somewhere between 1000 and 9000 rows/records in my

Re: [R] Using the mcmcsamp function

2008-09-27 Thread Hank Stevens
mcmcsamp does not yet operate on non-normal distributions. Hank On Sep 27, 2008, at 9:06 AM, Parry Clarke wrote: Hello, I'm building a couple of mixed models using the lmer function. The actual modelling is going well, but doing some reading on the use of crossed random effects and the compa

[R] Using the mcmcsamp function

2008-09-27 Thread Parry Clarke
Hello, I'm building a couple of mixed models using the lmer function. The actual modelling is going well, but doing some reading on the use of crossed random effects and the comparison of models with and without random effects it is clear that I need to generate some Markov Chain Monte Carlo sampl

Re: [R] quantile / centile

2008-09-27 Thread Henrique Dallazuanna
Try this: my.df$my.newvar <- quantile(my.df$my.var, probs = seq(0.01,1, 0.01)) On Sat, Sep 27, 2008 at 3:50 AM, Donald Braman <[EMAIL PROTECTED]> wrote: > I'm wondering if there is a simple way to assign a quantile to a vector in a > data frame, much like one could in Stata using centile. Let's

[R] Problem with R on dual core under Linux - can not execute mpi.spawn.Rslaves()

2008-09-27 Thread Rainer M Krug
Hi I am trying to utilize my dual core processor (and later a High-performance clusters (HPC) ) by using the Rmpi, snow, snowfall, ... packages, but I am struggling at the beginning, i.e. to initialise the "cluster" on my dual core computer. Whenever I try to initialize it (via sfInit(parallel=TRU

Re: [R] logistic regression

2008-09-27 Thread Kevin E. Thorpe
Darin Brooks wrote: > Good afternoon > > I have what I hope is a simple logistic regression issue. > > I started with 44 independent variables and then used the drop1, > test="chisq" to reduce the list to 8 significant independent variables. > > drop1(sep22lr, test="Chisq") and wound up wit

[R] writeMat error

2008-09-27 Thread Steele, Dr Douglas
Hi I am using Ubuntu 8.04 64 bit, R as below, Matlab 7.6.0. I would like to transfer mat files back and forward between R and Matlab. Whilst I have used Matlab for years its been a long time since I have used R (hence question may be a bit simple) Running code A <- c(1:10) dim(A) <- c(2,5

Re: [R] Trend graph

2008-09-27 Thread Jim Lemon
C.H. wrote: Dear R Gurus, I have a problem related to plot. For example, I have two variables, pre and post. pre <- c(1,2,3,4,5) post <- c(2,5,7,2,3) How can I plot a line graph similar to this one? http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1847566&rendertype=figure&id=F1 Wou

Re: [R] bar and line plot

2008-09-27 Thread Jim Lemon
Felipe Carrillo wrote: Hello All: Using the below dataset how can I make a barplot with Date(X) and NumEggs(Y) by Site. Then plot Temp(lineplot) It seems really simple, but I am having a hard time trying to do it by Site. Thanks Hi Felipe, This might do what you want: fdc<-r

[R] compute posterior mean by numerical integration

2008-09-27 Thread Andreas Wittmann
Dear R useRs, i try to compute the posterior mean for the parameters omega and beta for the following posterior density. I have simulated data where i know that the true values of omega=12 and beta=0.01. With the function postMeanOmega and postMeanBeta i wanted to compute the mean values of om

Re: [R] Convex optimization in R?

2008-09-27 Thread Paul Smith
On Sat, Sep 27, 2008 at 3:32 AM, Hesen Peng <[EMAIL PROTECTED]> wrote: > Well, I finally figured out to do some algebra transformation and the > problem was reduced to non-linear optimization on bounded areas. But > on my way to this I ran into IMSL Fortran library function NNLPF. And > its documen

[R] ariable Importance Measure in Package RandomForest

2008-09-27 Thread linuxkaffee
Hi, I've a question about the RandomForest package. The package allows the extraction of a variable importance measure. As far as I could see from the documentation, the computation is based on the Gini index. Do you know if this extraction can be also based on other criteria? In particular, I'

Re: [R] ANOVA between & within variance

2008-09-27 Thread Gregor Rolshausen
dear Dr. Kubovy, I am sorry. but the Variance table is not exactly what I want. I want the partitioned VARIANCE for between and within the groups. the anova ()-table just gives me the SumSq and the mean Sq... I know how to run t.test and ANOVA! in the nlme-package there is the VarCorr functio

[R] ggplot multiple scales but a stat for only one of them

2008-09-27 Thread galneweinhaw
I have a simple plot: ggplot(polls, aes(x =Date, y = Popular_Support, colour=Party, shape=Source)) + stat_smooth(span=0.5) + geom_point() How can I get the smooth to only render along one of the scales? ie, I want to see regressions for each colour, but not each shape. Right now I get a trendl

Re: [R] How can I easily rbind a list of data frames into one data frame?

2008-09-27 Thread N. Lapidus
Try do.call("rbind", nameofyourlist) Nael On Sat, Sep 27, 2008 at 8:51 AM, Matthew Pettis <[EMAIL PROTECTED]>wrote: > Hi, > > I have a list output from the 'lapply' function where the value of > each element of a list is a data frame (each data frame in the list > has the same column types). How