Re: [R] Help with setting the y-axis in a plot.

2011-03-17 Thread Joshua Wiley
Hi Caitlin, You just need to set the ylim argument to plot (you already did but g_range is 0, 13 not 0, 15. So... On Thu, Mar 17, 2011 at 10:49 PM, Caitlin wrote: > Hi all. > > I'm working on an assignment for a psychology class and I am not sure how to > adjust the y-axis so it displays the ra

[R] Help with setting the y-axis in a plot.

2011-03-17 Thread Caitlin
Hi all. I'm working on an assignment for a psychology class and I am not sure how to adjust the y-axis so it displays the range: 0, 5, 10, 15 The code below is almost ideal: lsd = c(3, 5, 13) mar = c(1, 2, 3) g_range <- range(0, lsd, mar) plot(lsd, type="o", col="blue", ylim=g_range, axes=FALSE,

[R] OT: Trends in statistical computing?

2011-03-17 Thread Joshua Wiley
Dear List, First off, this is completely off topic, but I thought others might find it interesting. The good people at IBM are apparently providing written interpretations of results now. I was working with a student the other day with simple nonparametric tests using SPSS, and under the nonpara

[R] confirmatory factor analysis program in R

2011-03-17 Thread rvohen
Does someone have confirmatory factor analysis program in R,which includes factor loading and some tests?thank you! -- View this message in context: http://r.789695.n4.nabble.com/confirmatory-factor-analysis-program-in-R-tp3386133p3386133.html Sent from the R help mailing list archive at Nabble.

[R] help please: put output into dataframe

2011-03-17 Thread Ram H. Sharma
Dear R community members I have been struggling on this simple question, but never get appropriate solution. So please help. # my data, though I have a large number of variables var1 <- rnorm(500, 10,4) var2 <- rnorm(500, 20, 8) var3 <- rnorm(500, 30, 18) var4 <- rnorm(500, 40, 20) datafr1 <- da

[R] Replace split with regex for speed ?

2011-03-17 Thread rivercode
Have timestamp in format HH:MM:SS.MMM.UUU and need to remove the last "." so it is in format HH:MM:SS.MMMUUU. What is the fastest way to do this, since it has to be repeated on millions of rows. Should I use regex ? Currently doing it with a string split, which is slow: >head(ts) [1] 09:30:00

Re: [R] Histograms with strings,

2011-03-17 Thread Khanvilkar, Shashank
Thanks > which.max(table(x)) 129.46.71.19 10 How do I get only "129.46.71.19" back as a str... -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: Thursday, March 17, 2011 4:39 PM To: Khanvilkar, Shashank Cc: r-help Subject: Re: [R] Histograms with strings,

[R] trouble in call of "texteval"

2011-03-17 Thread André Camargo
  Hi all. I'm having a little trouble with the  function "texteval" (session package). I have used "texteval" in the construction of the function "ExpandData1". "ExpandData1" does not work as expected. However, when I run only the inside code of "ExpandData1" I get the right result. Apparently "te

[R] quantmod Some Single Letter Tickers Not getFin

2011-03-17 Thread Sparks, John James
Hi, I have been learning the quantmod package over the last several days. I went to check some of my data pulls against other sources and was surprised to find that a few tickers that have single characters do not successfully scrape from Google Finance using getFin(). Particularly require(quan

[R] pattern of panel waves using R

2011-03-17 Thread Sebastián Daza
Hi everyone, Is there any command to identify the pattern of responses of a database with this format: year id 20081 20091 20082 20092 20083 20093 20084 20094 20104 I just need the frequency of the patterns grouped by id: 2008 2009 2010 = 80 2009

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

2011-03-17 Thread Jon Toledo
I read it but it said PDF file and Ps, didn´t specify which other files, so I attached a csv file, which I thought would work.I have uploaded the file in rapidhare (second option was putting on the web):http://rapidshare.com/files/453101614/Coordinates_and_values.csv Hope this works.Thanks for

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

2011-03-17 Thread David Winsemius
On Mar 17, 2011, at 6:33 PM, Pamela Allen wrote: 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)

Re: [R] Histograms with strings,

2011-03-17 Thread David Winsemius
On Mar 17, 2011, at 6:06 PM, Khanvilkar, Shashank wrote: 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

Re: [R] A question about list

2011-03-17 Thread David Winsemius
On Mar 17, 2011, at 5:44 PM, ufuk beyaztas wrote: 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.04

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

2011-03-17 Thread Frank Harrell
Taby, At the end of your note are you referring to the bootstrap confidence intervals in the "external validation" case, i.e., not corrrected for overfitting? If so you can get that without the bootstrap (e.g., Hmisc package rcorr.cens function). You can get bootstrap overfitting-corrected ROC a

Re: [R] Histograms with strings,

2011-03-17 Thread jim holtman
names(which.max(table(x))) This is a 'named' vector On Thu, Mar 17, 2011 at 8:58 PM, Khanvilkar, Shashank wrote: > Thanks > >> which.max(table(x)) > 129.46.71.19 >          10 > > How do I get only "129.46.71.19" back as a str... > > > -Original Message- > From: jim holtman [mailto:jholt

Re: [R] R² for non-linear model + comparing linear + non-linear models

2011-03-17 Thread David Winsemius
This mostly seemed like a condensation of what had been said before ... threads from the past which were readily available through searching. http://finzi.psych.upenn.edu/R/Rhelp02/archive/20370.html http://finzi.psych.upenn.edu/R/Rhelp02/archive/73750.html http://finzi.psych.upenn.edu/R/Rhe

Re: [R] Help with Time Series Plot‏

2011-03-17 Thread Peter Ehlers
On 2011-03-17 16:37, Axel Urbiz wrote: 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

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

2011-03-17 Thread Tóth Dénes
Indeed, I forgot about the segments function. with(d,plot(date,flow,type="n")) with(d,segments(start,start.y,end,end.y,col=colour)) > Hi, > > because each colour is defined on non-consecutive points, you'll > probably need to cut the intervals to define segments around each > point. One approa

Re: [R] Help with Time Series Plot‏

2011-03-17 Thread Dennis Murphy
Hi: Try this: plot(ts(rnorm(100), start = 2004, freq = 12), xaxt = 'n', yaxt = 'n', xlab = '', ylab = '') axis(1, at = c(2004:2012), cex.axis = 0.7) axis(2, cex.axis = 0.7) title(xlab = 'My X lab', ylab = 'RQI', cex.lab = 0.1) The illegible dots in the region where the axis labels would nor

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

2011-03-17 Thread baptiste auguie
Hi, because each colour is defined on non-consecutive points, you'll probably need to cut the intervals to define segments around each point. One approach might be the following, d = transform(data, start = date - c(0, diff(date)/2), end = date + c(0, diff(date)/2) ) d$start.y = approx(d$date, d

Re: [R] Strange R squared, possible error

2011-03-17 Thread Berwin A Turlach
G'day Gabor, On Thu, 17 Mar 2011 20:38:21 -0400 Gabor Grothendieck wrote: > > Or am I missing something? O.k., because the residuals don't add to zero, there may be a non-zero correlation between residuals and fitted values, which messes up the equation at the variance level. > Try it on an ex

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

2011-03-17 Thread Tóth Dénes
Hi! Not an elegant solution, but seems to work: date <- c(1:300) flow <- sin(2*pi/53*c(1:300)) levels <- factor(rep(c("high","med","low"),100)) data <- cbind.data.frame(date, flow, levels) colours <- as.numeric(levels)+1 # interpolate resolution <- 0.001 appres <- approx(date,flow,seq(min(date

Re: [R] Strange R squared, possible error

2011-03-17 Thread Gabor Grothendieck
On Thu, Mar 17, 2011 at 8:22 PM, Berwin A Turlach wrote: > G'day Gabor, > > On Thu, 17 Mar 2011 11:36:38 -0400 > Gabor Grothendieck wrote: > >> The idea is that if you have a positive quantity that can be broken >> down into two nonnegative quantities: X = X1 + X2 then it makes sense >> to ask wh

Re: [R] Histograms with strings,

2011-03-17 Thread David Wolfskill
On Thu, Mar 17, 2011 at 10:06:21PM +, Khanvilkar, Shashank wrote: > 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.1

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

2011-03-17 Thread David Wolfskill
On Thu, Mar 17, 2011 at 07:52:29PM -0400, Gabor Grothendieck wrote: > ... > > I hope to learn what I'm misunderstanding. > ... > > This line in the code above produces an invalid object: > class(df$time) <- "POSIXct" > > It should be: > class(df$time) <- c("POSIXct", "POSIXt") Ah. Thank you, Si

Re: [R] Strange R squared, possible error

2011-03-17 Thread Berwin A Turlach
G'day Gabor, On Thu, 17 Mar 2011 11:36:38 -0400 Gabor Grothendieck wrote: > The idea is that if you have a positive quantity that can be broken > down into two nonnegative quantities: X = X1 + X2 then it makes sense > to ask what proportion X1 is of X. For example: 10 = 6 + 4 and 6 is > .6 of

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

2011-03-17 Thread Gabor Grothendieck
On Thu, Mar 17, 2011 at 4:54 PM, David Wolfskill wrote: > On Thu, Mar 17, 2011 at 10:23:33AM -0400, Gabor Grothendieck wrote: >> On Thu, Mar 17, 2011 at 9:38 AM, David Wolfskill wrote: >> ... >> > But the X-axis labels show up as "large integers" -- the POSIXct values >> > are apparently treated

Re: [R] A question about list

2011-03-17 Thread jim holtman
use 'unlist' > x <- list(1:10, 20:27, 30:50) > x [[1]] [1] 1 2 3 4 5 6 7 8 9 10 [[2]] [1] 20 21 22 23 24 25 26 27 [[3]] [1] 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > quantile(unlist(x)) 0% 25% 50% 75% 100% 1.0 15.0 31.0 40.5 50.0 > On Thu, Mar 17, 2011

Re: [R] Histograms with strings,

2011-03-17 Thread jim holtman
try this: > x [1] "74.125.224.38" "74.125.224.38" "129.46.71.19" "129.46.71.19" "129.46.71.19" "129.46.71.19" [7] "129.46.71.19" "129.46.71.19" "129.46.71.19" "129.46.71.19" "129.46.71.19" "129.46.71.19" > table(x) x 129.46.71.19 74.125.224.38 10 2 > which.max(table

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

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 which

[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), s

[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)) levels=c(rep(c("

[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

[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 is

[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 2.669081

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 wrote: > ... > > But the X-axis labels show up as "large integers" -- the POSIXct values > > are apparently treated as numeric quantities for this purpose. > ... > Please cut this

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 sta

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 wrote: > On Wed, Mar 16, 2011 at 6:58 PM, jctoll 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 wi

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 l

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 plen

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 wrote: > So, I've been confused by this for a while.  If I want to create funct

[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] 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 en

[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 messag

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 likelihoods,

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 https://stat.ethz.ch/mailman/listinfo/r-he

[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 separ

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, 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 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, 1

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, I

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,

[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 messag

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

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: http://r.789695.n4.nabble.com/plotting-multiple-figures-on-one-page-tp338298

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 &

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 wrote: > Hi, > > I have the following type of data: 86 subjects in three independent

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

2011-03-17 Thread Sarah Goslee
me, and I would 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 'sa

[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 respo

[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 somewher

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] 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,...) de

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. fr

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
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] 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 dat

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 = fo

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 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 sea

[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, decrease).

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

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. On

Re: [R] Strange R squared, possible error

2011-03-17 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 3:49 PM, derek 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 why do I g

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 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 object is A. >

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 t

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 paramet

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 = "Mplus

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 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 example

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 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") >> li

Re: [R] Segmentation fault when using "plot" function

2011-03-17 Thread Henrik Bengtsson
On Thu, Mar 17, 2011 at 6:58 AM, cchace 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 didn't find a

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 i

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, r

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 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 argument, extracts i

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 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 particular regarding: We s

[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] 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 me

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 wo

[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 z

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^2>

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

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 automatic

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

[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

[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 wi

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

2011-03-17 Thread Deepayan Sarkar
On Wed, Mar 16, 2011 at 12:52 AM, 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] grid_2.12.2 > > If

Re: [R] Autocorrelation in linear models

2011-03-17 Thread Ben Bolker
Arni Magnusson 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 are

[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 D

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 wrote: > Hi again

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

2011-03-17 Thread Barry Rowlingson
On Thu, Mar 17, 2011 at 3:54 AM, 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 for. __

  1   2   >