Re: [R] R's basic lm() and summary.lm functions

2013-05-11 Thread Achim Zeileis
On Fri, 10 May 2013, ivo welch wrote: I ended up wrapping my own new ols() function in the end. it is my replacement for lm() and summary.lm. this way, I don't need to alter internals. in case someone else needs it, it is included. of course, feel free to ignore. If you use NeweyWest()

[R] question about 1-way anova

2013-05-11 Thread meng
Hi all: I have a question about one-way anova. The data is ¡°sleep¡±which belongs to R. code1: summary(lm(extra~group)) Estimate of group2(1.58) is the difference between mean of group1 and group2,and t value(1.861) and p value(0.0792) is the same as 2 sample t test,and the code is ¡°

Re: [R] Raster comparrison

2013-05-11 Thread Jeff Newmiller
I have no idea what you should do. That is why you should always reply all to messages on the list, so others can chime in. --- Jeff NewmillerThe . . Go Live...

Re: [R] question about 1-way anova

2013-05-11 Thread peter dalgaard
On May 11, 2013, at 06:10 , meng wrote: Hi all: I have a question about one-way anova. The data is ¡°sleep¡±which belongs to R. code1: summary(lm(extra~group)) Estimate of group2(1.58) is the difference between mean of group1 and group2,and t value(1.861) and p

[R] prediction in a loop with only one sample

2013-05-11 Thread asdf1234
Dear all, I have a sample with 920 observations. I want to create a loop which takes 300 of these observations for the prediction and the rest to estimate the model. My idea was to create something like this: cs.training.dat - read.table... cs.training.dat_sub1 - subset(cs.training.dat,

[R] Help on sound identification of distance between lines

2013-05-11 Thread Andras Farkas
Dear List I would like to ask for some input on the following (here is a simplified version of the code): t -t(seq(0,120,by=120/48)) d -500 k -0.1 x -matrix((d/20)*exp(-k*0.9*t)) y -matrix((d/15)*exp(-k*0.7*t)) z-matrix((d/22)*exp(-k*1.1*t)) w-matrix((d/17)*exp(-k*0.2*t)) t

[R] mcmapply should be parallel, but runs serial?

2013-05-11 Thread Martin Ivanov
Dear all, I am running R-3.0 on Slackware64 Linux (Linux marto 2.6.38.4 #1 SMP Thu Apr 21 20:48:11 CDT 2011 x86_64 Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz GenuineIntel GNU/Linux) Here is a minimal example: library(parallel); fun - function(fileName) { file.create(fileName);

Re: [R] A problem of splitting the right screen in 3 or more independent vertical boxes:

2013-05-11 Thread Aldi Kraja
For those that may have this question in the future, here are two solutions: As suggested from David and Sarah, One has to remove par function from defining screen splits, instead use layout function. For example: layout(matrix(c(1,1,2,3),2,2,byrow=T)) which says, split the screen in 4 blocks,

Re: [R] scatter plot matrix with different x-y variables

2013-05-11 Thread Greg Snow
The pairs2 function in the TeachingDemos package does what you describe. You give it 2 matricies instead of just one and it creates the plots. On Wed, May 8, 2013 at 10:49 AM, Adel adelda...@gmail.com wrote: Dear list-members, I wonder if there is a way of creating a scatter plot table/grid

Re: [R] functions with function inputs and optimisation

2013-05-11 Thread Uwe Ligges
On 10.05.2013 08:19, Sachinthaka Abeywardana wrote: Hi all, Would be great if you could help me get my head around the further arguemnts in the optim function. Let's say we have f and g as shown: f-function(x,a,b){(x-a)^2+b} optim(100,fn=f,gr=NULL,2,5) #the NULL is annoying

[R] boxplot with grouped variables

2013-05-11 Thread maggy yan
my dataset looked like this in the beginning: Daten V1 V2 V3 1 Dosis Gewicht Geschlecht 2 06.62 m 3 06.65 m 4 05.78 m 5 05.63 m I need box plots for V2 with all combination of V1 and V3, so I deleted the

Re: [R] How to repeat 2 functions in succession for 400 times? (microarray data)

2013-05-11 Thread arun
Hi, May be this helps:  set.seed(24)  mydata4- as.data.frame(matrix(sample(1:100,10*38,replace=TRUE),ncol=38))  dim(mydata4) #[1] 10 38  library(matrixStats) res-do.call(cbind,lapply(1:400, function(i) {permutation-sample(mydata4);

Re: [R] boxplot with grouped variables

2013-05-11 Thread arun
Hi, Try this: dat1- read.table(text=     V1  V2 V3 1  Dosis Gewicht Geschlecht 2  0    6.62  m 3  0    6.65  m 4  0    5.78  m 5  0    5.63  m 6  1    6.78  m 7  1    6.45  m 8  1    5.68  m 9  1   

Re: [R] boxplot with grouped variables

2013-05-11 Thread Bert Gunter
It will not work because the presence of the first row means that all the variables are read in as factors, not numeric. You must convert numeric variables to numeric **after** eliminating the first row, or read the data in using read.table(..., head=TRUE). See ?read.table for details. **After**

Re: [R] boxplot with grouped variables

2013-05-11 Thread S Ellison
You can't mix number and character data in a data frame column, so you will probably find that all your variables are factors, not numbers. Try, for example class(Daten$V2) It looks like you failed to specify 'header=TRUE' in a read.table statement. Reread the data with headers properly treated

[R] pmnorm produces NaN

2013-05-11 Thread Marsupilami
Dear list-members, A specific set of parameter values produces NaN when using pmnorm (library mnormt). I was wondering whether has do to that either extremely small or big values are computed. Here is a reproducible code: ### library(mnormt) Leta = matrix(c(6.9077758,0.7253306),2,1)

[R] MaxLik pacakge

2013-05-11 Thread mansoor
I am using maxLik pacakge to estimate parameters of kumaraswamy distribution. But i dont knw how use initial starting values, it gives errors in response, is there any criteria of using initial starting values??? -- View this message in context:

Re: [R] How to repeat 2 functions in succession for 400 times? (microarray data)

2013-05-11 Thread David Winsemius
On May 11, 2013, at 9:21 AM, arun wrote: Hi, May be this helps: set.seed(24) mydata4- as.data.frame(matrix(sample(1:100,10*38,replace=TRUE),ncol=38)) dim(mydata4) #[1] 10 38 library(matrixStats) res-do.call(cbind,lapply(1:400, function(i) {permutation-sample(mydata4);

Re: [R] R's basic lm() and summary.lm functions

2013-05-11 Thread ivo welch
coeftest with sandwich is indeed powerful and probably faster. I see one drawback: it requires at least three more packages: lmtest, sandwich, and in turn zoo, which do not come with standard R. I also wonder whether I committed a bug in my own code, or whether there is another parameter I need

Re: [R] How to repeat 2 functions in succession for 400 times? (microarray data)

2013-05-11 Thread arun
Hi David, Yes. Both are similar in speed. set.seed(48)  system.time({fourPGCs - replicate(400, {  permutation-sample(mydata4)  PGC - (rowMeans(permutation[ ,1:27]) - rowMeans( permutation[ ,28:38]))/ (rowSds( permutation [,1:27]) + rowSds( permutation

Re: [R] R's basic lm() and summary.lm functions

2013-05-11 Thread Achim Zeileis
On Sat, 11 May 2013, ivo welch wrote: coeftest with sandwich is indeed powerful and probably faster. I see one drawback: it requires at least three more packages: lmtest, sandwich, and in turn zoo, which do not come with standard R. But they should be easy enough to install... I also wonder

[R] cut.dendrogram bug?

2013-05-11 Thread Murat Tasan
hi all -- i don't know if this is a bug or not, thought i would survey the crowd before trying to submit a report... if i specify a cut height for a dendrogram that is higher than the full dendrogram itself, my expectation is that the $upper value would be NULL or NA, and the $lower value would

Re: [R] [newbie] *apply to matching elements of n arrays?

2013-05-11 Thread Tom Roche
Tom Roche Wed, 08 May 2013 20:38:12 -0400 I have two spatial grids defined the same way (i.e., same number of rows and columns--and dimensions, both 2D). Wherever both * the value of an element i,j in the first grid is NA * the value of element i,j in the second grid is !NA I want to copy

[R] [newbie] return index(s) for value?

2013-05-11 Thread Tom Roche
Is there a function 'foo' such that, given an array and a value, iff the value is present in the array, it returns the index(s) of the value? E.g., matrix(1:9, nrow=3) - grid grid [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 foo(grid, median(grid)) [1]

Re: [R] [newbie] return index(s) for value?

2013-05-11 Thread Rui Barradas
Hello, To that effect, just use the argument arr.ind of ?which: which(grid == median(grid), arr.ind = TRUE) Note that it defaults to FALSE. Hope this helps, Rui Barradas Em 11-05-2013 23:35, Tom Roche escreveu: Is there a function 'foo' such that, given an array and a value, iff the

Re: [R] [newbie] return index(s) for value?

2013-05-11 Thread Uwe Ligges
On 12.05.2013 00:35, Tom Roche wrote: Is there a function 'foo' such that, given an array and a value, iff the value is present in the array, it returns the index(s) of the value? E.g., matrix(1:9, nrow=3) - grid grid [,1] [,2] [,3] [1,]147 [2,]258 [3,]3

Re: [R] [newbie] return index(s) for value?

2013-05-11 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-help/2013-May/353343.html Is there a function 'foo' such that, given an array and a value, iff the value is present in the array, it returns the index(s) of the value? E.g., matrix(1:9, nrow=3) - grid grid [,1] [,2] [,3] [1,]147 [2,]

Re: [R] [newbie] *apply to matching elements of n arrays?

2013-05-11 Thread Bert Gunter
(Private) On Sat, May 11, 2013 at 3:24 PM, Tom Roche tom_ro...@pobox.com wrote: Tom Roche Wed, 08 May 2013 20:38:12 -0400 I have two spatial grids defined the same way (i.e., same number of rows and columns--and dimensions, both 2D). Wherever both * the value of an element i,j in the first

[R] need means on all boxplots, but only half of them got that

2013-05-11 Thread maggy yan
I tried to draw a point on all boxplots for their means, I did: boxplot( Daten$weight~interaction(Daten$Dosis,Daten$sex, drop=TRUE)) means-tapply( Daten$weight, Daten$Dosis, mean) points(means, pch=5, col=red, lwd=5) but only the boxplots for male got that point on them, its really weird because

Re: [R] need means on all boxplots, but only half of them got that

2013-05-11 Thread arun
Hi,   If the means are based on the combination. means-tapply( Daten$weight, list(Daten$Dosis,Daten$sex), mean) library(reshape2) points(melt(means)$value,pch=5,col=red,lwd=5) A.K. - Original Message - From: maggy yan kiot...@gmail.com To: R-help@r-project.org Cc: Sent: Saturday, May

Re: [R] need means on all boxplots, but only half of them got that

2013-05-11 Thread arun
You may also try: library(ggplot2) p-ggplot(dat2New,aes(x=combin,y=value))+geom_boxplot()+facet_wrap(~V3,scales=free_x,ncol=2) p+stat_summary(fun.y=mean,shape=2,col=red,geom=point) A.K. - Original Message - From: maggy yan kiot...@gmail.com To: R-help@r-project.org Cc: Sent: Saturday,

[R] Broken line questions

2013-05-11 Thread David Doyle
Hello Everyone, I have some data that like most real world data isn't complete. I'm trying to plot all of it together with lines connecting the data points. Because I have breaks in the data I have breaks in the lines. Is there a way that the lines will connect all the markers??? Below is

Re: [R] Broken line questions

2013-05-11 Thread arun
Hi, May be this helps: plot(dataset1~Date,data=mydata[!is.na(mydata$dataset1),],ylim=range(5.7,8),pch=10,cex=0.8,col=black,xlab=Date,ylab=pH)   with(mydata[!is.na(mydata$dataset2),],points(Date,dataset2,col=blue,pch=2,cex=0.8))  

[R] how to deal with continous and Non continuous mixed variables in factor analysis?

2013-05-11 Thread Klot Lee
hi, when I am doing factor analysis, there is continous and Non continuous variables(classified variables). Does psych package handle this? Is there any difference between continous variables and non ones or mixed ones when doing factor analysis? If there is, which packages should I use then? My