Re: [R] Longitudinal categorical response data

2011-03-26 Thread Rune Haubo
lmer is not designed for ordered categorical data as yours are. You could take a look at the ordinal package which is designed for this type of data including mixed models (function clmm) which you probably want to use. Best, Rune Den 24/03/2011 21.03 skrev Rasanga Ruwanthi

Re: [R] Matching package - Match function

2011-03-26 Thread sunny
I have figured out the solution to this. It appears that distance isn't defined as the difference in propensity scores. Instead, this difference is then scaled by the standard deviation of the predicted dependent-variable values of the corresponding logistic regression, and then squared.

[R] bwplot [lattice]: how to get different y-axis scales for each row?

2011-03-26 Thread Marius Hofert
Dear expeRts, How can I get ... (1) different y-axis scales for each row (2) while having the same y-axis scales for different columns? I coulnd't manage to do this with relation=free [which gives (1) but not (2)]. I also tried relation=sliced, but it did not give the same y-axis scales within

[R] bwplot: how to get plotmath labels?

2011-03-26 Thread Marius Hofert
Dear expeRts, How can I get plotmath-labels in the bwplot below? As you can see, I couldn't manage to pass the expressions through the dimnames argument. Cheers, Marius library(lattice) ## data dim - c(100, 6, 2, 3) dimnames - list(n=paste(n=, seq_len(100), sep=),

Re: [R] Error: cannot allocate vector of size

2011-03-26 Thread Paul Hiemstra
Without more detailed information I would say that R runs out of memory...and furthermore: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. cheers, Paul On 03/25/2011 11:32 PM, mipplor wrote: i run

Re: [R] linear constrained optimization in R

2011-03-26 Thread Hans W Borchers
sammyny sjain at caa.columbia.edu writes: I am trying to use http://rss.acs.unt.edu/Rdoc/library/stats/html/constrOptim.html in R to do optimization in R with some given linear constraints but not able to figure out how to set up the problem. For example, I need to maximize $f(x,y) =

[R] Effect size in multiple regression

2011-03-26 Thread Michael Haenlein
Dear all, is there a convenient way to determine the effect size for a regression coefficient in a multiple regression model? I have a model of the form lm(y ~ A*B*C*D) and would like to determine Cohen's f2 (http://en.wikipedia.org/wiki/Effect_size) for each predictor without having to do it

Re: [R] Effect size in multiple regression

2011-03-26 Thread Joshua Wiley
Hi Michael, You can just fit your model, and then use anova() to get the Sum of Squares. ## fit and store model m - lm(mpg ~ hp * wt * vs, data = mtcars) ## store ANOVA from model msum - anova(m) ## divide all Sums of Squares by the sum() of the Sums of Squares msum[[Sum Sq]]/sum(msum[[Sum Sq]])

[R] NetCDF - rolling means and StdDev

2011-03-26 Thread Steve Friedman
Hello, I am trying to come up with a routine to calculate a rolling mean and standard deviation for three parameters stored in a NetCDF file. The NetCDF file contains 10 years of daily records for each of the three parameters, and I need the statistics for each of the three parameters. Below I

Re: [R] A question on glmnet analysis

2011-03-26 Thread 細田弘吉
Hi Nick, Thanks a lot for your quick response. Sorry for delayed response becasue of time difference between us. (11/03/25 22:40), Nick Sabbe wrote: I haven't read all of your code, but at first read, it seems right. With regard to your questions: 1. Am I doing it correctly or not?

Re: [R] A question on glmnet analysis

2011-03-26 Thread 細田弘吉
(11/03/26 0:12), Mike Marchywka wrote: Would you post your data or if you did I missed it? Sorry, I did not. This is patients' data and I have to obtain some permission from my office to send it, so ... I don't have an answer for you but curious as I was interested in similar analyses

[R] grofit package

2011-03-26 Thread kitty
Does anyone know if it is possible to get the length of the log phase (the main growth phase) from a grofit logistic model? I can get the lag phase length, maximum growth and max rate of growth, but I also want to know the length of the log phase (ie, for how long do the bacteria grow

Re: [R] Error: cannot allocate vector of size

2011-03-26 Thread Uwe Ligges
On 25.03.2011 23:32, mipplor wrote: i run a model ,but i turn out to be like this. but i have run this model days ago and it works well whats going on here? any suggestion. If it worked exactly the way before on the same machine, you probably have too huge objects in your workspace. Uwe

Re: [R] bwplot: how to get plotmath labels?

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 4:47 AM, Marius Hofert wrote: Dear expeRts, How can I get plotmath-labels in the bwplot below? As you can see, I couldn't manage to pass the expressions through the dimnames argument. It would have been helpful, and may still be necessary, for you to explain more

[R] Free license for xlsReadWritePro

2011-03-26 Thread Hans-Peter Suter
Some years ago I travelled through Libya and it's with much emotion that I follow the news. The license below is dedicated to Mohammed Nabbous and will let you run xlsReadWritePro for free (Windows, R 32-bit): library( xlsReadWritePro ) xls.lic( action = register, miscData = list(

Re: [R] bwplot: how to get plotmath labels?

2011-03-26 Thread Marius Hofert
Dear David, many thanks, that was it. Cheers, Marius On 2011-03-26, at 18:04 , David Winsemius wrote: On Mar 26, 2011, at 4:47 AM, Marius Hofert wrote: Dear expeRts, How can I get plotmath-labels in the bwplot below? As you can see, I couldn't manage to pass the expressions through

[R] Building a matrix so that matrix(r, c)-matrix(c, r) with No For Loops

2011-03-26 Thread Brian Pellerin
Hello, I would like to take advantage of the upper.tri() function here but I don't know exactly. Here is some working code... i-5 fi-matrix(0,nrow=i,ncol=i) for(r in 1:i){ for(c in 1:i){ if(r==c){ fi[r,c]-1 }else if(rc){ fi[r,c]-1-runif(1)^.5 }else{ fi[r,c]-fi[c,r] } } } So far I know I can

Re: [R] Tinn-R looses connection to R (Windows Vista)

2011-03-26 Thread Felipe Carrillo
Nutter, Benjamin NutterB at ccf.org writes: I've noticed it, but I haven't looked into it much since I rarely work on Vista. I have found that opening R before I open Tinn-R tends to work better than using Tinn-R to open the preferred GUI. Benjamin -Original Message- From:

[R] Sampling Weights in HB Choice Modelling (e.g., rhierMnlRwMixture)

2011-03-26 Thread Klaus
Is anyone familiar with a way to account for sampling weights (e.g., in order to cope with selection bias) for individual respondents using the bayesm package (e.g., rhierMnlRwMixture)? In the regular MNL this can easily be done in STATA using the mlogit function with pweights option. However, I

[R] Sweave and Textwrangler

2011-03-26 Thread Christopher Desjardins
Hi, I am trying to get TextWrangler to work with LaTeX and Sweave. Ideally I would call a script from TextWrangler that would run Sweave on a document, then LaTeX (using SyncTeX), and finally open the corresponding pdf in Skim. Of course I don't always need to run Sweave and would be looking for

Re: [R] Building a matrix so that matrix(r, c)-matrix(c, r) with No For Loops

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 9:44 AM, Brian Pellerin wrote: Hello, I would like to take advantage of the upper.tri() function here but I don't know exactly. Here is some working code... i-5 fi-matrix(0,nrow=i,ncol=i) for(r in 1:i){ for(c in 1:i){ if(r==c){ fi[r,c]-1 }else if(rc){

Re: [R] Sweave and Textwrangler

2011-03-26 Thread Duncan Murdoch
On 11-03-26 10:58 AM, Christopher Desjardins wrote: Hi, I am trying to get TextWrangler to work with LaTeX and Sweave. Ideally I would call a script from TextWrangler that would run Sweave on a document, then LaTeX (using SyncTeX), and finally open the corresponding pdf in Skim. Of course I

[R] 2 questions about probplot in package e1071

2011-03-26 Thread Thomas Adams
The contributed package e1071 does exactly what I want except that I need to have (1) the abscissa and ordinate axes swapped, with the probability scale on the bottom and the quantiles scale on the LHS. Using the following example: library(e1071) x - rnorm(100, mean=5) probplot(x,

[R] index of sort

2011-03-26 Thread Quan Zhou
Hi How can I return the index of sort, when I use R function sort? or any other sorting functions in R For example, I sorted a vector, but R just return the sorted value without giving me the original index of these data. Thanks a lot. [[alternative HTML version deleted]]

[R] round number

2011-03-26 Thread Alfredo Alessandrini
Hi, a - 4 a*0.2 [1] 0.8 ok!! Is there a method to obtain this: a*0.2 [1] 0.80 I need to round the number also with the zero. Thanks in advance, Alfredo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] 2 questions about probplot in package e1071

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 4:06 PM, Thomas Adams wrote: The contributed package e1071 does exactly what I want except that I need to have (1) the abscissa and ordinate axes swapped, with the probability scale on the bottom and the quantiles scale on the LHS. Using the following example:

Re: [R] index of sort

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 2:03 PM, Quan Zhou wrote: Hi How can I return the index of sort, when I use R function sort? or any other sorting functions in R For example, I sorted a vector, but R just return the sorted value without giving me the original index of these data. You seem to be

Re: [R] 2 questions about probplot in package e1071

2011-03-26 Thread Thomas Adams
David, Thanks! This is very helpful! I'm still very much a novice… Tom On 3/26/11 4:11 PM, David Winsemius wrote: On Mar 26, 2011, at 4:06 PM, Thomas Adams wrote: The contributed package e1071 does exactly what I want except that I need to have (1) the abscissa and ordinate axes swapped,

Re: [R] round number

2011-03-26 Thread Duncan Murdoch
On 11-03-26 2:05 PM, Alfredo Alessandrini wrote: Hi, a- 4 a*0.2 [1] 0.8 ok!! Is there a method to obtain this: a*0.2 [1] 0.80 It is easy to print values with trailing zeros, but I think it's hard to make it the default. The sprintf() function is the one I'd use for the

Re: [R] round number

2011-03-26 Thread Jorge Ivan Velez
Hi Alfredo, Try noquote(sprintf(%.2f, a*.2)) HTH, Jorge On Sat, Mar 26, 2011 at 2:05 PM, Alfredo Alessandrini wrote: Hi, a - 4 a*0.2 [1] 0.8 ok!! Is there a method to obtain this: a*0.2 [1] 0.80 I need to round the number also with the zero. Thanks in advance,

Re: [R] round number

2011-03-26 Thread Petr Savicky
On Sat, Mar 26, 2011 at 07:05:40PM +0100, Alfredo Alessandrini wrote: Hi, a - 4 a*0.2 [1] 0.8 ok!! Is there a method to obtain this: a*0.2 [1] 0.80 I need to round the number also with the zero. Hi. Try the following formatC(a*0.2, digits=2, format=f) [1] 0.80

[R] line graph question

2011-03-26 Thread Bulent Arikan
Hi, I am working on some line charts and although I have a lot of resources, I cannot seem to find an answer to this question: how can I set the incrementation of values on the x-axis values so that I can see all the groups on this axis. Right now, R puts them at increments of 2 (i.e., 2, 4, 6, 8,

Re: [R] line graph question

2011-03-26 Thread Jim Lemon
On 03/27/2011 09:21 AM, Bulent Arikan wrote: Hi, I am working on some line charts and although I have a lot of resources, I cannot seem to find an answer to this question: how can I set the incrementation of values on the x-axis values so that I can see all the groups on this axis. Right now, R

Re: [R] line graph question

2011-03-26 Thread Phil Spector
Bulent - Many characteristics of plots are determined by the graphical parameters documented in the help file for the par function. In this case, the xaxp parameter should be useful. Compare plot(1:12,1:12) with plot(1:12,1:12,xaxp=c(0,12,12)) -

[R] simple if question

2011-03-26 Thread Sebastián Daza
Hi everyone, I have just got different samples from a dataframe (independent and exclusive, there aren't common elements among them). I want to create a variable that indicate the sampling selection of the elements in the original dataframe (for example, 0 = no selected, 1= sample 1, 2=sample

Re: [R] Two matrix loop

2011-03-26 Thread Thomas Levine
This way uses a three-dimensional array instead of the nested apply. It seems to take the same amount of time, even on larger datasets, but it may give you ideas. distance=function(x) daisy(x, metric = 'gower') persons=array(dim=c(2,nrow(donor)*nrow(receiver),ncol(receiver)))

Re: [R] simple if question

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 7:05 PM, Sebastián Daza wrote: Hi everyone, I have just got different samples from a dataframe (independent and exclusive, there aren't common elements among them). I want to create a variable that indicate the sampling selection of the elements in the original

[R] Multiple plots with one legend

2011-03-26 Thread mavkoup
Hi, I've created 3 plots one under the other, and want to include a legend on the right that spans the height of all 3 plots. How can I do this? Thanks! -- View this message in context: http://r.789695.n4.nabble.com/Multiple-plots-with-one-legend-tp3408537p3408537.html Sent from the R help

Re: [R] simple if question

2011-03-26 Thread Thomas Levine
Posting some sample data would help, but I think something like this is what you want data[data$school=='Cornell University',] For example CO2[CO2$Type=='Quebec',] Tom 2011/3/26 Sebastián Daza sebastian.d...@gmail.com: Hi everyone, I have just got different samples from a dataframe

Re: [R] Multiple plots with one legend

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 7:06 PM, mavkoup wrote: Hi, I've created 3 plots one under the other, and want to include a legend on the right that spans the height of all 3 plots. ?mtext # with the `las` parameter for rotation Or you can use: text(x,y, some text, srt=-90,xpd=NA ) -- David

Re: [R] Multiple plots with one legend

2011-03-26 Thread mavkoup
Ok I think I can figure that out. Which leads me to a further question. My 3 plots contain 10 time series, each with a different name and color. Can I create the legend such that it has a line of the correct color follow by the name of the series? I.e. line(with color1) NAME 1 line(with color2)

[R] Coordinates of the text region

2011-03-26 Thread Francois Rousseu
Hello R people Is there a way to get the coordinates of the text region (coordinates of the four corners for example) when using the text function? I'm looking for a way that does not make use of interactive function like locator. My goal is to determine the position of other structures in a

Re: [R] Multiple plots with one legend

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 8:27 PM, mavkoup wrote: Ok I think I can figure that out. Which leads me to a further question. My 3 plots contain 10 time series, each with a different name and color. Can I create the legend such that it has a line of the correct color follow by the name of the

Re: [R] Coordinates of the text region

2011-03-26 Thread David Winsemius
On Mar 26, 2011, at 8:39 PM, Francois Rousseu wrote: Hello R people Is there a way to get the coordinates of the text region (coordinates of the four corners for example) What text region are you talking about? when using the text function? I'm looking for a way that does not make use

Re: [R] Coordinates of the text region

2011-03-26 Thread Francois Rousseu
Let's say I do the following: plot(0,0,type=n,xlim=c(0,10),ylim=c(0,10)) rect(4,5,5,6,border=black,col=white) text(4.5,5.5,species,cex=2) I would like to be able to determine a rectangle size that will be able to contain the text species. I'm working on a function using multiple lines and

Re: [R] Coordinates of the text region

2011-03-26 Thread jim holtman
take a look at 'textbox' in plotrix. On Sat, Mar 26, 2011 at 9:05 PM, Francois Rousseu francoisrous...@hotmail.com wrote: Let's say I do the following: plot(0,0,type=n,xlim=c(0,10),ylim=c(0,10)) rect(4,5,5,6,border=black,col=white) text(4.5,5.5,species,cex=2) I would like to be able to

Re: [R] Multiple plots with one legend

2011-03-26 Thread jim holtman
You can use 'layout' to create 4 plot areas: the 3 plot you currently have, and one for the legend. Try this to see what happens: x - cbind(rbind(1,2,3), 4) layout(x, width = c(5,1)) layout.show(4) On Sat, Mar 26, 2011 at 7:06 PM, mavkoup mavk...@hotmail.com wrote: Hi, I've created 3

Re: [R] library(foreign) read.spss warning

2011-03-26 Thread Matt Shotwell
There is some information about this subtype in the PSPP source code, and for other subtypes not yet implemented by read.spss. The PSPP source code indicates that this subtype consists of Value labels for long strings, which isn't very illuminating to me (probably because I don't use PSPP, or

Re: [R] Building a matrix so that matrix(r, c)-matrix(c, r) with No For Loops

2011-03-26 Thread Brian Pellerin
Thanks, David. This works splendidly. Thanks for your help. Sincerely, Brian David Winsemius dwinsem...@comcast.net 03/26/11 3:06 PM On Mar 26, 2011, at 9:44 AM, Brian Pellerin wrote: Hello, I would like to take advantage of the upper.tri() function here but I don't know exactly. Here

Re: [R] Coordinates of the text region

2011-03-26 Thread Greg Snow
Look at the strwidth and strheight functions. Also note the adj parameter (see ?par for details). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org