[R] Is there any way of weighting individual data points in a logistic regression

2012-10-25 Thread David Schoeman
Dear all. Apologies if I am asking a stupid question, but I have been unable to find a solution so far. I would like to run a logistic regression in which individual data points are assigned different weights (related to my confidence in their validity). These individual observations are binar

[R] fft and significance

2012-10-25 Thread nuncio m
HI users, Is it possible to check the significance of peaks in a power spectrum in R Thanks and regards nuncio -- Nuncio.M Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 ph off 91 832 2525636 ph: cell 91 9890357423 [[altern

Re: [R] Interpreting and visualising lme results

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 10:32 PM, Santini Silvana wrote: > Dear R users, > I have used the following function (in blue) No, we do not do "in blue" here. This is a monochrome mailing list. > aiming to find the linear regression between MOE and XLA and nesting my data > by Species. I have obtained t

Re: [R] wanna create all points.....

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 8:49 PM, Rlotus wrote: > Plz help me ;(( I lost 7 hours for thinking and doing this code ;( I need to > create points.20 points(dots). All these dots have to be in one graph... > when i run this codeit gives me only one dote. You got twenty dots. It's just that th

Re: [R] Generate two bell curves

2012-10-25 Thread peter dalgaard
On Oct 26, 2012, at 03:17 , phantastic wrote: > How do I generate two bell curves, both with the same mean but different > standard deviations? I used to have a script for it but I lost it. > > Thanks. curve(, from=..., to=...) curve(, add=TRUE) If you plot the tallest one first, you w

Re: [R] How to draw the graph???

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 5:14 PM, Rlotus wrote: > plot(y,x, ylab="sample mean",xlab="sample size") > > for (i in seq(1:20)) >> {rsidpVector= rsidp(1) >> x<-mean(rsidpVector) >> y<-length(number) >> print (rsidpVector) >> print(x) > > sorry, but how i can use points function in the loop? Tested c

[R] Interpreting and visualising lme results

2012-10-25 Thread Santini Silvana
Dear R users, I have used the following function (in blue) aiming to find the linear regression between MOE and XLA and nesting my data by Species. I have obtained the following results (in green). model4<-lme(MOE~XLA, random = ~ XLA|Species, method="ML")summary(model4) Linear mixed-effects model

Re: [R] wanna create all points.....

2012-10-25 Thread Rlotus
One dote..and its a last dote of the loop ;( -- View this message in context: http://r.789695.n4.nabble.com/wanna-create-all-points-tp4647494p4647495.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailin

[R] how to make simulation faster

2012-10-25 Thread stats12
Dear R users, I need to run 1000 simulations to find maximum likelihood estimates. I print my output as a vector. However, it is taking too long. I am running 50 simulations at a time and it is taking me 30 minutes. Once I tried to run 200 simulations at once, after 2 hours I stopped it and saw t

[R] wanna create all points.....

2012-10-25 Thread Rlotus
Plz help me ;(( I lost 7 hours for thinking and doing this code ;( I need to create points.20 points(dots). All these dots have to be in one graph... when i run this codeit gives me only one dote. number<- (0,2,3,4,5,6,8) for (i in seq(1:20)) {rsidpVector=rsidp(i) mean(rsidpVector) pl

[R] Generate two bell curves

2012-10-25 Thread phantastic
How do I generate two bell curves, both with the same mean but different standard deviations? I used to have a script for it but I lost it. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Generate-two-bell-curves-tp4647488.html Sent from the R help mailing list archive a

Re: [R] system is computationally singular: reciprocal condition number

2012-10-25 Thread langvince
Hey David, my answers are delayed here, although I am not using my gmail email address:) Yep thats right, those bands of zeros are one of the most important values to define one group, and have a nice distance from the rest of the groups :). I cannot really get rid of those, I bet it would not h

Re: [R] system is computationally singular: reciprocal condition number

2012-10-25 Thread langvince
Hey Bert, thanks for your fast reply. Yes, based on svd it is singular. The "no way" statement was because of the source of the dataset. I would not expect that. I never used the stats Maha dist calc, but after giving it a shot, not a surprise still singular. Any idea how to manipulate the data

Re: [R] How to draw the graph???

2012-10-25 Thread Rlotus
plot(y,x, ylab="sample mean",xlab="sample size") for (i in seq(1:20)) > {rsidpVector= rsidp(1) > x<-mean(rsidpVector) > y<-length(number) >print (rsidpVector) > print(x) sorry, but how i can use points function in the loop? -- View this message in context: http://r.789695.n4.nabble.com/Ho

Re: [R] Merge matrices with different column names

2012-10-25 Thread Jeff Newmiller
If they have the same number of rows, you can use cbind() to create one object to write out. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

[R] Merge matrices with different column names

2012-10-25 Thread Charles Determan Jr
A general question that I have been pursuing for some time but have set aside. When finishing some analysis, I can have multiple matrices that have specific column names. Ideally, I would like to combine these separate matrices for a final output as a csv file. A generic example: Matrix 1 var1A

Re: [R] system is computationally singular: reciprocal condition number

2012-10-25 Thread Thomas Lumley
On Fri, Oct 26, 2012 at 12:14 PM, langvince wrote: > Whatever I do, however I subset it I get the "system is computationally > singular: reciprocal condition number" error. > I know what it means and I know what should be the problem, but there is no > way this is a singular matrix. > > I have up

Re: [R] How generate random numbers from given vector???

2012-10-25 Thread Jorge I Velez
You can also just replicate() as follows: # x is the vector # s is the size of the sample # B is the number of samples # ... arguments passed to sample() f <- function(x, s, B, ...) replicate(B, sample(x, s, ...)) f(x, 3, 10, TRUE) f(x, 3, 10, FALSE) HTH, Jorge.- On Fri, Oct 26, 2012 at 12:05

Re: [R] How generate random numbers from given vector???

2012-10-25 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello, The other options is to use the sample() function. test2 <- matrix (rep(sample(number1, size = 5), times=3), nrow=3) Pradip Muhuri From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Rui Barradas [ruipbarra...@sapo.pt

Re: [R] system is computationally singular: reciprocal condition number

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 4:41 PM, Bert Gunter wrote: > 1. I don't know what StatMatch is. Try using stats::mahalanobis. > > 2. It's the covariance matrix that is **numerically** singular and > can't be inverted. Why do you claim that there's "no way" this could > be true when there are hundreds of va

Re: [R] error bars

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 2:45 PM, Johnson, Franklin Theodore wrote: > Hello R-help, > > > > I am using R version 2.15.1. > > I upgraded from R version 2.13 a few months back. > > > > Previously, I was able to plot error bars on an xy scatter plot using the > errbar function: > > errbar(RAEthy

Re: [R] Z score

2012-10-25 Thread Vedant Sharma
Hi Arun, Thank you ! Very much appreciated. [Only added t() at the end to preserve the original orientation.] Also, many thanks to Rui Barradas. Cheers, Ved On Thu, Oct 25, 2012 at 12:06 PM, arun wrote: > > > Hi Ved, > > Sorr

Re: [R] How to draw the graph???

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 2:24 PM, Rlotus wrote: > I have his code. I wanna draw the graph according to x and y. But at the end > when I run the code it gives me only one dot...it is strange cuz from > the loop it has to give 20 dots. Help me plz to draw a graph((( > > for (i in seq(1:20)) > {rsid

Re: [R] system is computationally singular: reciprocal condition number

2012-10-25 Thread Bert Gunter
1. I don't know what StatMatch is. Try using stats::mahalanobis. 2. It's the covariance matrix that is **numerically** singular and can't be inverted. Why do you claim that there's "no way" this could be true when there are hundreds of variables (= dimensions). 3. Try calculating the svd of your

Re: [R] How generate random numbers from given vector???

2012-10-25 Thread Rui Barradas
Hello, You don't need the loop, the sample() argument 'size' is there for that. See 'sample. number <- c(0,1,3,4,5,6,8) rsidp <- function(n) sample(number, n, replace = TRUE) rsidp(5) Hope this helps, Rui Barradas Em 25-10-2012 20:24, Rlotus escreveu: I wanna generate random numbers from a

[R] system is computationally singular: reciprocal condition number

2012-10-25 Thread langvince
Hi folks, I know, this is a fairly common question and I am really disappointed that I could not find a solution. I am trying to calculate Mahanalobis distances in a data frame, where I have several hundreds groups and several hundreds of variables. Whatever I do, however I subset it I get the "s

[R] error bars

2012-10-25 Thread Johnson, Franklin Theodore
Hello R-help, I am using R version 2.15.1. I upgraded from R version 2.13 a few months back. Previously, I was able to plot error bars on an xy scatter plot using the errbar function: errbar(RAEthylene$TIME,RAEthylene$AVE,RAEthylene$AVE+RAEthylene$STD,RAEthylene$AVE-RAEthylene$STD,add = T

[R] Demo code

2012-10-25 Thread Rlotus
I have code in R. I need also demo code of my output and demo code of code. I dont know what is demo. An d how to create it...can you tell how to do that plz. thank you. -- View this message in context: http://r.789695.n4.nabble.com/Demo-code-tp4647471.html Sent from the R help mailing list arc

[R] How to draw the graph???

2012-10-25 Thread Rlotus
I have his code. I wanna draw the graph according to x and y. But at the end when I run the code it gives me only one dot...it is strange cuz from the loop it has to give 20 dots. Help me plz to draw a graph((( for (i in seq(1:20)) {rsidpVector= rsidp(1) x<-mean(rsidpVector) y<-length(number

Re: [R] How generate random numbers from given vector???

2012-10-25 Thread Rlotus
thank u so much! i got it. -- View this message in context: http://r.789695.n4.nabble.com/How-generate-random-numbers-from-given-vector-tp4647447p4647469.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing li

Re: [R] How generate random numbers from given vector???

2012-10-25 Thread arun
Hi, Try this: number1<-c(0,1,3,4,5,6,8)  rsidp<-function(x){  y<-sample(x,5,replace=TRUE)  y  }  rsidp(number1) #[1] 3 0 6 8 4  rsidp(number1) #[1] 1 8 8 6 4  rsidp(number1) #[1] 8 3 6 6 6 A.K. - Original Message - From: Rlotus To: r-help@r-project.org Cc: Sent: Thursday,

Re: [R] List of multidimensional arrays

2012-10-25 Thread Richard M. Heiberger
You are very lucky. This question was answered last week in https://stat.ethz.ch/pipermail/r-help/2012-October/326597.html For the future, please read the posting guide referenced below and include an example of your data and the result of the calculation you would like to see. Please use R-help

Re: [R] List of multidimensional arrays

2012-10-25 Thread pinki751
hello, I want to make a two dimensional matrix from the data table.That data table has three column 1st is userid,2nditemid and 3rd is rating corresponding to the itemid given by userid.I want to make a m*n matrix in which 'm' is userid and 'n' to be itemid .That 2D matrix should b filled with

Re: [R] trying ti use a function in aggregate

2012-10-25 Thread arun
Hi Rui, I thought the OP was looking for something like this:   May be I am wrong. dat2<-dat1[order(dat1$Trip_id,dat1$Vessel,dat1$CommonName,dat1$Length,dat1$Count),] dat3<-dat2 dat3$Prop<-unlist(tapply(dat3$Count,list(dat3$Trip_id,dat3$CommonName),function(x) x/sum(x)))  head(dat3) #  Trip_id  

Re: [R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Adel Powell
n <- 10; # Sample size fitglm <- function(sigma,tau){ x <- rnorm(n,0,sigma) intercept <- 0 beta <- 0 ystar <- intercept+beta*x z <- rbinom(n,1,plogis(ystar)) xerr <- x + rnorm(n,0,tau) model<-glm(z ~ xerr, family=binomial(logit)) int<-coef(model)[1] slope<-coef(

Re: [R] trying ti use a function in aggregate

2012-10-25 Thread arun
HI, In my previous solution, the order got messed up.  I should have ordered the columns. Try this: dat1<-read.table(text="  Trip_id  Vessel  CommonName Length Count 1  230    Sunlight    ShadAmerican    19    1 2  230    Sunlight    ShadAmerican    20    1 3  230  

Re: [R] trying ti use a function in aggregate

2012-10-25 Thread Sally_roman
Hi Jean - Thank you for your help. The code worked great. - Original Message - From: "Jean V Adams [via R]" To: "Sally_roman" Sent: Thursday, October 25, 2012 2:48:45 PM Subject: Re: trying ti use a function in aggregate Sally, It's great that you provided data and code. To make

Re: [R] ifelse reformulation

2012-10-25 Thread arun
Hi, Did you mean this? group1<-c(40,50,"60",70) #or group2<-c(50,"var1","var2",60) In either of the above cases, when you check str(group1) # all are converted to character. # chr [1:4] "40" "50" "60" "70"  str(group2) # chr [1:4] "50" "var1" "var2" "60" Suppose, I am comparing the test1 datase

[R] How generate random numbers from given vector???

2012-10-25 Thread Rlotus
I wanna generate random numbers from a vector... for example number<-c(0,1,3,4,5,6,8) so rsidp<-function(x){ i=0 for (i in seq(1:x)) {y<-sample(number,x, replace=T)} return(y) } so all random numbers have to be from vector "number"; so if I type rsidp(5). i

Re: [R] R5: Lock a class field from within a method?

2012-10-25 Thread Johannes Graumann
David Winsemius wrote: > > On Oct 24, 2012, at 2:14 AM, Johannes Graumann wrote: > >> Hello, >> >> testclass <- setRefClass( >> "testclass", >> fields = list(testfield = "logical"), >> methods = list(validate=function(){testfield<<-TRUE})) >> >>> test <- testclass$new() >>> test$testfield >>

Re: [R] Estimating credit card default probabilities.

2012-10-25 Thread Bert Gunter
You might have better luck posting on stats.stackexchange.com, a statistical help list. -- Bert On Thu, Oct 25, 2012 at 1:08 PM, Keith Weintraub wrote: > Folks, > I am working on a credit card defaults and transition probabilities. For > example a single credit card account could be in a number

Re: [R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Adel Powell
> n <- 10; # Sample size > > fitglm <- function(sigma,tau){ + x <- rnorm(n,0,sigma) + intercept <- 0 + beta <- 0 + ystar <- intercept+beta*x + z <- rbinom(n,1,plogis(ystar)) + xerr <- x + rnorm(n,0,tau) + model<-glm(z ~ xerr, family=binomial(logit)) + int<-coef(model)[1] + slope<-coef(model)[2] + p

Re: [R] Change to daily digest

2012-10-25 Thread Ben Bolker
Mohamed Radhouane Aniba gmail.com> writes: > > Which one ? :) > https://stat.ethz.ch/mailman/listinfo/r-help __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/

[R] Estimating credit card default probabilities.

2012-10-25 Thread Keith Weintraub
Folks, I am working on a credit card defaults and transition probabilities. For example a single credit card account could be in a number of states: up-to-date, 30, 60, 90 days in arrears or in default. * Are there packages in R that do estimation of the transition probabilities given historica

Re: [R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Berend Hasselman
Your code is still not runnable. It gives the error message Error in fitglm(0.05, 1) : could not find function "prediction" Berend On 25-10-2012, at 21:55, Adel Powell wrote: > I think I have corrected it. Can you tell me are my spec and sens values > correct > n <- 1000; # Sample size > >

Re: [R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Berend Hasselman
On 25-10-2012, at 21:28, Adel Powell wrote: > I am running my code in a loop and it does not work but when I run it > outside the loop I get the values I want. > > n <- 1000; # Sample size > > fitglm <- function(sigma,tau){ >x <- rnorm(n,0,sigma) >intercept <- 0 >beta <- 0 >ysta

[R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Adel Powell
I am running my code in a loop and it does not work but when I run it outside the loop I get the values I want. n <- 1000; # Sample size fitglm <- function(sigma,tau){ x <- rnorm(n,0,sigma) intercept <- 0 beta <- 0 ystar <- intercept+beta*x z <- rbinom(n,1,plogis(ystar)) x

Re: [R] trying ti use a function in aggregate

2012-10-25 Thread arun
Hi, Try this: dat1$Percent<-unlist(tapply(dat1$Count,list(dat1$Trip_id,dat1$CommonName),function(x) x/sum(x))) head(dat1) #  Trip_id   Vessel   CommonName Length Count    Percent #1 230 Sunlight ShadAmerican 19 1 0.01408451 #2 230 Sunlight ShadAmerican 20 1 0.01408451 #3   

Re: [R] trying ti use a function in aggregate

2012-10-25 Thread Jean V Adams
Sally, It's great that you provided data and code. To make it even more user-friendly for R-help readers, supply your data as Rcode, using (for example) the dput() function. The reason you were getting all 1s with your code, is that you had told it to aggregate by trip, LENGTH, and species.

Re: [R] Change to daily digest

2012-10-25 Thread R. Michael Weylandt
On Oct 25, 2012, at 7:30 PM, Mohamed Radhouane Aniba wrote: > Hello folks, > > I am currently receiving a lot of emails from the list which proves that this > is a very important place to get good feedbacks and tips and that the > community is here to help .. Excellent thing. > I am not thou

Re: [R] mean of a value of the last 2 hours

2012-10-25 Thread Felipe Carrillo
Or using ddply from plyr,   library(plyr) myframe <- data.frame (ID=c("Ernie", "Ernie", "Ernie", "Bert", "Bert", "Bert"), Timestamp=c("24.09.2012 09:00", "24.09.2012 10:00", "24.09.2012 11:00"), Hunger=c(1,1,1,2,2,1) ) myframe myframestime <- as.POSIXct (strptime(as.character(myframe$Timestamp), "%

Re: [R] Change to daily digest

2012-10-25 Thread Mohamed Radhouane Aniba
Which one ? :) On Oct 25, 2012, at 2:34 PM, "R. Michael Weylandt " wrote: > > > On Oct 25, 2012, at 7:30 PM, Mohamed Radhouane Aniba > wrote: > >> Hello folks, >> >> I am currently receiving a lot of emails from the list which proves that >> this is a very important place to get good fe

Re: [R] trying ti use a function in aggregate

2012-10-25 Thread arun
Hi, May be this helps: dat1<-read.table(text="  Trip_id  Vessel  CommonName Length Count 1  230    Sunlight    ShadAmerican    19    1 2  230    Sunlight    ShadAmerican    20    1 3  230    Sunlight    ShadAmerican    21    1 4  230    Sunlight    ShadAm

Re: [R] trying ti use a function in aggregate

2012-10-25 Thread Rui Barradas
Hello, Try the following. (I've changed your function a bit. And named the data.frame 'dat', not 'data', which is an R function.) myfun <- function (x) ifelse(sum(x) == 0, 0, x/sum(x)) aggregate(Count ~ Trip_id + Length + CommonName, data = dat, myfun) The output shows that each and every gr

[R] Change to daily digest

2012-10-25 Thread Mohamed Radhouane Aniba
Hello folks, I am currently receiving a lot of emails from the list which proves that this is a very important place to get good feedbacks and tips and that the community is here to help .. Excellent thing. I am not though able to login to my subscriber space to change the email reception into

Re: [R] problem in finding sizes of objects using a for loop

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 10:56 AM, jim holtman wrote: > Here is a function I use to get the size of objects: > > Here is an example output: > >> my.ls() > Size Mode > allStores 7,303,224 list > convertedStores 0 NULL > f.createCluster40,508 function

Re: [R] problem in finding sizes of objects using a for loop

2012-10-25 Thread jim holtman
Here is a function I use to get the size of objects: Here is an example output: > my.ls() Size Mode allStores 7,303,224 list convertedStores 0 NULL f.createCluster40,508 function x 41,672 list **Total 7,385,404 -

Re: [R] mean of a value of the last 2 hours

2012-10-25 Thread S Ellison
> > I want to add an additional column at the right and get in > each row a value which shows the mean of "hunger" of the last two hours. Isn't that just a moving average? if so, see http://stackoverflow.com/questions/743812/calculating-moving-average-in-r, which mentions zoo for RollingMeans,

Re: [R] Plot lmer model with Effects package

2012-10-25 Thread Ben Bolker
Marte Lilleeng gmail.com> writes: > [snip] > I have a simple model that i would like to plot with 95% CIs. > It is like follows: > m1<-lmer(Richness~Grazing+I(Grazing^2)+(1|Plot),family=poisson) > > By using the effects package I get two plots, one for the linear term > and one for the squ

Re: [R] arima.sim

2012-10-25 Thread J Toll
Hi, For the sake of completeness, I thought I might follow up my email from earlier in the month with what I found out by digging into the code. The answer to my earlier question perhaps should have been obvious to me from the "Usage" description from the documentation. In the three examples I o

Re: [R] mean of a value of the last 2 hours

2012-10-25 Thread Rui Barradas
Hello, Or ct <- cut(myframe2$myframestime, breaks = "2 hour") ave(myframe2$Hunger, ct) And assign the output of 'ave' to a new column. Hope this helps, Rui Barradas Em 25-10-2012 15:50, arun escreveu: Hi, May be this helps: new1<-with(myframe2,aggregate(cbind(Hunger,myframestime),by=list(

Re: [R] How to quit R script & return to R prompt

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 6:00 AM, S Ellison wrote: > > >> You typed a ` without closing it: >> barplot(xtab(`profits`,data=Forbes2000)) >> >> anyway: pushing the escape button should also return you to >> the R-prompt (at least on a Windows platform) Also on Macs. > > But why is the OP using a

Re: [R] Egarch (1,1) with Student t distribution in RExcel

2012-10-25 Thread David Winsemius
On Oct 25, 2012, at 8:00 AM, Dheeraj Pandey wrote: > How Can I run all these codes in VBA using RExcel > library(rugarch) I predict there are a very small number (possibly zero) of persons reading this list that are both Excel coders and users of that package. You might consider posting it on

Re: [R] parallel processing with foreach

2012-10-25 Thread Peter Langfelder
It seems you don't quite understand how foreach works. foreach (..) %dopar% { ... } takes the last value from each of the second {...} evaluations and feeds them to the .combine function (in your case rbind()). Since your last call in the %dopar% {...} block is assign(), you are not getting anythin

Re: [R] mean of a value of the last 2 hours

2012-10-25 Thread arun
Hi, May be this helps:  new1<-with(myframe2,aggregate(cbind(Hunger,myframestime),by=list(ID=ID), function(x) mean(tail(x,2[,1:2]  merge(myframe2,new1,by="ID",all=TRUE) # ID Hunger.x    myframestime Hunger.y #1  Bert    2 2012-09-24 09:00:00  1.5 #2  Bert    2 2012-09-24 10:

Re: [R] help appending randomly selected observation based on criteria

2012-10-25 Thread csmeredith
Hello, I wrote a request yesterday on how to select a random observation that met certain criteria. I think mostly I have it figured out, but I can't figure out how to append the observations. The output just has one observation in it. Any help would be appreciated, thanks. Christy setwd ("C:

[R] Egarch (1,1) with Student t distribution in RExcel

2012-10-25 Thread Dheeraj Pandey
How Can I run all these codes in VBA using RExcel library(rugarch) spec=ugarchspec(variance.model=list(model="sGARCH",garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,1), arfima=FALSE), distribution.model="std") fit=ugarchfit(data=d, spec=spec) z=sigma(fit) Dheeraj [[alternative HT

Re: [R] After sorting a dataframe by date

2012-10-25 Thread MacQueen, Don
As David said, you sorted by Date. But sorting by rownames is not really the point. The point is that rownames are not line numbers. The rownames were assigned when the data frame was created, and then preserved when you sorted. Sometimes, rownames contain meaningful information that is associat

[R] trying ti use a function in aggregate

2012-10-25 Thread Sally_roman
Hi -I am using R v 2.13.0. I am trying to use the aggregate function to calculate the percent at length for each Trip_id and CommonName. Here is a small subset of the data. Trip_id Vessel CommonName Length Count 1 230SunlightShad,American 19 1 2 2

Re: [R] Expression in legend of plot

2012-10-25 Thread stat.kk
So easy solution..., thank you very much :) -- View this message in context: http://r.789695.n4.nabble.com/Expression-in-legend-of-plot-tp4647393p4647397.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing li

[R] Egarch (1,1) with Student t distribution in RExcel

2012-10-25 Thread Dheeraj Pandey
Hi I want to implement Egarch (1,1) with t distribution model using RExcel and VBA. May I know the syntax. Following is the code that I 'm using. rinterface.RRun "spec=ugarchspec(variance.model=list(model=(eGARCH),garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,1), arfima=FALSE), distribution.

[R] mean of a value of the last 2 hours

2012-10-25 Thread Tagmarie
Hello, I have a data frame somewhat like that: myframe <- data.frame (ID=c("Ernie", "Ernie", "Ernie", "Bert", "Bert", "Bert"), Timestamp=c("24.09.2012 09:00", "24.09.2012 10:00", "24.09.2012 11:00"), Hunger=c(1,1,1,2,2,1) ) myframestime <- as.POSIXct (strptime(as.character(myframe$Timestamp), "%

[R] Plot lmer model with Effects package

2012-10-25 Thread Marte Lilleeng
Hi everyone! I have a simple model that i would like to plot with 95% CIs. It is like follows: m1<-lmer(Richness~Grazing+I(Grazing^2)+(1|Plot),family=poisson) By using the effects package I get two plots, one for the linear term and one for the squared term. Q1: Can I get all in one? I.e. with one

Re: [R] List of multidimensional arrays

2012-10-25 Thread Richard M. Heiberger
Please use this model to send your data and code > mydata <- data.frame(x, y, fx, fy) > head(mydata) ## just the first 6 rows are displayed on screen x y fx fy 1 4 3 37 40 2 4 3 21 20 3 0 0 65 50 4 12 0 91 49 5 1 5 22 20 6 2 3 6 10 > dump("mydata", "") mydata <- structure(list(x = c(4, 4

Re: [R] List of multidimensional arrays

2012-10-25 Thread Richard M. Heiberger
With effort I re-inserted the line feeds in your code that the pdf file deleted. There is an error in your code Error in 0:(x[t == i][l]) (from #9) : NA/NaN argument > > x[t == i] [1] 8 2 9 > l [1] 4 > On Thu, Oct 25, 2012 at 7:45 AM, Loukia Spineli wrote: > x and y are the frequencies of missi

Re: [R] List of multidimensional arrays

2012-10-25 Thread Loukia Spineli
Thank you very much Berend!:) On Thu, Oct 25, 2012 at 4:37 PM, Berend Hasselman wrote: > Loukia, > > Please send your replies to the R-help list. I am CC'ing this to the > R-help list. > > On 25-10-2012, at 15:30, Loukia Spineli wrote: > > > Dear Berend, > > > > I am not familiar at all with as

Re: [R] List of multidimensional arrays

2012-10-25 Thread Berend Hasselman
Loukia, Please send your replies to the R-help list. I am CC'ing this to the R-help list. On 25-10-2012, at 15:30, Loukia Spineli wrote: > Dear Berend, > > I am not familiar at all with ascii text. If you could suggest me a good link > to learn about it, then it would be really helpful! If t

Re: [R] List of multidimensional arrays

2012-10-25 Thread Berend Hasselman
You were asked to provide R code in ascii text. Also use dput to get the objects into a mail. Nobody is going to make the effort to copy from your pdf. I certainly will not. Berend On 25-10-2012, at 13:45, Loukia Spineli wrote: > x and y are the frequencies of missing participants in the inter

Re: [R] How to quit R script & return to R prompt

2012-10-25 Thread S Ellison
> You typed a ` without closing it: > barplot(xtab(`profits`,data=Forbes2000)) > > anyway: pushing the escape button should also return you to > the R-prompt (at least on a Windows platform) But why is the OP using a backtick at all? It's not necessary in this instance (and in fact it's ver

Re: [R] cut point in ROC

2012-10-25 Thread Bhupendrasinh Thakre
Please use dput while supplying data. Best Regards, Bhupendrasinh Thakre Sent from my iPhone On Oct 25, 2012, at 5:31 AM, Soheila Khodakarim wrote: > var1 > > var2 > > var3 > > var4 > > var5 > > var6 > > var7 > > var8 > > var9 > > var10 > > gold > > 2 > > 3 > > 1 > > 2 > > 4 >

Re: [R] bugs and misfeatures in polr(MASS).... fixed!

2012-10-25 Thread tjb
This could well be out of date because I have not paid any attention to the official POLR code in a year or more. Attached is fixed-polr.R. cheers, Tim On Wed, Oct 24, 2012 at 10:38 PM, ahs [via R] < ml-node+s789695n4647311...@n4.nabble.com> wrote: > Great! > You can skip my question about s0 th

Re: [R] Expression in legend of plot

2012-10-25 Thread Bert Gunter
... and note that the "{" ,"}" are unnecessary: > plot(1, main = bquote(f^-1*(x))) -- Bert On Thu, Oct 25, 2012 at 4:32 AM, Rui Barradas wrote: > Hello, > > Use an asterisk to put a space between the exponent an (x). > > plot(1, main = expression(f^{-1}*(x))) > > Hope this helps, > > Rui Barr

Re: [R] problem in finding sizes of objects using a for loop

2012-10-25 Thread arun
Hi,  You can also use lapply() or sapply() without the get() function.  list1<-list(x=x,y=y)  sapply(list1,object.size) #    x y #80040   840  do.call(rbind,lapply(list1,object.size))   # [,1] #x 80040 #y   840 A.K. - Original Message - From: Jorge I Velez To: Purna chander

Re: [R] Kaplan Meier Post Hoc?

2012-10-25 Thread Terry Therneau
No, you didn't miss anything in the survival package. I've never found post-hoc tests interesting so have little motivation to add such (and a very long "to do" list of things I would like to add). If you simply must have them, why not do all pairwise tests? chisq <- matrix(0., 4,4) for (i in

Re: [R] List of multidimensional arrays

2012-10-25 Thread Loukia Spineli
x and y are the frequencies of missing participants in the intervention and the control treatment respectively! vector t contains the code of the interventions (we have 11 interventions). I re-attach the PDF with some small modifications. I am trying to create a list, where each list element is a v

Re: [R] Defining categories

2012-10-25 Thread arun
HI Petr, Thanks for sharing the function.  True, very efficient than cut. dat1$cat<-findInterval(dat1$V1, 1:6, rightmost.closed = T, all.inside = T)   ^^^  #  May be the interval is 0:6. dat1$cat1<-findInterval(dat1$V1, 1:6, rightmost.closed = T, al

Re: [R] Expression in legend of plot

2012-10-25 Thread Rui Barradas
Hello, Use an asterisk to put a space between the exponent an (x). plot(1, main = expression(f^{-1}*(x))) Hope this helps, Rui Barradas Em 25-10-2012 12:21, stat.kk escreveu: I would like to have an expression f^(-1)(x) in a legend of plot. For this I used expression(f^{-1}(x)), but variabl

Re: [R] [r] How to pick colums from a ragged array?

2012-10-25 Thread arun
Hi Stuart, So, I guess my result (below) serves the purpose! A.K. - Original Message - From: Stuart Leask To: arun Cc: Sent: Thursday, October 25, 2012 3:13 AM Subject: RE: [r] How to pick colums from a ragged array? Even confusing myself now, serves me right for replying late at n

Re: [R] equation solver

2012-10-25 Thread pina
Dear Berend, Many thanks for the advice. I'll try to work with these packages and I hope to find a solution. again, many thanks Pina. -- View this message in context: http://r.789695.n4.nabble.com/equation-solver-tp4647287p4647388.html Sent from the R help mailing list archive at Nabble.com.

[R] parallel processing with foreach

2012-10-25 Thread pxs101220
Hi, I am trying to parallel computing with foreach function, but not able to get the result. I know that in parallel processing, all result is collected in list format, but I am not able to get input there. Any help is really appreciated. esf.m <-foreach (i = 1:n.s, .combine=rbind) %dopar% {

[R] How to quit R script & return to R prompt

2012-10-25 Thread amiteshtiwari18
Hi can you please tell me how to quit R script & return to R prompt. As i tried following but still cannot able to return on to R prompt.. R> barplot(Forbes2000$profits) R> barplot(xtab(`profits,data=Forbes2000)) + barplot(xtab(~profits,data=Forbes2000)) + ) + Q() + ?barplots + + + + + barplo

[R] Expression in legend of plot

2012-10-25 Thread stat.kk
I would like to have an expression f^(-1)(x) in a legend of plot. For this I used expression(f^{-1}(x)), but variable is always in exponent. How could I change it in order to (x) be in a line, not in exponent? Thank you for your responses! -- View this message in context: http://r.789695.n4.na

Re: [R] How to quit R script & return to R prompt

2012-10-25 Thread Bart Joosen
you can see it goes wrong at: > barplot(xtab(`profits,data=Forbes2000)) You typed a ` without closing it: barplot(xtab(`profits`,data=Forbes2000)) anyway: pushing the escape button should also return you to the R-prompt (at least on a Windows platform) -- View this message in context: ht

Re: [R] [r] How to pick colums from a ragged array?

2012-10-25 Thread PIKAL Petr
Sorry, forgot to cc to rhelp Petr > -Original Message- > From: PIKAL Petr > Sent: Thursday, October 25, 2012 11:19 AM > To: 'Stuart Leask'; arun (smartpink...@yahoo.com) > Subject: RE: [r] How to pick colums from a ragged array? > > Hi > > If I understand correctly you now want only to

Re: [R] Changing radii line type in radial plots

2012-10-25 Thread Jim Lemon
On 10/25/2012 05:06 AM, bwone wrote: I am using the package plotrix radial.plot(). Yes, radial.plot() has a line type argument, lty, but that is for the polygons or the radial lines, not the radii or axes of the radial plot.unless I am doing something wrong. Hi bwone, No, there is no way to

[R] cut point in ROC

2012-10-25 Thread Soheila Khodakarim
var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 gold 2 3 1 2 4 0 1 4 4 3 2 2 4 2 4 3 4 2 4 4 4 2 3 3 0 0 4 1 0 2 4 4 2 1 4 0 3 2 0 0 2 4 4 2 3 4 0 2 2 0 0 0 3 4 2 2 2 3 2 2 0 0 0 2 4 2 2 4 1 1 2 0 0 3 3 3 2 3

Re: [R] correlated events in time series

2012-10-25 Thread Michael Weylandt
Yes, but you'll need to learn vector (multivariate) time series methods. See, perhaps firstly, B Pfaff's book and corresponding R packages. It's dense, but not too long and will get you going the right way. Terms like VAR and VECM will help guide your googling Michael On Oct 25, 2012, at 8:34

Re: [R] Defining categories

2012-10-25 Thread Jorge I Velez
Thank you Dr. Pikal for this alternative. Best, Jorge.- Sent from my phone. Please excuse my brevity and misspelling. On Oct 25, 2012, at 8:29 PM, PIKAL Petr wrote: > Hi > > Maybe also findInterval can be used > > dat1$cat<-findInterval(dat1$V1, 1:6, rightmost.closed = T, all.inside = T) > > It

[R] Regarding the memory allocation problem

2012-10-25 Thread Purna chander
Dear All, My main objective was to compute the distance of 10 vectors from a set having 900 other vectors. I've a file named "seq_vec" containing 10 records and 256 columns. While computing, the memory was not sufficient and resulted in error "cannot allocate vector of size 152.1Mb" So I

Re: [R] Defining categories

2012-10-25 Thread PIKAL Petr
Hi Maybe also findInterval can be used dat1$cat<-findInterval(dat1$V1, 1:6, rightmost.closed = T, all.inside = T) It is said to be more efficient than cut. Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of aru

  1   2   >