Re: [R] Constrained Regression

2010-10-31 Thread Jim Silverton
Hello everyone, I have 3 variables Y, X1 and X2. Each variables lies between 0 and 1. I want to do a constrained regression such that a0 and (1-a) 0 for the model: Y = a*X1 + (1-a)*X2 I tried the help on the constrained regression in R but I concede that it was not helpful. Any help is greatly

[R] make many barplot into one plot

2010-10-31 Thread Sibylle Stöckli
Dear R users I would like to group my barplot graph (see example on the R help link). The proposed R code, adding individual bars to the plot, looks really overwhelming. My specific dataset just consists of five groups and three different levels within each groups (the individual bars).

[R] Need help with lmer model specification syntax for nested mixed model

2010-10-31 Thread Carabiniero
I haven't been able to fully make sense of the conflicting online information about whether and how to specify nesting structure for a nested, mixed model. I'll describe my experiment and hopefully somebody who knows lme4 well can help. We're measuring the fluorescence intensity of brain slices

[R] How to control in order of groups in xyplot

2010-10-31 Thread Jie Liu
Hi guys, I used the following R code to generate one plot library(lattice) xyplot(Y~X1|as.factor(X2)*as.factor(X3), groups = as.factor(X4), data=mydata) Both X2 and X3 have three values. X4 has two values. I got 3x3 grids and in each grid there are two curves about y~x1 for the two X4 values. I

[R] biglm: how it handles large data set?

2010-10-31 Thread noclue_
I am trying to figure out why 'biglm' can handle large data set... According to the R document - biglm creates a linear model object that uses only p^2 memory for p variables. It can be updated with more data using update. This allows linear regression on data sets larger than memory. After

Re: [R] How to control in order of groups in xyplot

2010-10-31 Thread Rainer Hurling
A working minimal example would have been better, see FAQ. But I think you are looking for the following: X2 - factor(c(m=2, m=5, m=10), levels=c(m=2, m=5, m=10)) Here levels are ordered in your way. There might be other solutions for this ordering problem. Hope it helps, Rainer On

Re: [R] for loop

2010-10-31 Thread Matevž Pavlič
Hi Dennis, Thank you for your extensive explanations. Yes, I guess I did not explain what I would like to do. Basically I would like to conduct a linear regression for each of 15 classes. Your answers gave me new Perspective on how R works. Thanks again for the help, m From:

Re: [R] R-help Digest, Vol 92, Issue 31

2010-10-31 Thread Uwe Ligges
On 31.10.2010 05:22, Neyra Peña wrote: Hi, I'd like to unsubscribe from the list. Thanks Neyra Have you ever read the first lines (those I still cite below) of the message you got that already tells you how to unsubscribe? Uwe Ligges De:

[R] Downloading Package Sources

2010-10-31 Thread Santosh Srinivas
Dear Group, any idea how I can download the source code for all packages in Windows 7? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and

Re: [R] return value for grep

2010-10-31 Thread Duncan Murdoch
Ulrich wrote: Hi, is it possible to easily change the return value for the grep function for cases where there is no match, for example the value 0 or No instead of integer (0) )? It sounds like you might want grepl (which returns a vector of TRUE and FALSE values) rather than grep

Re: [R] R VBA

2010-10-31 Thread julien cuisinier
Many thanks for the feedback the mailing list reference - will do Obviously I am feeling very stupid now, not sure I missed that =0 sorry for that silly question Rgds, Julien On Oct 30, 2010, at 8:56 PM, RICHARD M. HEIBERGER wrote: Look at the macro RInterface.PutArrayFromVBA documented

Re: [R] For loop

2010-10-31 Thread Astabenefica
Thanks for the suggestions. I add some more detail to clarify: h=matrix(nrow=1,ncol=22) In my data h is: (0.25 0.25 0 0 0 0 -0.25 -0.25 -0.25 -0.25 -0.5 -0.5 0 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25) xx-seq(0,1,0.5) v=matrix(nrow=20001,ncol=22)

Re: [R] How to control in order of groups in xyplot

2010-10-31 Thread Peter Ehlers
On 2010-10-31 01:19, Rainer Hurling wrote: A working minimal example would have been better, see FAQ. But I think you are looking for the following: X2- factor(c(m=2, m=5, m=10), levels=c(m=2, m=5, m=10)) Here levels are ordered in your way. There might be other solutions for this ordering

Re: [R] Constrained Regression

2010-10-31 Thread Ravi Varadhan
What is the stochastic mechanism that generates the data? In other words, what distribution is Y, conditioned on X1 and X2, supposed to be? You can also get `a' if you do not wanrt to specify the probability mechanism by just doing a least squares fitting, but then making inferences can be a

[R] Randomly split a sample in two equal subsamples

2010-10-31 Thread Yoan Mihov
Dear all, I would like to randomly split a sample in two equally large subsamples. The sample data is stored as a matrix with each row representing an individual and each column representing some variable (e.g., name, age, sex, etc.); the first row contains the names of the variables; the first

[R] extracting named vector from dataframe

2010-10-31 Thread James Hirschorn
Suppose df is a dataframe with one named row of numeric observations. I want to coerce df into a named vector. as.vector does not work as I expected: as.vector(df) returns the original dataframe, while as.vector(df,mode=numeric) returns an unnamed vector of NAs. This works: v -

Re: [R] Constrained Regression

2010-10-31 Thread David Winsemius
On Oct 31, 2010, at 2:44 AM, Jim Silverton wrote: Hello everyone, I have 3 variables Y, X1 and X2. Each variables lies between 0 and 1. I want to do a constrained regression such that a0 and (1-a) 0 for the model: Y = a*X1 + (1-a)*X2 It would not accomplish the constraint that a 0 but

Re: [R] extracting named vector from dataframe

2010-10-31 Thread baptiste auguie
Hi, I think you want ?unlist d = data.frame(x=1, y=2, z=3) v = unlist(d) is(v) [1] numeric vector HTH, baptiste On 31 October 2010 16:54, James Hirschorn james.hirsch...@hotmail.com wrote: Suppose df is a dataframe with one named row of numeric observations. I want to coerce df into a named

Re: [R] extracting named vector from dataframe

2010-10-31 Thread David Winsemius
On Oct 31, 2010, at 11:54 AM, James Hirschorn wrote: Suppose df is a dataframe with one named row of numeric observations. I want to coerce df into a named vector. I don't think you understand the structure of dataframes. They are named lists of component columns. The names you are

Re: [R] Randomly split a sample in two equal subsamples

2010-10-31 Thread Wu Gong
Hi Yoan, Please try ?sample. Suppose you have 1:n ids of total observations where n is even, you want to randomly split it into two subsamples, the following code should work. n - 20 one.sample - sort(sample(1:n, n/2)) another.sample - (1:n)[-one.sample] Good luck. Wu - A R learner. --

Re: [R] Need help with lmer model specification syntax for nested mixed model

2010-10-31 Thread Douglas Bates
On Sun, Oct 31, 2010 at 2:35 AM, Carabiniero ja...@troutnut.com wrote: I haven't been able to fully make sense of the conflicting online information about whether and how to specify nesting structure for a nested, mixed model.  I'll describe my experiment and hopefully somebody who knows lme4

Re: [R] Constrained Regression

2010-10-31 Thread Spencer Graves
Have you tried the 'sos' package? install.packages('sos') # if not already installed library(sos) cr - ???'constrained regression' # found 149 matches summary(cr) # in 69 packages cr # opens a table in a browser listing all 169 matches with links to the help pages However, I agree

Re: [R] doubt in climate variability analysis in R! - code

2010-10-31 Thread govindas
I am sorry, i think the link was broken..! here is the correct one!!! http://www.4shared.com/file/4zV0g3JR/RF_80-85.html [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] complicated graphic -- persp+map

2010-10-31 Thread claudia tebaldi
Hello I'm trying to render in 3D what I usually plot by image(), or image.plot() from the library fields, followed by a map(world,add=TRUE) type of command. More concretely, I have a field of temperature values, for a given geographic area, and I would like to plot a 3D surface whose x and y axes

Re: [R] make many barplot into one plot

2010-10-31 Thread Thomas Levine
hierobarp or barNest from {plotrix} may do this more neatly. 2010/10/31 Sibylle Stöckli sibylle.stoec...@gmx.ch Dear R users I would like to group my barplot graph (see example on the R help link). The proposed R code, adding individual bars to the plot, looks really overwhelming. My

Re: [R] Constrained Regression

2010-10-31 Thread David Winsemius
On Oct 31, 2010, at 12:54 PM, Spencer Graves wrote: Have you tried the 'sos' package? I have, and I am taking this opportunity to load it with my .Rprofile to make it more accessible. It works very well. Very clean display. I also have constructed a variant of RSiteSearch that I find

Re: [R] Randomly split a sample in two equal subsamples

2010-10-31 Thread yoan
Thanks, but I just don't know how to translate that to a dataset with rows and columns. Initially, I was thinking about something like that: # Create some data: a - c(10,20,15,43,76,41,25,46) b - factor(c(m, w, m, w, m, w, m, w)) c - c(2,5,8,3,6,1,5,6) number - c(1:8) myframe - data.frame(a,b,c,

Re: [R] Randomly split a sample in two equal subsamples

2010-10-31 Thread Wu Gong
firsthalf - myframe[v1,] or firsthalf - subset(myframe, number %in% v1) - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Randomly-split-a-sample-in-two-equal-subsamples-tp3021140p3021353.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] extracting named vector from dataframe

2010-10-31 Thread James Hirschorn
Of course you are right that this would not be appropriate in general, but what I'm doing--which as Baptiste explained can be done much more nicely with unlist()---seems reasonable in my context: The dataframe has a computed statistic for each input, but I need a vector so that I can do operations

Re: [R] Downloading Package Sources

2010-10-31 Thread Uwe Ligges
On 31.10.2010 11:30, Santosh Srinivas wrote: Dear Group, any idea how I can download the source code for all packages in Windows 7? Either apply wget on yourCRANmirror/src/contrib/ or - choose CRAN mirror - select CRAN as the only repository (unless yoiu want other packages as well) -

[R] Questions about Probit Analysis

2010-10-31 Thread Lorenzo Isella
Dear All, I have some questions about probit regressions. I saw a nice introduction at http://bit.ly/bU9xL5 and I mainly have two questions. (1) The first is almost about data manipulation. Consider the following snippet ## mydata -

Re: [R] Randomly split a sample in two equal subsamples

2010-10-31 Thread yoan
Thanks, it works! -- View this message in context: http://r.789695.n4.nabble.com/Randomly-split-a-sample-in-two-equal-subsamples-tp3021140p3021365.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] extracting named vector from dataframe

2010-10-31 Thread Gabor Grothendieck
On Sun, Oct 31, 2010 at 12:11 PM, baptiste auguie baptiste.aug...@googlemail.com wrote: Hi, I think you want ?unlist d = data.frame(x=1, y=2, z=3) v = unlist(d) is(v) [1] numeric vector Here are a few other possibilities too: drop(as.matrix(d)) do.call(c, d) sapply(d,

[R] latex on summary.formula from Hmisc doesn't remove N

2010-10-31 Thread Thijs Muizelaar
Hi All, I'm trying to get a summary table of my datasets, in which I want the mean of different groups calculated and presented in a table. I want this table to easily be exported to LaTeX. However, I'm not able to remove the N in this summary table. It gives the following error: Error in

[R] transfer string to expression

2010-10-31 Thread Yilong Zhang
Dear all: when I use parse() there is some problems. Below is an example: b0-1 b1-1 x-1 str2expr-function(x){eval(parse(text=x))} test1-b0+b1*sqrt(x) test2-b0+b1 str2expr(test1) str2expr(test2) it can work well for test2 but not for test1. Could you tell me how to fix this problem or is there

Re: [R] transfer string to expression

2010-10-31 Thread Duncan Murdoch
On 31/10/2010 3:22 PM, Yilong Zhang wrote: Dear all: when I use parse() there is some problems. Below is an example: b0-1 b1-1 x-1 str2expr-function(x){eval(parse(text=x))} test1-b0+b1*sqrt(x) test2-b0+b1 str2expr(test1) str2expr(test2) it can work well for test2 but not for test1. Could you

Re: [R] transfer string to expression

2010-10-31 Thread David Winsemius
On Oct 31, 2010, at 3:22 PM, Yilong Zhang wrote: Dear all: when I use parse() there is some problems. Below is an example: b0-1 b1-1 x-1 str2expr-function(x){eval(parse(text=x))} test1-b0+b1*sqrt(x) test2-b0+b1 str2expr(test1) str2expr(test2) I don't think the scoping rules are up to the

Re: [R] complicated graphic -- persp+map

2010-10-31 Thread Duncan Murdoch
On 31/10/2010 1:29 PM, claudia tebaldi wrote: Hello I'm trying to render in 3D what I usually plot by image(), or image.plot() from the library fields, followed by a map(world,add=TRUE) type of command. More concretely, I have a field of temperature values, for a given geographic area, and I

Re: [R] transfer string to expression

2010-10-31 Thread Wu Gong
Hi Duncan: I'm curious about the environment setting. ?eval says: If envir is not specified, then the default is parent.frame() (the environment where the call to eval was made). So what's the difference between set envir=parent.frame() or not? Thank you. Wu - A R learner. -- View

Re: [R] transfer string to expression

2010-10-31 Thread Duncan Murdoch
On 31/10/2010 4:47 PM, Wu Gong wrote: Hi Duncan: I'm curious about the environment setting. ?eval says: If envir is not specified, then the default is parent.frame() (the environment where the call to eval was made). So what's the difference between set envir=parent.frame() or not? If you

Re: [R] doubt in climate variability analysis in R! - code

2010-10-31 Thread steven mosher
Ok I downloaded it and showed you how to get your data out. How to read it into a raster brick, how to plot the data, how to get the mean rainfall of every day.lots more you can do. there is a bad bit of data in the last time step. check my blog. In the future what you should do is write code

Re: [R] For loop

2010-10-31 Thread Joshua Wiley
Hi, Using the code below I got almost a 60% speedup. Obviously this is largely dependent on there being relatively fewer columns than rows. HTH, Josh # ## Create data h - structure(c(0.25, 0.25, 0, 0, 0, 0, -0.25, -0.25, -0.25, -0.25, -0.5, -0.5, 0, 0.25, 0.25,

Re: [R] For loop

2010-10-31 Thread Joshua Wiley
Actually, I'm able to gain another second by limiting -/+s in the subscripts (maybe just an artifact? I ran it a couple of times to check, but still). system.time(for(k in 22:2) { tmp - xx.2 * v.2[, k] for(j in 2:1) { vv.2[j, k] - min(tmp[j], vv.2[j+1, k]) } v.2[-1, k-1] - h.2[1,

[R] parallel for loop

2010-10-31 Thread sachinthaka . abeywardana
Hi all, Just following on from a previous thread (for loop). Is there a parallel 'for' loop like matlab (parfor maybe?). I know there was a Nvidia GPU version for blas somewhere. But is there a CPU or a GPU version of the for loop? Thanks, Sachin p.s. sorry about the corporate notice below:

Re: [R] parallel for loop

2010-10-31 Thread Jeffrey Spies
Take a look at the parallel computing section of: http://cran.r-project.org/web/views/HighPerformanceComputing.html specifically the line concerning the foreach package. Jeff. On Sun, Oct 31, 2010 at 6:38 PM, sachinthaka.abeyward...@allianz.com.au wrote: Hi all, Just following on from a

[R] Rserve error

2010-10-31 Thread Anand Bambhania
Hi all, I'm trying to run Rserve on windows RGui. It installs successfully but when I use Rserve() to invoke the service it shows following error: The program can't start because R.dll is missing from your computer. Try reinstalling the program to fix this problem. I even tried reinstalling R

[R] how to save this result in a vector

2010-10-31 Thread Changbin Du
HI, Dear R community, I have the following codes to calculate the commulative coverage. I want to save the output in a vector, How to do this? test-seq(10, 342, by=2) #cover is a vector cover_per-function (cover) { for (i in min(cover):max(cover)) {print(100*sum(ifelse(cover = i, 1,

Re: [R] how to save this result in a vector

2010-10-31 Thread Joshua Wiley
Hi Changbin, The yek is that you need to save the results of your for loop rather than just printing it. It also may be possible to vectorize your for loop which might simplify things and speed them up, but I did not look at that. Here is one way to save the results, see inline comments for

Re: [R] how to save this result in a vector

2010-10-31 Thread David Winsemius
On Oct 31, 2010, at 8:35 PM, Changbin Du wrote: HI, Dear R community, I have the following codes to calculate the commulative coverage. Not sure exactly what you mean by this. My guess is implemented below. I want to save the output in a vector, How to do this? test-seq(10, 342, by=2)

Re: [R] how to save this result in a vector

2010-10-31 Thread Joshua Wiley
On Sun, Oct 31, 2010 at 5:44 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: snip #cover is a vector cover_per - function(cover) {  ## create a vector to store the results of your for loop  output - vector(numeric, length(min(cover):max(cover)))  for (i in min(cover):max(cover)) {    ##

Re: [R] how to save this result in a vector

2010-10-31 Thread Changbin Du
HI, David, Juan, and Joshua, Thanks so much for your help! The following codes works. Appreciated! test-seq(10, 342, by=2) #data is a vector cover_per-function (data) { output-vector(numeric,length(min(data):max(data))) for (i in min(data):max(data)) {

Re: [R] how to save this result in a vector

2010-10-31 Thread Changbin Du
Thanks Joshua! Yes, i is not going up sequentially by 1, as i here is the raw number of reads for each DNA base. Thanks so much for the great help! On Sun, Oct 31, 2010 at 6:03 PM, Joshua Wiley jwiley.ps...@gmail.comwrote: On Sun, Oct 31, 2010 at 5:44 PM, Joshua Wiley jwiley.ps...@gmail.com

Re: [R] Constrained Regression

2010-10-31 Thread Jim Silverton
I thought I would 'add' some meat to the problem I sent. This is all I know (1) f = a*X1 + (1-a)*X2 (2) I know n values of f and X1 which happens to be probabilities (3) I know nothing about X2 except that it also lies in (0,1) (4) X1 is the probability under the null (fisher's exact test) and X2

[R] Mean and individual growth curve trajectories

2010-10-31 Thread jlwoodard
I'm trying to understand how to plot individual growth curve trajectories, with the overall mean trajectory superimposed (preferably in a slightly thicker line, maybe in black) over the individual trajectories. Using the sleepstudy data in lme4, here is the code I have so far: library(lme4)

Re: [R] Constrained Regression

2010-10-31 Thread Spencer Graves
in line On 10/31/2010 6:26 PM, Jim Silverton wrote: I thought I would 'add' some meat to the problem I sent. This is all I know (1) f = a*X1 + (1-a)*X2 How do you know f = a*X1 + (1-a)*X2? Why does this relationship make more sense than, e.g., log(f/(1-f)) = a*X1 + (1-a)*X2? (2) I

Re: [R] Mean and individual growth curve trajectories

2010-10-31 Thread Michael Bibo
jlwoodard john.woodard at wayne.edu writes: I'm trying to understand how to plot individual growth curve trajectories, with the overall mean trajectory superimposed (preferably in a slightly thicker line, maybe in black) over the individual trajectories. Using the sleepstudy data in

[R] combining plots (curve + Plot functions)

2010-10-31 Thread mmstat
Hello,   What I really want to do is to add a rejection region in the form of a long rectangle to a density plot I have drawn.  I am getting  2 plots.  How can I add rectangle to first plot?  see code below. First section works fine.  It just is not quite what I want. # NORMAL DISTRIBUTION

Re: [R] Mean and individual growth curve trajectories

2010-10-31 Thread jlwoodard
Thank you so much, Michael. This solution is just what I was looking for. Many thanks! John -- View this message in context: http://r.789695.n4.nabble.com/Mean-and-individual-growth-curve-trajectories-tp3021672p3021746.html Sent from the R help mailing list archive at Nabble.com.