[R] possible problem with endpoints?

2011-03-17 Thread Erin Hodgess
Dear R People: Hello again! I found something unusual in the behavior of the endpoints function from the xts package: x1 - ts(1:24,start=2008,freq=12) dat - seq(as.Date(2008/01/01),length=24,by=months) library(zoo);library(xts) x2 - zoo(1:24,order=dat) #Here is the surprise:

Re: [R] plotting multiple figures on one page

2011-03-17 Thread Jim Lemon
On 03/17/2011 07:46 AM, scarlet wrote: I am new to the R language. I am trying to plot multiple figures on one page through a loop, but the code just produce one graph on one page. Can someone show some light on what's wrong? Here is my code: library(quantreg)

Re: [R] Regex query (Apache logs)

2011-03-17 Thread Allan Engelhardt
Some comments: 1. [^\s] matches everything up to a literal 's', unless perl=TRUE. 2. The (.*) is greedy, so you'll need (.*?)\s(.*?)\s(.*?)$ or similar at the end of the expression With those changes (and removing a space inserted by the newsgroup posting) the expression works for me.

[R] Flexible rbind

2011-03-17 Thread Santosh Srinivas
Dear All, I am trying to create a empty structure that I want to fill gradually through the code. I want to use something like rbind to create the basic structure first. I am looking for a possibility to do an rbind where the columns names dont match fully (but the missing columns can be

Re: [R] table() reading problem

2011-03-17 Thread Jim Lemon
On 03/16/2011 08:20 PM, fre wrote: I have the following problem: I have some string with numbers like k. I want to have a table like the function table() gives. However I am not able to call the first row, the 1, 2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem to work

Re: [R] table() reading problem

2011-03-17 Thread Jim Lemon
Sender: r-help-boun...@r-project.org On-Behalf-Of: j...@bitwrit.com.au Subject: Re: [R] table() reading problem Message-Id: 4d81c14a.2000...@bitwrit.com.au Recipient: killian.door...@barclayscapital.com ___ e at 1 Churchill Place, London, E14 5HP.

[R] Flexible rbind

2011-03-17 Thread Santosh Srinivas
Sender: r-help-boun...@r-project.org On-Behalf-Of: santosh.srini...@gmail.com Subject: [R] Flexible rbind Message-Id: aanlktimneofi+ndx+xmvhr3uw3ppygkvtgkvbmzva...@mail.gmail.com Recipient: simon.r...@barclayscapital.com ___ e at 1 Churchill Place,

[R] Flexible rbind

2011-03-17 Thread Santosh Srinivas
Sender: r-help-boun...@r-project.org On-Behalf-Of: santosh.srini...@gmail.com Subject: [R] Flexible rbind Message-Id: aanlktimneofi+ndx+xmvhr3uw3ppygkvtgkvbmzva...@mail.gmail.com Recipient: killian.door...@barclayscapital.com ___ e at 1 Churchill

Re: [R] Subset using grepl

2011-03-17 Thread Kang Min
Ok thank you! On Mar 17, 12:12 pm, bill.venab...@csiro.au wrote: subset(data,grepl([1-5], section) !grepl(0, section)) BTW grepl([1:5], section) does work.  It checks for the characters 1, :, or 5.   -Original Message- From: r-help-boun...@r-project.org

Re: [R] NaNs in Nested Mixed Model

2011-03-17 Thread Johan Stenberg
Thank you Thierry for your kind answer! If you don't mind I would like to ask a follow-up question. In your suggestions I get P-values for Species. However, I am really not interested in that factor per se. Would it make sense to use this model instead if I am only interested in Genotype?

Re: [R] Specify feature weights in model prediction (CARET)

2011-03-17 Thread Kendric Wang
It was a general question to find out if the caret framework supported passing feature weights to any predictive model. But I guess, it may only make sense in the context of the model. The ones I am interested in would be svm and knn. Thanks, Kendric On Wed, Mar 16, 2011 at 6:20 PM, Max Kuhn

Re: [R] flow map lines between point pairs (latitude/longitude)

2011-03-17 Thread vioravis
I am working on a similar problem. I have to add two columns: one containing the US state to which the origin belongs and another one to add the state in to which destination belongs. All I have is the latitude and the longitude of the origin and destination. Are there any packages in R that can

Re: [R] fetch uneven

2011-03-17 Thread rens
Thanks ! You all made my day ! -- View this message in context: http://r.789695.n4.nabble.com/fetch-uneven-tp3381949p3383956.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] R² for non-linear model

2011-03-17 Thread Rubén Roa
Hi Alexx, I don't see any problem in comparing models based on different distributions for the same data using the AIC, as long as they have a different number of parameters and all the constants are included. For example, you can compare distribution mixture models with different number of

Re: [R] rJava software

2011-03-17 Thread Bio7
Hello, it seems that rJava tries to detect the path to the Java Virtual Maschine from a registry key which is not installed. I gues that the HLM means HKEY_LOCAL_MASCHINE where you find normally the path to your installed Java. On my Windows System i have for example the path

Re: [R] adding linear regression data to plot

2011-03-17 Thread Jim Lemon
On 03/17/2011 02:47 AM, derek wrote: I know I can add line to graph with abline(), but I would like to print R-squared, F-test value, Residuals and other statistics from lm() to a graph. I don't know how to access the values from summary(), so that I can use them in a following code or print

Re: [R] Why doesn't this work ?

2011-03-17 Thread Iain Gallagher
The first line of this reply is a definite candidate for the fortunes package! best i --- On Thu, 17/3/11, bill.venab...@csiro.au bill.venab...@csiro.au wrote: From: bill.venab...@csiro.au bill.venab...@csiro.au Subject: Re: [R] Why doesn't this work ? To: ericst...@aol.com,

[R] calculating the occurrences of distinct observations in the subsets of a dataframe

2011-03-17 Thread Bodnar Laszlo EB_HU
Hello everybody, I have a data frame in R which is similar to the follows. Actually my real 'df' dataframe is much bigger than this one here but I really do not want to confuse anybody so that is why I try to simplify things as much as possible. So here's the data frame. id

Re: [R] Why doesn't this work ?

2011-03-17 Thread Ted Harding
And, just to make it really clear (I hope!): Your original expression z -ifelse(t==1 || 2 || 3, 1,0) looks like a transcription into R of the words If t equals 1 or 2 or 3 then z is 1 else z is 0 However, your t==1 || 2 || 3 has to be parsed in the correct order according to operator

Re: [R] create data set from selection of rows

2011-03-17 Thread e-letter
On 15/03/2011, Francisco Gochez fjgoc...@googlemail.com wrote: Hi, What you are after is: datasubset - dataset[ dataset[,3] == text3, ] Thank you. For the set text1,23,text2,45 text1,23,text3,78 text1,23,text3,56 text1,23,text2,45 Is it possible to write a function that selects rows

[R] Retrieve an index of nested lists | Changing name delimiter in 'unlist()'

2011-03-17 Thread Janko Thyson
Dear list, I have to problems that are connected: PROBLEM 1 I wonder if it is somehow possible to patch the function 'unlist(use.names=TRUE)' such that you can specify an arbitrary name delimiter, e.g. / or _. As I often name my variables var.x.y, the default delimiter makes it hard to

Re: [R] calculating the occurrences of distinct observations in the subsets of a dataframe

2011-03-17 Thread Tóth Dénes
Hi! Sorry, I made an error in the previous e-mail. So try this: by(df[,-1],df$id,function(x) apply(x,2,tabulate)) This gives you a list. You can rearrange it into a data frame or a 3d array if you wish. Regards, Denes Hello everybody, I have a data frame in R which is similar to the

[R] changing the dimensions of a matrix in a real specific way

2011-03-17 Thread Bodnar Laszlo EB_HU
Hi again, I'd like to ask you a question again. I have a matrix like this: a -matrix(c(1,2,3,4,5,6,7,8,9,10,11,12)) a [,1] [1,]1 [2,]2 [3,]3 [4,]4 [5,]5 [6,]6 [7,]7 [8,]8 [9,]9 [10,] 10 [11,] 11 [12,] 12 Is there a proper way to change

Re: [R] create data set from selection of rows

2011-03-17 Thread jim holtman
Is this what you want: x V1 V2V3 V4 1 text1 23 text2 45 2 text1 23 text3 78 3 text1 23 text3 56 4 text1 23 text2 45 str(x) 'data.frame': 4 obs. of 4 variables: $ V1: Factor w/ 1 level text1: 1 1 1 1 $ V2: int 23 23 23 23 $ V3: Factor w/ 2 levels text2,text3: 1 2 2 1 $ V4: int

Re: [R] create data set from selection of rows

2011-03-17 Thread Dennis Murphy
Using the summarise function in package plyr is one way; taking df to be your data frame with variable names V1-V4, library(plyr) summarise(subset(df, V3 == 'text3'), sum = sum(V4)) sum 1 134 Another is to use the data.table package: library(data.table) dt - data.table(df) dt[V3 == 'text3',

[R] Extracting columns from a class

2011-03-17 Thread nuncio m
Hi list, I am not a frequent user of R. Recently I used R in principal component analysis and got the result as a class, which has information like standard deviation and principal components from 1 to 10. How is it possible to extract the column corresponding to first principal

[R] assigning to list element within target environment

2011-03-17 Thread Richard D. Morey
I would like to assign an value to an element of a list contained in an environment. The list will contain vectors and matrices. Here's a simple example: # create toy environment testEnv = new.env(parent = emptyenv()) # create list that will be in the environment, then assign() it x =

Re: [R] changing the dimensions of a matrix in a real specific way

2011-03-17 Thread Tóth Dénes
t(matrix(a,3,4)) for more complex arrays, see ?aperm Hi again, I'd like to ask you a question again. I have a matrix like this: a -matrix(c(1,2,3,4,5,6,7,8,9,10,11,12)) a [,1] [1,]1 [2,]2 [3,]3 [4,]4 [5,]5 [6,]6 [7,]7 [8,]8 [9,]

Re: [R] Flexible rbind

2011-03-17 Thread sayan dasgupta
Hi Santosh, May be you looking at something like this merge(d,dNewTests,by=type,all=TRUE) On Thu, Mar 17, 2011 at 1:03 PM, Santosh Srinivas santosh.srini...@gmail.com wrote: Dear All, I am trying to create a empty structure that I want to fill gradually through the code. I want to use

Re: [R] assigning to list element within target environment

2011-03-17 Thread Hadley Wickham
On Thu, Mar 17, 2011 at 7:25 AM, Richard D. Morey r.d.mo...@rug.nl wrote: I would like to assign an value to an element of a list contained in an environment. The list will contain vectors and matrices. Here's a simple example: # create toy environment testEnv = new.env(parent = emptyenv())

Re: [R] Why doesn't this work ?

2011-03-17 Thread Barry Rowlingson
On Thu, Mar 17, 2011 at 3:54 AM, bill.venab...@csiro.au wrote: It doesn't work (in R) because it is not written in R.  It's written in some other language that looks a bit like R. It parses in R, so I would say it was written in R. To paraphrase Obi-wan, it's just not the R you are looking

Re: [R] changing the dimensions of a matrix in a real specific way

2011-03-17 Thread Sarah Goslee
matrix(a, ncol=3, nrow=4, byrow=TRUE) or dim(a) - c(3,4) a - t(a) a [,1] [,2] [,3] [1,]123 [2,]456 [3,]789 [4,] 10 11 12 Depending on the context of the problem. Sarah On Thu, Mar 17, 2011 at 7:59 AM, Bodnar Laszlo EB_HU

[R] Incorrect degrees of freedom in SEM model using lavaan

2011-03-17 Thread Andrew Miles
I have been trying to use lavaan (version 0.4-7) for a simple path model, but the program seems to be computing far less degrees of freedom for my model then it should have. I have 7 variables, which should give (7)(8)/2 = 28 covariances, and hence 28 DF. The model seems to only think I have 13

Re: [R] Autocorrelation in linear models

2011-03-17 Thread Ben Bolker
Arni Magnusson arnima at hafro.is writes: I have been reading about autocorrelation in linear models over the last couple of days, and I have to say the more I read, the more confused I get. Beyond confusion lies enlightenment, so I'm tempted to ask R-Help for guidance. Most authors

Re: [R] Bug in lattice auto.key argument

2011-03-17 Thread Deepayan Sarkar
On Wed, Mar 16, 2011 at 12:52 AM, jlu...@ria.buffalo.edu wrote: The Lattice auto.key argument has a bug in R.12.2. R version 2.12.2 (2011-02-25) Platform: i386-pc-mingw32/i386 (32-bit) other attached packages: [1] lattice_0.19-17 loaded via a namespace (and not attached): [1]

[R] setting up a R working group

2011-03-17 Thread Joanne Demmler
Dear R users, we are currently trying to set up a R working group at Swansea University. I would be very grateful to get some information and feedback from R users that have done something similar, in particular regarding: - help with giving a general overview of what R is capable of - help

[R] Using barplot() with zoo -- names.arg not permitted?

2011-03-17 Thread David Wolfskill
I've used barplot(), including the anmes.arg parameter, on data frames successfully, but I'm even newer to using zoo than I am to R. :-} I am working on a functon that accepts a data frame (df) as its primary argument, extracts information from it to create a zoo, then generates a plot based on

Re: [R] Help- Fitting a Thin Plate Spline

2011-03-17 Thread Simon Wood
library(mgcv) b - gam(arcsine.success ~ s(date.num,clutch.size,k=50)) vis.gam(b,theta=30) will fit a thin plate spline and plot it. k is an upper limit on the number of degrees of freedom for the TPS, but the actual degrees of freedom are chosen automatically (use the 'method' argument of gam

Re: [R] How to make sure R's g++ compiler uses certain C++ flags when making a package

2011-03-17 Thread Mike Marchywka
Date: Wed, 16 Mar 2011 13:50:37 -0700 From: solomon.mess...@gmail.com To: r-help@r-project.org Subject: Re: [R] How to make sure R's g++ compiler uses certain C++ flags when making a package Looks like the problem may be that R is automatically

Re: [R] lmm WITHOUT random factor (lme4)

2011-03-17 Thread Mark Difford
On Mar 17, 2011; 11:43am Baugh wrote: Question: can I simply substitute a dummy var (e.g. populated by zeros) for ID to run the model without the random factor? when I try this R returns values that seem reasonable, but I want to be sure this is appropriate. If you can fit the model using

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Exuse me, I don't claim R^2 can't be negative. What I say if I get R^2 negative then the data are useless. I know, that what Thomas said is true in general case. But in my special case of data, using nonzero intercept is nonsense, and to get R^2 less than 0.985 is considered poor job (standard

[R] lmm WITHOUT random factor (lme4)

2011-03-17 Thread Baugh
LMM without Random effect: I want to run an LMM both with and without the random factor (ID). And then extract the log-lik values from the two models in order to generate a p-value. with random factor as:lmer(y~x+(1|ID),data) Question: can I simply substitute a dummy var (e.g. populated by

Re: [R] Strange R squared, possible error

2011-03-17 Thread Hadley Wickham
2) I don't want to fit data with linear model of zero intercept. 3) I dont know if I understand correctly. Im 100% sure the model for my data should have zero intercept. The only coordinate which Im 100% sure is correct. If I had measured quality Y of a same sample X0 number of times I would

Re: [R] cv.lm syntax error

2011-03-17 Thread agent dunham
I rewrite my previous comand, CVlm works now. It was related to having the same names in the df than in the formula included at CVlm . Now I'd like to know if the seed is of any special importance, or I can type just seed=29 like in the example. Thanks in advance, u...@host.com -- View this

[R] Segmentation fault when using plot function

2011-03-17 Thread cchace
I frequently get a segmentation fault error when using the plot command. It happens about half the time. We are running an old version of R (R version 2.8.0 (2008-10-20) on Linux. I did a quick search for this problem and didn't find anything. Apologies if I missed it. *** Process received

Re: [R] setting up a R working group

2011-03-17 Thread Rainer M Krug
On Thu, Mar 17, 2011 at 2:42 PM, Joanne Demmler j.demm...@swansea.ac.uk wrote: Dear R users, Hi we are currently trying to set up a R working group at Swansea University. I would be very grateful to get some information and feedback from R users that have done something similar, in

Re: [R] Using barplot() with zoo -- names.arg not permitted?

2011-03-17 Thread Gabor Grothendieck
On Thu, Mar 17, 2011 at 9:38 AM, David Wolfskill da...@catwhisker.org wrote: I've used barplot(), including the anmes.arg parameter, on data frames successfully, but I'm even newer to using zoo than I am to R.  :-} I am working on a functon that accepts a data frame (df) as its primary

Re: [R] lmm WITHOUT random factor (lme4)

2011-03-17 Thread ONKELINX, Thierry
Dear Mark, You cannot compare lm() with lme() because the likelihoods are not the same. Use gls() instead of lm() library(nlme) data(sleepstudy, package = lme4) fm - lm(Reaction ~ Days, sleepstudy) fm0 - gls(Reaction ~ Days, sleepstudy) logLik(fm) logLik(fm0) fm1 - lme(Reaction ~ Days, random=

Re: [R] Strange R squared, possible error

2011-03-17 Thread Peter Ehlers
On 2011-03-17 02:08, derek wrote: Exuse me, I don't claim R^2 can't be negative. What I say if I get R^2 negative then the data are useless. I know, that what Thomas said is true in general case. But in my special case of data, using nonzero intercept is nonsense, and to get R^2 less than 0.985

Re: [R] Segmentation fault when using plot function

2011-03-17 Thread Henrik Bengtsson
On Thu, Mar 17, 2011 at 6:58 AM, cchace cch...@wellington.com wrote: I frequently get a segmentation fault error when using the plot command. It happens about half the time. We are running an old version of R (R version 2.8.0 (2008-10-20) on Linux. I did a quick search for this problem and

Re: [R] possible problem with endpoints?

2011-03-17 Thread Joshua Ulrich
Hi Erin, On Thu, Mar 17, 2011 at 1:27 AM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: Hello again! I found something unusual in the behavior of the endpoints function from the xts package: x1 - ts(1:24,start=2008,freq=12) dat - seq(as.Date(2008/01/01),length=24,by=months)

Re: [R] R² for non-linear model

2011-03-17 Thread Kjetil Halvorsen
see inline. On Thu, Mar 17, 2011 at 4:58 AM, Rubén Roa r...@azti.es wrote: Hi Alexx, I don't see any problem in comparing models based on different distributions for the same data using the AIC, as long as they have a different number of parameters and all the constants are included. For

Re: [R] Incorrect degrees of freedom in SEM model using lavaan

2011-03-17 Thread Gustavo Carvalho
Your model is saturated. I think lavaan calculates the number of degrees of freedom this way: DF = n*(n + 1)/2 - t - n.fix*(n.fix + 1)/2 n = number of variables t = number of free parameters n.fix = number of fixed exogenous variables So, if you fix the exogenous variables, as in mimic =

Re: [R] Incorrect degrees of freedom in SEM model using lavaan

2011-03-17 Thread Mike Cheung
Dear Andrew, The reported df in lavaan is 0 which is correct. It is because this path model is saturated. 28 is not the df, it is the no. of pieces of information. The no. of parameter estimates is also 28. Thus, the df is 0. However, you are correct that there are only 13, not 28, free

Re: [R] setting up a R working group

2011-03-17 Thread Spencer Graves
1. There is a CRAN mirror at Bristol (roughly 100km from Swansea?). They must have (or have had) some very active R users there. 2. Sundar Dorai-Raj and I developed a local R Archive Network and subversion repository internal to a company where we used to work. I believe

Re: [R] Need to abstract changing name of column within loop

2011-03-17 Thread Joshua Ulrich
On Wed, Mar 16, 2011 at 6:58 PM, jctoll jct...@gmail.com wrote: Hi, I'm struggling to figure out the way to change the name of a column from within a loop.  The problem is I can't refer to the object by its actual variable name, since that will change each time through the loop.  My xts

Re: [R] Strange R squared, possible error

2011-03-17 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 3:49 PM, derek jan.kac...@gmail.com wrote: k=lm(y~x) summary(k) returns R^2=0.9994 lm(y~x) is supposed to find coef. a anb b in y=a*x+b l=lm(y~x+0) summary(l) returns R^2=0.9998 lm(y~x+0) is supposed to find coef. a in y=a*x+b while setting b=0 The question is

Re: [R] calculating AUCs for each of the 1000 boot strap samples

2011-03-17 Thread Brian Diggs
Taby, First, it is better to reply to the whole list (which I have included on this reply); there is a better chance of someone helping you. Just because I could help with one aspect does not mean I necessarily can (or have the time to) help with more. Further comments are inline below.

Re: [R] Regex query (Apache logs)

2011-03-17 Thread Saptarshi Guha
Hello Allan, Thanks the response. Provides me hope. I appreciate [3], might even go with that. And for posterity, here's the code (assuming pastebin never expires) [1] Test string : http://pastebin.com/FyAFzmTv [2] Pattern (modified as per your suggestion) : http://pastebin.com/s7VT0r5K pattern

[R] Spatial cluster analysis of continous outcome variable

2011-03-17 Thread Jon Toledo
Dear R Users, R Core Team, I have a two dimensional space where I measure a numerical value in two situations at different points. I have measured the change and I would like to test if there are areas in this 2D-space where there is a different amount of change (no change, increase,

Re: [R] Segmentation fault when using plot function

2011-03-17 Thread Prof Brian Ripley
On Thu, 17 Mar 2011, Henrik Bengtsson wrote: On Thu, Mar 17, 2011 at 6:58 AM, cchace cch...@wellington.com wrote: I frequently get a segmentation fault error when using the plot command. It happens about half the time. We are running an old version of R (R version 2.8.0 (2008-10-20) on

Re: [R] cv.lm syntax error

2011-03-17 Thread agent dunham
I rewrite my previous comand, CVlm works now. It was related to having the same names in the df than in the formula included at CVlm . Now I'd like to know: Q1: if the seed is of any special importance, or I can type just seed=29 like in the example? Q2: I typed: CVlm(df = mydf, form.lm =

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Thank you for your very comprehensible answer. I a priori know that model y=a*x+0 is right and that I can't get x=constant nor y=constant. I'm comparing performance of data gathering in my data set to another data sets in which performance gathering is characterized by R-squared . The data in

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Yes they are. I had edited the reply, but It didn't help. Correction: 2)I meant zero slope, no zero intercept. -- View this message in context: http://r.789695.n4.nabble.com/Strange-R-squared-possible-error-tp3382818p3384648.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] lmm WITHOUT random factor (lme4)

2011-03-17 Thread Mark Difford
On Mar 17, 2011; 04:29pm Thierry Onkelinx wrote: You cannot compare lm() with lme() because the likelihoods are not the same. Use gls() instead of lm() Hi Thierry, Of course, I stand subject to correction, but unless something dramatic has changed, you can. gls() can be used if you need to

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Thats exactly what I would like to do. Any idea on good text? I've consulted severel texts, but no one defined R^2 as R^2 = 1 - Sum(R[i]^2) / Sum((y[i])^2-y*)) still less why to use different formulas for similar model or why should be R^2 closer to 1 when y=a*x+0 than in general model y=a*x+b.

[R] Beginner question: How to replace part of a filename in read.csv?

2011-03-17 Thread pierz
different combinations with and () around samp, but I keep getting the error object 'samp.csv' not found. samp - 20110317 read.csv(file=samp.csv,...) #next R processes some code that works fine, and then should save the figure: pdf(file=samp.pdf,...) dev.off() How can I get R to replace samp as 20110317

Re: [R] lmm WITHOUT random factor (lme4)

2011-03-17 Thread Mark Difford
On Mar 17, 2011; 04:29pm Thierry Onkelinx wrote: You cannot compare lm() with lme() because the likelihoods are not the same. Use gls() instead of lm() And perhaps I should have added the following: First para on page 155 of Pinheiro Bates (2000) states, The anova method can be used to

[R] Gelman-Rubin convergence diagnostics via coda package

2011-03-17 Thread fbielejec
Dear, I'm trying to run diagnostics on MCMC analysis (fitting a log-linear model to rates data). I'm getting an error message when trying Gelman-Rubin shrink factor plot: gelman.plot(out) Error in chol.default(W) : the leading minor of order 2 is not positive definite I take it that

[R] generalized mixed linear models, glmmPQL and GLMER give very different results that both do not fit the data well...

2011-03-17 Thread Franssens, Samuel
Hi, I have the following type of data: 86 subjects in three independent groups (high power vs low power vs control). Each subject solves 8 reasoning problems of two kinds: conflict problems and noconflict problems. I measure accuracy in solving the reasoning problems. To summarize: binary

Re: [R] Beginner question: How to replace part of a filename in read.csv?

2011-03-17 Thread Sarah Goslee
like to be able to type in the date (later perhaps automate this using list.files) and then read the csv and write the pdf automatically. I have tried different combinations with and () around samp, but I keep getting the error object 'samp.csv' not found. samp - 20110317 read.csv(file

Re: [R] generalized mixed linear models, glmmPQL and GLMER give very different results that both do not fit the data well...

2011-03-17 Thread Bert Gunter
I suggest that you post this on the R-sig-mixed-models list where you are more likely to find those with bothe interest and expertise in these matters. -- Bert On Thu, Mar 17, 2011 at 7:44 AM, Franssens, Samuel samuel.franss...@econ.kuleuven.be wrote: Hi, I have the following type of data: 86

Re: [R] Beginner question: How to replace part of a filename in read.csv?

2011-03-17 Thread Scott Chamberlain
paste(samp, .pdf, sep=) [1] 20110317.pdf paste(samp, .csv, sep=) [1] 20110317.csv On Thursday, March 17, 2011 at 10:05 AM, pierz wrote: I would like to use samp as a part of a filename that I can change. My source files are .csv files with date as the file name, and I would like to be able

Re: [R] plotting multiple figures on one page

2011-03-17 Thread scarlet
Jim, Thanks for looking into this. The c without paste works. If the rq model overrides the mfrow, I think I will have to piece together individual plots using other software. scarlet -- View this message in context:

Re: [R] Strange R squared, possible error

2011-03-17 Thread Greg Snow
It is all a matter of what you are comparing too, or what the null model is. For most cases (standard regression) we compare a model with slope and intercept to an intercept only model (looking at the effect of the slope), the intercept only model fits a horizontal line through the mean of the

[R] fitting gamm with interaction term

2011-03-17 Thread Irene Mantzouni
Hi all, I would like to fit a gamm model of the form: Y~X+X*f(z) Where f is the smooth function and With random effects on X and on the intercept. So, I try to write it like this: gam.lme- gamm(Y~ s(z, by=X) +X, random=list(groups=pdDiag(~1+X)) ) but I get the error

Re: [R] plotting multiple figures on one page

2011-03-17 Thread Muhammad Rahiz
Scarlet, If the mfrow is being overridden, perhaps the rimage package might be able to piece the individual plots... -- Muhammad Rahiz Researcher DPhil Candidate (Climate Systems Policy) School of Geography the Environment University of Oxford On Thu, 17 Mar 2011, scarlet wrote: Jim,

Re: [R] fitting gamm with interaction term

2011-03-17 Thread Simon Wood
Is X a numeric variable or a factor? If it's numeric try gam.lme- gamm(Y~ s(z, by=X), random=list(groups=pdDiag(~1+X)) ) ... since otherwise the separate X term is confounded with s(z, by=X). (gam detects such confounding and copes with it, but gamm can't). Simon On 17/03/11 17:47,

Re: [R] Counting

2011-03-17 Thread Jim Silverton
I have a matrix say: 23 1 12 12 00 0 1 0 1 0 2 23 2 I want to count of number of distinct rows and the number of disinct element in the second column and put these counts in a column. SO at the end of the day I should have: c(1, 1, 1, 2, 2, 1, 1) for the distinct rows and c(1, 1,

Re: [R] Spatial cluster analysis of continous outcome variable

2011-03-17 Thread Mike Marchywka
Did you post your data or hypothetical data? Usually that helps make your problem more clear and more interesting ( likely to get a useful response to your post). From: tintin...@hotmail.com To: r-help@r-project.org Date: Thu, 17 Mar 2011 17:38:14

Re: [R] Counting

2011-03-17 Thread K. Elo
Dear Jim, 17.03.2011 20:54, Jim Silverton wrote: I have a matrix say: 23 1 12 12 00 0 1 0 1 0 2 23 2 I want to count of number of distinct rows and the number of disinct element in the second column and put these counts in a column. SO at the end of the day I should have: c(1,

[R] ggplot, transformation, and ylim

2011-03-17 Thread godwin yung
Hey everyone, I'm having a little trouble with ggplot. I have two sets of y-values, one whose range is contained in the other. Due to the nature of the y-values, I wish to scale the y axis with a log base two transformation. Furthermore, I wish to plot the two sets of y-values as boxplots in

Re: [R] ggplot, transformation, and ylim

2011-03-17 Thread godwin yung
Hey everyone, Nevermind, I figured it out: ggplot(data, aes(x1, y1))+geom_boxplot()+scale_y_log2(lim=c(...)) :) Cheers, Godwin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] R² for non-linear model

2011-03-17 Thread Alexander Engelhardt
Hi, thank you for your elaborate answer. I downloaded Prof. Dayton's pdf and will read it tomorrow. A friend also told me that our professor said you can actually compare AICs for different distributions. Apparently it's not correct strictly speaking, because of the two different

[R] fitting gamm with interaction term

2011-03-17 Thread Irene Mantzouni
Hi all, I would like to fit a gamm model of the form: Y~X+X*f(z) Where f is the smooth function and With random effects on X and on the intercept. So, I try to write it like this: gam.lme- gamm(Y~ s(z, by=X) +X, random=list(groups=pdDiag(~1+X)) ) but I get the error

Re: [R] Counting

2011-03-17 Thread Petr Savicky
On Thu, Mar 17, 2011 at 02:54:49PM -0400, Jim Silverton wrote: I have a matrix say: 23 1 12 12 00 0 1 0 1 0 2 23 2 I want to count of number of distinct rows and the number of disinct element in the second column and put these counts in a column. SO at the end of the

[R] Scope and apply-type functions

2011-03-17 Thread jamie.f.olson
So, I've been confused by this for a while. If I want to create functions in an apply, it only uses the desired value for the variable if I create a new local variable: lapply(1:5,function(h){k=h;function(){k}})[[1]]() [1] 1 lapply(1:5,function(k){function(){k}})[[1]]() [1] 5 Normally, a

Re: [R] Scope and apply-type functions

2011-03-17 Thread baptiste auguie
Hi, I think it's a side effect of lazy evaluation, where you should probably use the ?force like a jedi, lapply(1:5,function(k){force(k) ; function(){k}})[[2]]() HTH, baptiste On 18 March 2011 07:01, jamie.f.olson inspired2apa...@gmail.com wrote: So, I've been confused by this for a while.  

Re: [R] Numeric vector converted mysteriously to characters in data frame?

2011-03-17 Thread Martin Ralphs
Thanks Jim, It turns out that the problem was that all columns had been converted to factors.  Once I converted them back to numeric variables the code worked fine.  If anybody is wondering how, you can do this with the following: mynumber - as.numeric(levels(myfactor))[myfactor] There are

Re: [R] Scope and apply-type functions

2011-03-17 Thread Bert Gunter
Try this: lapply(1:5,function(i){i;function()i})[[2]]() or lapply(1:5,function(i){i;function(j=i) j } )[[2]]() ## both give 2 Now try: lapply(1:5,function(i){function(j=i) j } )[[2]]() ## gives 5 ! The problem is that if you do: lapply(1:5,function(h){function(h)h) what you get is a

Re: [R] Need to abstract changing name of column within loop

2011-03-17 Thread jctoll
On Thu, Mar 17, 2011 at 10:32 AM, Joshua Ulrich josh.m.ulr...@gmail.com wrote: On Wed, Mar 16, 2011 at 6:58 PM, jctoll jct...@gmail.com wrote: Hi, I'm struggling to figure out the way to change the name of a column from within a loop.  The problem is I can't refer to the object by its actual

Re: [R] Spatial cluster analysis of continous outcome variable

2011-03-17 Thread Jon Toledo
I attach the data (csv format). There are the 3 coordinates, (but as there are not so many points I wanted two do 3 analysis in each of them collapsing one variable).There are two variables to study I have posted the data as a ratio between both states and as a percentage state between both

Re: [R] Using barplot() with zoo -- names.arg not permitted?

2011-03-17 Thread David Wolfskill
On Thu, Mar 17, 2011 at 10:23:33AM -0400, Gabor Grothendieck wrote: On Thu, Mar 17, 2011 at 9:38 AM, David Wolfskill r...@catwhisker.org wrote: ... But the X-axis labels show up as large integers -- the POSIXct values are apparently treated as numeric quantities for this purpose. ...

[R] A question about list

2011-03-17 Thread ufuk beyaztas
Hi dear all, It may be a simple question, i have a list output with different number of elements as following; [[1]] [1] 0.86801402 -0.82974691 0.3974 -0.98566707 -4.96576856 -1.32056754 [7] -5.54093319 -0.07600462 -1.34457280 -1.04080125 1.62843297 -0.20473912 [13] 0.30659907

[R] Autocorrelation in non-linear regression model

2011-03-17 Thread pruro
Hey all! I am working on my master thesis and I am desperate with my model. It looks as following: Y(t) = β1*X1(t) + β2*X2(t) + δ*(β1*((1+c)/(δ+c))+β2)*IE(t) - β2*α*((1+c)/(δ+c))*(δ+g)* IE(t-1) note: c and g is a constant value The problem I encounter is that between IE(t) and IE(t-1) there

[R] Histograms with strings,

2011-03-17 Thread Khanvilkar, Shashank
Hello, Thanks in advance for any help, I have read a CSV file in which there is a column for an IP addr as in: tmpInFile$V2 [1] 74.125.224.38 74.125.224.38 129.46.71.19 129.46.71.19 [5] 129.46.71.19 129.46.71.19 129.46.71.19 129.46.71.19 [9] 129.46.71.19 129.46.71.19 129.46.71.19

[R] Help with plotting a line that is multicoloured based on levels of a factor

2011-03-17 Thread Pamela Allen
Hi All, I'm trying to plot data that is a time series of flows that are associated with a specific level, and I would like each level to represent a colour in a line plot. Here is some data that approximates what I'm using: date=c(1:300) flow=sin(2*pi/53*c(1:300))

[R] Help with Time Series Plot‏

2011-03-17 Thread Axel Urbiz
Dear List, This is an embarrassing question, but I can seem to make this work…How do I change the font size on the xlab and on the numbers shown in the x-axis on the time series plot below. The arguments cex.lab and cex.axis do not seem to be 'passing' to the plot function. plot(ts(rnorm(100),

Re: [R] Strange R squared, possible error

2011-03-17 Thread derek
Thank you for our reply. It's a pity, that 2 variables defined by different formula have same name. If the variables had been named differently, I wouldn't have problem at all and it looks like it's done on purpose. Because I test a quality of data (performance of collecting data) not a model

Re: [R] A question about list

2011-03-17 Thread Tóth Dénes
?unlist quantile(unlist(data)) Hi dear all, It may be a simple question, i have a list output with different number of elements as following; [[1]] [1] 0.86801402 -0.82974691 0.3974 -0.98566707 -4.96576856 -1.32056754 [7] -5.54093319 -0.07600462 -1.34457280 -1.04080125

  1   2   >