Re: [R] confidence interval calculation for gee

2013-04-07 Thread Duncan Mackay
At 04:26 8/04/2013, you wrote: Hello, I have the following r-codes for solving a quasilikelihood estimating equation: >library(geepack) >fit<-geese(y~x1+x2+x3,jack=TRUE,id=id,scale.fix=TRUE,data=dat,mean.link = "logit", corstr="independence") Now my question is how can I calculate the confiden

Re: [R] Same boxplot colors by panels in lattice (bwplot)

2013-04-07 Thread Richard M. Heiberger
I recommend the panel function from the HH package ## install.packages("HH") ## if necessary library(HH) bwplot(b~x|a,data=DF, panel=panel.bwplot.intermediate.hh, col = c("darkorange1","limegreen","magenta")) Rich On Sun, Apr 7, 2013 at 4:45 PM, Concha Bielza wrote: > Dear all, > >

Re: [R] Same boxplot colors by panels in lattice (bwplot)

2013-04-07 Thread Duncan Mackay
Hi Concha You nearly got there try: set.seed(42) D1 <- rnorm(200) D2 <- factor(sample(letters[1:2],200,TRUE)) D3 <- factor(sample(letters[3:5],200,TRUE)) DF <- data.frame(x=D1,a=D2,b=D3) print(bwplot(b~x|a,data=DF, par.settings = list(box.dot = list(rep("black",3)),

Re: [R] While loop history

2013-04-07 Thread William Dunlap
> I am aware of the apply() functions, > but they are wrapper function of for loops, so they are slower. While this sounds right in the abstract, it isn't always so. Many times looping code is slow not because of the function calls of interest but because of how the memory used to store the resul

Re: [R] While loop history

2013-04-07 Thread Jeff Newmiller
Vectors. Data frames are lists of vectors. Create longer vectors and perform computations vector-wise on all simulation data sets at once. Depending on the type of simulation, matrices and linear algebra may help as well. ---

[R] Same boxplot colors by panels in lattice (bwplot)

2013-04-07 Thread Concha Bielza
Dear all, I would like to have the same color for the all boxplots from the same panel, but my code below shows the two colors alternating. Thanks! set.seed(42) D1 <- rnorm(200) D2 <- factor(sample(letters[1:2],200,TRUE)) D3 <- factor(sample(letters[3:5],200,TRUE)) DF <- data.frame(x=D1,a=D2,b

Re: [R] prcomp() and varimax()

2013-04-07 Thread peter dalgaard
On Apr 7, 2013, at 16:06 , Mike Amato wrote: > Thanks for the reply. Maybe my problem is that prcomp() and varimax() > are calculating "cumulative proportion of variance" differently? > When I use the tol parameter with prcomp(), it restricts the number of > components to 3 and reports that the

Re: [R] While loop history

2013-04-07 Thread C W
May I say also ask one thing? @OP: sorry to use your post. What would you use instead of loops? I am aware of the apply() functions, but they are wrapper function of for loops, so they are slower. At one point, I was told to go back to C for faster implementation, but I like R much more. In th

Re: [R] discriminant function analysis

2013-04-07 Thread Bert Gunter
PLEASE, please ... learn to use R's Help system before posting here! within R: >??"discriminant analysis" ## short form of: help.search("discriminant analysis") ?help ?help.search or even google something like: "R software discriminant analysis" Cheers, Bert On Sun, Apr 7, 2013 at 11:25 A

Re: [R] xts object translation

2013-04-07 Thread Joshua Ulrich
Use lag.xts: R> lag(x,-1) aaabbb cccddd 2001-01-02 181.1751 243.24 1689.10 267.15 2001-01-03 181.6126 242.09 1737.86 267.10 2001-01-04 NA NA NA NA Note that the sign of k is different for lag.xts than lag.zoo (and lag.default). R> lag(as.zoo(x),-1)

Re: [R] mlogit error

2013-04-07 Thread arun
Hi, Try this:  Mult3$mode.ids  #[1] 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 #Levels: 1 2 3 4 5 6 I guess the key is to have equal number of alternatives.  Mult3$mode.ids<- as.numeric(as.character(Mult3$mode.ids))   res<-mlogit.data(Mult3[-25,],shape="long",choice="CHOICE",alt.var="mode.id

[R] xts object translation

2013-04-07 Thread Michela
i have an xts object: aaa bbbccc ddd 2001-01-02 179.7061239.11 1712.60 271.10 2001-01-03 181.1751243.24 1689.10 267.15 2001-01-04 181.6126242.09 1737.86 267.10 i

[R] importing and merging many time series

2013-04-07 Thread Anton Lebedevich
Hello. I've got many (5-20k) files with time series in a text format like this: 1359635460 2.006747 1359635520 1.886745 1359635580 3.066988 1359635640 3.633578 1359635700 2.140082 1359635760 2.033564 1359635820 1.980123 1359635880 2.060131 1359635940 2

Re: [R] prcomp() and varimax()

2013-04-07 Thread Mike Amato
Thanks for the reply. Maybe my problem is that prcomp() and varimax() are calculating "cumulative proportion of variance" differently? When I use the tol parameter with prcomp(), it restricts the number of components to 3 and reports that the cumulative variance explained by the third component

[R] ask help

2013-04-07 Thread DONG Echo
Hi, if I have a data such that, type otu1 otu2 otu3 otu4 otu5 sampleA A1 23 4 56 sampleA A2 14 9 32 sampleB B1 36 1 45 sampleB B2 45 3 43 I want to make a heatmap that A1 and A2 are clusted in sampleA and B1 and B2 a

Re: [R] Remove a row containing a specific value for a column

2013-04-07 Thread arun
Hi, DATA[DATA$A!="Blue1",] # A B C D #1 Red1 1 1 1 #3 Red2 1 1 1 #4 Red3 1 1 1 #or DATA[!grepl("Blue1",DATA$A),] # A B C D #1 Red1 1 1 1 #3 Red2 1 1 1 #4 Red3 1 1 1 A.K. - Original Message - From: Beatriz González Domínguez To: r-help@r-project.org; R Help Cc: Sent: Sunday, A

[R] Remove a row containing a specific value for a column

2013-04-07 Thread Beatriz González Domínguez
Dear all, Could anyone help me with the following? DATA <- data.frame(rbind(c("Red1", 1, 1, 1), c("Blue1", 1, 1, 1), c("Red2", 1, 1, 1), c("Red3", 1, 1, 1))) colnames(DATA) <- c("A", "B","C", "D") #Option 1 DATA <- DATA[-2, ] #Same result I would like to achieve with Option 2 #Option 2 - I wou

[R] confidence interval calculation for gee

2013-04-07 Thread Tasnuva Tabassum
Hello, I have the following r-codes for solving a quasilikelihood estimating equation: >library(geepack) >fit<-geese(y~x1+x2+x3,jack=TRUE,id=id,scale.fix=TRUE,data=dat,mean.link = "logit", corstr="independence") Now my question is how can I calculate the confidence interval of the parameters of

[R] discriminant function analysis

2013-04-07 Thread Greg Liggett
I have the Rexcel package. Which of the functions do I want to run a discriminant function analysis? Or, how would I do it in R? Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/list

Re: [R] windows to remote R(linux) via putty with X11 forwarding

2013-04-07 Thread S Ellison
> seems like not possible without X windows onthat putty from > windows box Certainly if you want to run R under X windows you will need to run an X server on Windows, typically on top of PuTTY But once you have X running and connected in Windows, just start R from the command line. That's how

Re: [R] Package ‘FAdist’ - Log-Pearson Type III Distribution

2013-04-07 Thread David Winsemius
On Apr 6, 2013, at 10:08 PM, Katherine Gobin wrote: Dear Sir, I am referring to your package "FAdist". I wish to know how to estimate the parameters of the distribution - "Log-Pearson Type III Distribution"? I suppose I could look up the maintainer of that package and try to see if the

Re: [R] Forum for pure statistical questions

2013-04-07 Thread David Winsemius
On Apr 6, 2013, at 8:58 PM, Katherine Gobin wrote: Dear R forum (2) Is there any other R forum dealing with only Statistical queries? The website named Crossvalidated , http://stats.stackexchange.com/questions/ , is designed for purely statistical questions although it cannot be conside

[R] Confidence Interval Calculation

2013-04-07 Thread Tasnuva Tabassum
Hello, I have the following r-codes for solving a quasilikelihood estimating equation: >library(geepack) >fit<-geese(y~x1+x2+x3,jack=TRUE,scale.fix=TRUE,data=dat,mean.link = "logit", corstr="independence") Now my question is how can I calculate the confidence interval of the parameters of the ab

Re: [R] scanning data in R

2013-04-07 Thread S Ellison
>> I have a data file 'stop' to be scanned in >> R. >> But I want to ignore one specific number '21' there. Putting differently, >> I >> want to get all numbers in the file except 21. Is there any command to >> achieve it? >> See the na.strings argument to scan, and note that it can be a vecto

Re: [R] group data in classes

2013-04-07 Thread arun
Hi, Try: year1<- 1598:1997  indx<-findInterval(year1,seq(1591,2000,by=10)) group<-seq(1590,2000,by=10) ind<-seq(1,length(group),by=1) labl1<-paste(group[ind],group[ind+1],sep="-")[-42] dat1<- data.frame(year=year1,decade=labl1[indx],stringsAsFactors=FALSE) head(dat1,5) #  year    decade #1 1598 1

Re: [R] mlogit error

2013-04-07 Thread arun
HI Graham, Try this:  lst1<-split(Mult3,Mult3$obs)  Mult3New<-do.call(rbind,lst1[lapply(lst1,nrow)==6]) # YOu can change 6 to other numbers res1<- mlogit.data(Mult3New,shape="long",choice="CHOICE",alt.var="mode.ids",indivs="set3",chid.vars="obs") head(res1,2) #    dn obs choice br mth tcomp num

Re: [R] Graphic window dimensions

2013-04-07 Thread Uwe Ligges
On 07.04.2013 09:53, Eva Prieto Castro wrote: Hi Uwe, Thank you for your help. Then, how can I know (in runtime) then max width and height I can use?. If it depends on the screen inches, I should obtain those values in runtime, is this true?. The appearance in graphic window must be vertical

Re: [R] Working with createFolds

2013-04-07 Thread Rui Barradas
Hello, You should say from what package are the functions you're using. From the help page of createFolds, the return value is "A list or matrix of row position integers corresponding to the training data" So to subset use `[` or `[[`. Try class(folds$index$Fold_i) If it's a numeric vector,

Re: [R] Working with createFolds

2013-04-07 Thread Nicolás Sánchez
Anyone? ;-) 2013/4/7 Nicolás Sánchez > Hello! > > I have a question. I am working with createFolds: > > folds<- trainControl(method='cv', index=createFolds(data$Score,list = > TRUE)) > > I need to iterate over folds to extract the indexes from each fold. > > For example, if I do folds$index$Fo

[R] mlogit error

2013-04-07 Thread Leask, Graham
Dear List I am trying to fit a multinomial model using the mlogit package. Attempting to load the data into mlogit presents the following error. MLOG<-mlogit.data(Mult3,shape="long",choice="CHOICE",alt.var="mode.ids",indivs = "set3",chid.var = "obs") Error in `row.names<-.data.frame`(`*tmp*`, v

Re: [R] R ecuatia error

2013-04-07 Thread Rui Barradas
Hello, What is the output of str(pg)? Is pg a data.frame? Rui Barradas Em 07-04-2013 14:14, catalin roibu escreveu: Dear all! I have a problem when I use this equation with R. mpr <- 843.75*exp(-1.119*pg) Error in FUN(left, right) : non-numeric argument to binary operator pg 01 02 03 04

[R] R ecuatia error

2013-04-07 Thread catalin roibu
Dear all! I have a problem when I use this equation with R. mpr <- 843.75*exp(-1.119*pg) Error in FUN(left, right) : non-numeric argument to binary operator pg 01 02 03 04 05 06 07 08 09-236 10-63T 11 12 13 14 15 16 17-234 18 19 20 23 1592 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA N

[R] Working with createFolds

2013-04-07 Thread Nicolás Sánchez
Hello! I have a question. I am working with createFolds: folds<- trainControl(method='cv', index=createFolds(data$Score,list = TRUE)) I need to iterate over folds to extract the indexes from each fold. For example, if I do folds$index$Fold01, it contains: 5 11 17 29 44 50 52 64 65 I nee

Re: [R] Cannot scale data

2013-04-07 Thread Nicolás Sánchez
Of Course, that's the solution! Thankss! 2013/4/6 Rui Barradas > Hello, > > Can't you simply call svm() with scale = FALSE ? > If the variable is constant, it cannot be scaled to unit variance (and > zero mean). > > Hope this helps, > > Rui Barradas > > Em 06-04-2013 17:19, Nicolás Sánchez escr

Re: [R] While loop history

2013-04-07 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Loops are seldom a good solution in R so some more information and data would be useful At the simplist, for your specific question I think you could set up two vectors (e.g. v1 <- rep(NA, 10 ) and just w

Re: [R] prcomp() and varimax()

2013-04-07 Thread S Ellison
> > My concern is with the reported proportions of variance for the 3 > components after varimax rotation. It looks like each of my 3 components > explains 1/15 of the total variance, summing to a cumulative proportion > of 20% of variance explained. But those 3 components I retained should >

Re: [R] Start R from bash/bat file and end in interactive mode

2013-04-07 Thread Duncan Murdoch
On 12-11-01 4:14 AM, Jan van der Laan wrote: I have a r-script (rook.R) that starts a Rook server. To present users from having to start R and type in source("rook.R"), I want to create a bash script and bat file that starts R and sources the script. However, to keep the Rook server running R sh

Re: [R] Graphic window dimensions

2013-04-07 Thread Eva Prieto Castro
Hi Uwe, Thank you for your help. Then, how can I know (in runtime) then max width and height I can use?. If it depends on the screen inches, I should obtain those values in runtime, is this true?. The appearance in graphic window must be vertical (as A4 paper or something like that), apart fr

Re: [R] Start R from bash/bat file and end in interactive mode

2013-04-07 Thread Frank Schwidom
another working Example: { echo "print( 1)"; cat;} | R --interactive but do not end with -D, it overrides the "save workspace" question; use q() instead there is an additional echo where i don't know how to avoid them On Thu, Nov 01, 2012 at 09:14:09AM +0100, Jan van der Laan wrote: > > I ha

Re: [R] Start R from bash/bat file and end in interactive mode

2013-04-07 Thread Frank Schwidom
one way could be: $ cat rook.R | R --interactive but with a little different console behaviour the problem in your other examples is, that R uses only the first appearing switch of: --interactive, --f, -e, --vanilla, --no-save, ... the switches cannot be combined On Thu, Nov 01, 2012 at 09:14

Re: [R] Help! Weird behavioral difference between R interactive and command-line?

2013-04-07 Thread Frank Schwidom
Hi some functions, like plot, readline and others behave different depending to the result of the function interactive() there is no way to ask R which functions do that On Thu, Sep 06, 2012 at 01:22:32PM -0500, Michael wrote: > Help! Weird behavioral difference between R interactive and comman

Re: [R] Value at Risk using a volatility model?

2013-04-07 Thread Stat Tistician
I already know this, I did a second post, where I mention this, but I have still problems with the implementation, especially in case of other distributions! But thanks for your answer. 2013/4/7 Patrick Burns : > There is an example of using the t distribution > for VaR in: > > http://www.portfoli

Re: [R] Replace missing value within group with non-missing value

2013-04-07 Thread Leask, Graham
Hi Bill, Thank you for your suggestion. I shall try running the code and test as you suggest. Is there a straightforward way to routinely test the structure of a complex survey data set such as this? For example with a multinomial choice model such as this for the data to be correct for each

Re: [R] group data in classes

2013-04-07 Thread Rolf Turner
brs <- seq(1590,2000,by=10) lbs <- paste(brs[-length(brs)],brs[-1],sep="-") y <- cut(x,breaks=brs,labels=lbs) # Where "x" is your data vector. grpd <- data.frame(year=x,decade=y) head(grpd) yeardecade 1 1598 1590-1600 2 1599 1590-1600 3 1600 1590-1600 4 1601 1600-1610 5 1602 1600-1610 6 16

Re: [R] Value at Risk using a volatility model?

2013-04-07 Thread Patrick Burns
There is an example of using the t distribution for VaR in: http://www.portfolioprobe.com/2012/11/19/the-estimation-of-value-at-risk-and-expected-shortfall/ The trick is to know what the variance of the distribution is for a given value of the degrees of freedom. Pat On 06/04/2013 10:54, Stat

[R] group data in classes

2013-04-07 Thread catalin roibu
Hello all! I have a problem to group my data (years) in 10 years classes. For example for year year decade 1598 1590-1600 1599 1590-1600 1600 1590-1600 1601 1600-1610 --- my is like this> [1] 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 [16] 1613 1614 1615

[R] Fitting distributions to financial data using volatility model to estimate VaR

2013-04-07 Thread Stat Tistician
Ok, I try it again with plain text, with a simple R code example and just sending it to the r list and you move it to sig finance if it is necessary. I try to be as detailed as possible. I want to fit a distribution to my financial data using a volatility model to estimate the VaR. So in case of

Re: [R] ad.test parameters

2013-04-07 Thread iritgur
package -ADGotTest it demends known distribution function thank you -- View this message in context: http://r.789695.n4.nabble.com/ad-test-parameters-tp4663500p4663578.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project

Re: [R] ad.test parameters

2013-04-07 Thread iritgur
i have one set of data and i want to make AD test to see if the data fits my distribution function (this function unknown by R but i have the formula for f(x) and F(x)) -- View this message in context: http://r.789695.n4.nabble.com/ad-test-parameters-tp4663500p4663579.html Sent from the R help

[R] While loop history

2013-04-07 Thread Baylee Smith
Hi, I am new at R and still trying to get the hang of things. I am running a while loop and wish to save the results of each iteration. The results are a vector x of length two and I wish to save the results of each iteration as two vectors, one for x[1] and the other for x[2]. Thanks! [[