[R] Bubble chart

2012-03-21 Thread ens
I have a matrix of p-values for for each explanatory variable. Each row is an area of the response variable and each column is an explanatory variable. e.g. PSA pval_DOY pval_PDSIconcurrent pval_PDSIantecedent_annual_average pval_TMAXanomaly pval_FM100anomaly 1 NC06 0.96747495 0.60

Re: [R] Automaticall adjust axis scales

2012-03-21 Thread Jim Lemon
On 03/22/2012 05:42 AM, Alaios wrote: Would it be possible to change the axis at the end? My data sets seem to be quite large so I was thinking for the plot and the consequent lines to keep always the current minimum and maximum like plot(x) minimum=min(x) lines(x1) minimum=c(minimum,x1) lines(x2

[R] Any package recommended for time series graphics in R?

2012-03-21 Thread jpm miao
Hello, I would like to produce a few time series graphs with R. My data is usually quarterly or monthly. I sometimes need to have two y-axes, one at the left, the other right. Is there any toolbox producing nice looking time series graphs? Thanks, miao [[alternative HTML version d

[R] calling java from R and using java time series double precision array

2012-03-21 Thread Hurr
I haven't had time to try using R for over a year, but have a colleage who wants to. We work with time series and our current version of our calendar-time subroutines in java converts both directions between linear time and calendar. We have used calendar time since year 1965 starting out then wi

[R] read wiff extension files into R

2012-03-21 Thread Suyan Tian
Does anyone know how to read or import a wiff (AB SCIEX windows interchange file format) extension into R? Thanks a lot. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pro

Re: [R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread cberry
Mike Williamson writes: > Thanks Sarah, All, > > I guess I never thought of a negative sign as an "operation", but > knowing that it is considered an operation explains everything nicely. > Somewhere in it's underbelly, I suppose -4 is represented as "0 - 4"? Not exactly. Here is the list o

[R] Summary values from Glm function (rms package)

2012-03-21 Thread Yonghao
Dear fellow R-users, I’m using the Glm function (gamma family of distributions) from the rms package to compare 2 groups on costs data. Although the summary function does provide the mean cost difference and standard errors, I believe these values were in the (natural) log ratio format. Is there

[R] predict () for LDA and GLM

2012-03-21 Thread palanski
Hi! I'm using GLM, LDA and NaiveBayes for binomial classification. My training set is 70 rows long with 32 features, and my test set is 30 rows long with 32 features. Using Naive Bayes, I can train a model, and then predict the test set with it like so: ass4q1.dLDA = lda(ass4q1.trainSet[,1]~ass4

[R] Macro or Loop info/help needed

2012-03-21 Thread Jeff
I'm very new to R having recently made the transition from SPSS and SAS. In a dataset named t4, I have about 20 variables that are named in a somewhat chronological order - (e.g., q100ayr, q101ayr, q102ayr, q103ayr, etc.) Each variable contains a 2 digit year designation (e.g., 73

Re: [R] Reshape from long to wide

2012-03-21 Thread aly
Thanks a lot, I tried one of the ways you guys showed me and it totally work. Just for fun, I tried all the others and with some modifications here and there they work fine too. It was time consuming but definitely worth as a good learning experience. Thanks again -- View this message in context

[R] To overlay my raster and its boundary

2012-03-21 Thread Komine
Hi I want to overlay my raster and its boundary which is a shapefile. When I used thise code separately, all is ok: # Open raster >Image<-read.table("C:\\Users\\Documents\\Nouveau\\Frequence.txt",sep="",dec=",",header=TRUE) > >testo<-rasterFromXYZ(Image) >plot(testo) >testo2 <- aggregate

[R] Summary values from Glm function (rms package)

2012-03-21 Thread Yonghao
Dear fellow R-users, I’m using the Glm function (gamma family of distributions) from the rms package to compare 2 groups on costs data. Although the summary function does provide the mean cost difference and standard errors, I believe these values were in the (natural) log ratio format. Is there

Re: [R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread Bert Gunter
On Wed, Mar 21, 2012 at 5:21 PM, Mike Williamson wrote: > Thanks Sarah, All, > >    I guess I never thought of a negative sign as an "operation", but > knowing that it is considered an operation explains everything nicely. >  Somewhere in it's underbelly, I suppose -4 is represented as "0 - 4"? S

Re: [R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread Mike Williamson
Thanks Sarah, All, I guess I never thought of a negative sign as an "operation", but knowing that it is considered an operation explains everything nicely. Somewhere in it's underbelly, I suppose -4 is represented as "0 - 4"? Either way, I'm glad it is consistent & accurate, so that I didn't

Re: [R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread Rolf Turner
On 22/03/12 12:17, Sarah Goslee wrote: It's order of operations, and a good reason to always use parentheses: which is evaluated first, the unary minus or the raising-to-powers? (-4)^0.5 -(4^0.5) sqrt(-4) -sqrt(4) If the OP *really* wants the square root of -4 he could do sqrt(-4+0i) or (-4+0

Re: [R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread Sarah Goslee
It's order of operations, and a good reason to always use parentheses: which is evaluated first, the unary minus or the raising-to-powers? (-4)^0.5 -(4^0.5) sqrt(-4) -sqrt(4) Sarah On Wed, Mar 21, 2012 at 7:09 PM, Mike Williamson wrote: > Hi Everyone, > >    I did a search through the archives

[R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread Mike Williamson
Hi Everyone, I did a search through the archives and did not find an answer, although I must admit it is a hard search to do ( ^0.5 is tough to explicitly search for ). I am sure there is some mathematically accurate reason to explain the following, but I guess I either never learned it o

Re: [R] Using extract function for dates in sqldf

2012-03-21 Thread Gabor Grothendieck
On Wed, Mar 21, 2012 at 11:31 AM, wrote: > > I'm trying to use sqldf to query for the earliest date of a blood test when > patients have had multiple tests in a given year. My query looks like this: > > test11 <- sqldf("select CHILD_ID, min(SAMP_DATE) >                 from lab >                

Re: [R] Trouble installing the XML package

2012-03-21 Thread Sarah Goslee
The first thing to do is update your rather old version of R. If the 2.14 binaries aren't available for your your version of Ubuntu in the main repo, there are instructions here: http://cran.r-project.org/bin/linux/ubuntu/ If that still doesn't work, please provide the list with details of your sy

[R] fwdmsa package: Error in search.normal(X[samp, ], verbose = FALSE) : At least one item has no variance

2012-03-21 Thread Rob Cassidy
I'm using the fwdmsa package to identify deviant cases in a Mokken scale analysis. I've run into a problem., separate from the one I posted previously. The problem comes with items that are "easy" by IRT standards. A good scale should include a range of difficulties; yet when I include "easy" items

[R] fwdmsa package: Error in search.normal(X[samp, ], verbose = FALSE) : At least one item has no variance

2012-03-21 Thread Rob Cassidy
I'm using the fwdmsa package to identify deviant cases in a Mokken scale analysis. I've run into a problem., separate from the one I posted previously. The problem comes with items that are "easy" by IRT standards. A good scale should include a range of difficulties; yet when I include "easy" items

Re: [R] small scales in fwdmsa

2012-03-21 Thread Rob Cassidy
sorry I mistyped the "fs.MSA(by364.data)" in the previous post. -- View this message in context: http://r.789695.n4.nabble.com/small-scales-in-fwdmsa-tp4493479p4493490.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.o

[R] small scales in fwdmsa

2012-03-21 Thread Rob Cassidy
I'm using the fwdmsa package to identify deviant cases in a Mokken scale analysis. I've run into a problem. When I use scales comprising a few items, iI tend to get an error: Error in y[order(res[-msamp])][1:(length(samp) + 1 - length(msamp))] : only 0's may be mixed with negative subscripts I

[R] Trouble installing the XML package

2012-03-21 Thread Felix Jarman
Hello everyone, I am probably not the only one having trouble with this package but here goes. I want to install XML on Ubuntu. I installed libxml2-dev and everything works out fine until I get the following: Error in reconcilePropertiesAndPrototype(name, slots, prototype, superClasses, : No d

Re: [R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Weidong Gu
Hi Juliet, First of all, cv.glmnet is used to estimate lambda based on cross-validation. To get a glmnet prediction, you should use glmnet function which uses all data in the training set. Second, you constructed testX using a different data set (data.test.std) from one for glmnet predict (data.te

[R] multivariate ordinal probit regression vglm()

2012-03-21 Thread Trey Batey
Hello, all. I'm investigating the rate at which skeletal joint surfaces pass through a series of ordered stages (changes in morphology). Current statistical methods in this type of research use various logit or probit regression techniques (e.g., proportional odds logit/probit, forward/backward c

Re: [R] Doubts about mixed effect models

2012-03-21 Thread Bert Gunter
Post this on the r-sig-mixed=models list rather than here. However, fwiw, it is nonsense to estimate a random effect with a sample size of 3. That's trying to estimate variance with a sample size of 3. You can't do it with any meaningful precision. Whether or not the effect really **is** conceptua

[R] runif error - maximum limit?

2012-03-21 Thread Diann Prosser
Dear all, I am receiving the error below, I think because my n is exceeding the allowable limit for a vector. Can anyone confirm, and help with the following questions? The function and error: > stPte8 <- rtrunc(rnorm, nx * ny * nsimu, linf=0, mean=as.vector(PTmn), > sd=as.vector(PTsd)) Error in

Re: [R] Graphic legend with mathematical symbol, numeric variable and character variable

2012-03-21 Thread Peter Ehlers
Hi David, It's best to keep the mailing list in the loop so I'm cc-ing to R-help. I've rethought your problem and propose a different solution. The main problem is to create a vector of expressions to be used in the legend. (see https://stat.ethz.ch/pipermail/r-help/2011-February/270106.html)

[R] "cannot change working directory"

2012-03-21 Thread mela
Hi, I need to write program to run some results from an experiment. i have the results saved in 2 different files, named "tuesday" and "wednesday" (both located within the same file). when i wrote the program for "tuesday" i had no problem running it, but when i changed the work directory to wed

[R] How to create a function for a self created class.

2012-03-21 Thread ankit.sethi
Hi, I need to create a method for a class named 'simpleOLS' which I have created that will compute the coefficients of predictors. Here is my code: #-

[R] Doubts about mixed effect models

2012-03-21 Thread Lívia Dorneles Audino
Hi everyone! I have some doubts about mixed effect models and I hope someone could help me. I´m trying to analyze a dataset coming from samples of dung beetles in the same forest fragments along 3 consecutive years (1994, 1995 and 1996) and 14 years after (2010). I sampled dung beetles in 18 dif

Re: [R] "cannot change working directory"

2012-03-21 Thread mela
thanks Michael and William, I have resigned to moving the wednesday in to the tuesday file and keeping tuesday as the work directory. this seemed to solve the problem, but i think that also means that i do have permission to access the wednesday file. i don't quite understand what went wrong, but

[R] Assign names to the assets in portfolio frontier plot. Using frontierPlot fPortfolio.

2012-03-21 Thread PaulK
Hi, I have troubles to assign names to the assets in the portfolio frontier plot using frontierPlot() in fPortfolio package. Can anyone please help me? If I use tailoredFrontierPlot in fPortfolio the assets assign names but I dont want to plot capital market line e.t.c. Someone maybe know how to d

Re: [R] anova.lm F test confusion

2012-03-21 Thread Bert Gunter
Michelle: You need to work with someone locally who understands basic statistics, as you are clearly out of your depth. Posting to this list is highly unlikely to meet your needs, nor is this an appropriate place or means to learn statistics -- it's for help on R. (Yes, they do overlap, but it is

[R] Error in file(file, "rt") : cannot open the connection

2012-03-21 Thread djhayes
Hi there, I migrated from Windows7 to Ubuntu (11.10) and am trying to get my R back online. I've switched from Tinn-R to RKWard which seems to work well. My problem at the moment is that I'm no longer able to read in the data file I was working on before. > popafr <- read.table(file="~/Do

Re: [R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Juliet Hannah
Oops. Coefficients are returned on the scale of the original data. testX <- cbind(1,data.test) yhat2 <- testX %*% beta # works plot(yhat2,yhat_enet) On Wed, Mar 21, 2012 at 2:35 PM, Juliet Hannah wrote: > All, > > For my understanding, I wanted to see if I can get glmnet predictions > using

Re: [R] Automaticall adjust axis scales

2012-03-21 Thread Alaios
Would it be possible to change the axis at the end? My data sets seem to be quite large so I was thinking for the plot and the consequent lines to keep always the current minimum and maximum like   plot(x) minimum=min(x) lines(x1) minimum=c(minimum,x1) lines(x2)minimum=c(minimum,x2) then if there

[R] glmnet: obtain predictions using predict and also by extracting coefficients

2012-03-21 Thread Juliet Hannah
All, For my understanding, I wanted to see if I can get glmnet predictions using both the predict function and also by multiplying coefficients by the variable matrix. This is not worked out. Could anyone suggest where I am going wrong? I understand that I may not have the mean/intercept correct,

Re: [R] Type II and III sum of squares (R and SPSS)

2012-03-21 Thread peter dalgaard
On Mar 21, 2012, at 11:27 , Marco Tommasi wrote: > To whom it may concern > > I made some analysis with R using the command Anova. However, I found > some problmes with the output obtained by selecting type II o type III > sum of squares. Well, it would primarily concern the maintainer of the

Re: [R] Unable to specify order of a factor

2012-03-21 Thread David Winsemius
On Mar 21, 2012, at 1:07 PM, Justin Montemarano wrote: Hi all: I've got it... it appears that total.density was also defined in two separate data frames (se.predict.data and dc.predict.data) with levels order 16, 32, 8. Using relevel(), I moved 8 to the first position and it's solved the pl

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
Hi all: I've got it... it appears that total.density was also defined in two separate data frames (se.predict.data and dc.predict.data) with levels order 16, 32, 8. Using relevel(), I moved 8 to the first position and it's solved the plotting problem. Ista's 'minimal' reproducible code request pr

Re: [R] "cannot change working directory"

2012-03-21 Thread R. Michael Weylandt
list.dirs() will list the directories in that file exactly as R sees them. If you are getting can't change working directory messages I can only think of two reasons: i) File permissions (though that's unlikely to get messed up unless there's someone around who knows how to do that in the first pl

Re: [R] Check results between two data.frame

2012-03-21 Thread Sarah Goslee
On Wed, Mar 21, 2012 at 12:48 PM, HJ YAN wrote: > Thanks a lot Sarah, for your nice example and code. > > I know '==' can do the work.  Just as a R beginer, sometimes really want to > be more like a 'real programmer', if you know what I mean... Being a "real programmer" means using one line of co

Re: [R] Unable to specify order of a factor

2012-03-21 Thread R. Michael Weylandt
You'll also want to use dput() to send us an exact encoding of your data when making that reproducible example: there might be something subtle at play here that print methods won't show. Michael On Wed, Mar 21, 2012 at 12:28 PM, Ista Zahn wrote: > On Wed, Mar 21, 2012 at 12:00 PM, Justin Montem

Re: [R] passing xlim to coord_map in ggplot2

2012-03-21 Thread Ista Zahn
Hi Zack, This works as expected on my machine: tank_trunc <- read.csv("http://r.789695.n4.nabble.com/file/n4492267/upton_tank_trunc_nabble.csv";) michigan_map.df <- map_data('county', 'michigan') ggplot() + geom_point(aes(lon, lat), data = tank_trunc, na.rm = T) + geom_path(aes(long, lat, grou

Re: [R] Forloop/ifelse program problem and list of dataframes

2012-03-21 Thread Ivan Calandra
Hi Ian, I haven't read in details because you don't provide a reproducible example (see ?dput) but you might want to take a look at the aggregate() and doBy::summaryBy() functions. HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Di

Re: [R] "cannot change working directory"

2012-03-21 Thread R. Michael Weylandt
If you are on a mac, you don't need to escape spaces within setwd(): e.g., on my machine, setwd("~/Desktop/Current Semester") works just fine. Michael On Wed, Mar 21, 2012 at 12:08 PM, mela wrote: > Hi, > > I need to write  program to run some results from an experiment. i have the > results sa

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Ista Zahn
On Wed, Mar 21, 2012 at 12:00 PM, Justin Montemarano wrote: > Ista: > > Your attached code did work for me; moreover, the facets were presented in > the desired order with facet_wrap() and facet_grid(), which is what I'm > using because I have a second factor used in facet_grid(). > > Still, my pl

Re: [R] list of matrices

2012-03-21 Thread R. Michael Weylandt
You probably want mylist[[i]] = function(...) in your loop. Similarly, when you want them again later, you need to use double square brackets. I once heard a useful metaphor for understanding the difference between [ and [[ when it comes to lists. If x (a list) is a train, then x[2] is the sec

Re: [R] "cannot change working directory"

2012-03-21 Thread R. Michael Weylandt
Scratch that -- while true, it doesn't seem to cause that error message. Can you do this? list.dirs("/Users/user/Desktop/Recorded results/") Also, are you sure you have various access permissions to the Wednesday folder? Michael On Wed, Mar 21, 2012 at 12:25 PM, R. Michael Weylandt wrote: > I

Re: [R] list of matrices

2012-03-21 Thread Sarah Goslee
Use mylist[[i]] = function(...) mylist[i] and mylist[[i]] are two different things. On Wed, Mar 21, 2012 at 11:08 AM, David Zastrau wrote: > Hello dear R-users, > > I am currently trying to fill some datasatructure (array, list, hash...) > with matrices that are calculated by a function and do v

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-21 Thread Dominic Comtois
Hi again, As a follow-up question... If I need to calculate a risk difference with a CI, I imagine the solution would be similar? Here's how I would get the point estimate: x1 <- factor(rbinom(100,1,.5),levels=c(0,1)) x2 <- factor(round(runif(100,1,2)),levels=c(1,2),labels=c("cat1","cat2")) outco

[R] "cannot change working directory"

2012-03-21 Thread mela
Hi, I need to write program to run some results from an experiment. i have the results saved in 2 different files, named "tuesday" and "wednesday" (both located within the same file). when i wrote the program for "tuesday" i had no problem running it, but when i changed the work directory to wedn

Re: [R] passing xlim to coord_map in ggplot2

2012-03-21 Thread z2.0
The first block of code should be reproducible. For the second block, you need only a data.frame. I've included a few rows from the one I'm working with. Two required libraries: maps, ggplot2. http://r.789695.n4.nabble.com/file/n4492267/upton_tank_trunc_nabble.csv upton_tank_trunc_nabble.csv --

Re: [R] Check results between two data.frame

2012-03-21 Thread Sarah Goslee
As long as == is an appropriate test for your data, why not just use R's innate ability to handle matrices/data frames? > x1 <- matrix(1:20, ncol=4) > x2 <- ifelse(x1 > 18, 22, x1) > x1 [,1] [,2] [,3] [,4] [1,]16 11 16 [2,]27 12 17 [3,]38 13 18 [4,]4

[R] list of matrices

2012-03-21 Thread David Zastrau
Hello dear R-users, I am currently trying to fill some datasatructure (array, list, hash...) with matrices that are calculated by a function and do vary in size: mylist = list() for(i in 1:n) mylist[i] = function(...) # returns a matrix print(mylist[1]) # prints only the first element of

Re: [R] glm.fit: fitted probabilities numerically 0 or 1 occurred?

2012-03-21 Thread ufuk beyaztas
Dear Ellison, Many thanks for your reply. The information you typed is clear and now I know what to do. Your suggestion about finding some coffee while running simulation is so good =) Regards - Best regards Ufuk -- View this message in context: http://r.789695.n4.nabble.com/glm-fit-fitt

[R] how to decide best order for ma(x, order, centre=TRUE) in time series

2012-03-21 Thread sagarnikam123
when fitting an autoregressive time series model to the data i.e. in function ma(x, order, centre=TRUE) i attached file (time series data) http://r.789695.n4.nabble.com/file/n4491858/tinku.txt tinku.txt how to decide best order for a good time series model which would be valuable for arma() proces

[R] Multinomial Logit data arrangement

2012-03-21 Thread sakchai
Dear all, I am having a hard time attempting to do a multinomial logit modeling in R. I am trying to analyze a dataset whereby there are 3 scenarios with 4 difference choice parameters. In particular – I am having a hard time arranging this into a .csv format. What sorts of headings should I pu

Re: [R] rJava / RCMD javareconf fails

2012-03-21 Thread st0ut717
solved grrr I had to set JAVA_HOME to point to the jdk directory not the parent. This had to be done as root not user otherwise the rJava is fails. At the end of the day its installed. -- View this message in context: http://r.789695.n4.nabble.com/rJava-RCMD-javareconf-fails-tp4488961p44

Re: [R] anova.lm F test confusion

2012-03-21 Thread msteane
What if the model isn't nested, i.e. I want to test y=x+w vs y=x+z+v. Is there a valid test/method to compare these (other than comparing R squared values)? They are both multiple regression models. -- View this message in context: http://r.789695.n4.nabble.com/anova-lm-F-test-confusion-tp44

[R] Check results between two data.frame

2012-03-21 Thread HJ YAN
Dear R-user, I'm trying to compare two sets of results and wanted to find out which element in the two data frame/matrix are different. I wrote the following function and it works ok, and gives me a long list of "good" as outcomes. CHECK<- function (x = "file1", y = "file2") { for (i in 1:n

Re: [R] Not colour but symbols

2012-03-21 Thread Komine
Hi Thank you Bert and Thomas for your help, I did what I wanted with this code. >test<-c(4,8,9,6,7) >barplot(test,density =20,angle=45) But I want to cross the lines in each bar. Please, how to do it? Thank you in advance. -- View this message in context: http://r.789695.n4.nabble.com/Not-colo

[R] Multinomial Logit data arrangement

2012-03-21 Thread sakchai
Dear all, I am having a hard time attempting to do a multinomial logit modeling in R. I am trying to analyze a dataset whereby there are 3 scenarios with 4 difference choice parameters. In particular – I am having a hard time arranging this into a .csv format. What sorts of headings should I pu

[R] nlme error on dimensions in multiplication

2012-03-21 Thread Thomas Wutzler
Hello R users, When trying to fit a nonlinear mixed model to a respiration time series, I get the following error message: Error in recalc.varFunc(object[[i]], conLin) : dims [product 30] do not match the length of object [34] In addition: Warning message: In conLin$Xy * varWeights(object) :

Re: [R] No its not working, how to calculate best p order value for arma process

2012-03-21 Thread sagarnikam123
> ts<-ts(bhavar$V1) > decompose(ts) Error in decompose(ts) : time series has no or less than 2 periods > HoltWinters(ts) Error in decompose(ts(x[1L:wind], start = start(x), frequency = f), seasonal) : time series has no or less than 2 periods is it true that order of ar(ts) function is p-value

[R] Type II and III sum of squares (R and SPSS)

2012-03-21 Thread Marco Tommasi
To whom it may concern I made some analysis with R using the command Anova. However, I found some problmes with the output obtained by selecting type II o type III sum of squares. Briefly, I have to do a 2x3 mixed model anova, wherein the first factor is a between factor and the second factor

[R] Solving ODE via deSolve and optimizing best parameter values.

2012-03-21 Thread mhimanshu
Hello Everyone, I have just started with deSolve package, I have a set of ODE equation with few parameters, for example dy/dx = a1*Y*(1-Y/Ymax) - a2*(Y+0.001) and dz/dt = a3*Y- a4*Z; I have the initial values of Y, Z and a1,a2,a3 are my parameters, Now my main objective is to find the solve the eq

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
Ista: Your attached code did work for me; moreover, the facets were presented in the desired order with facet_wrap() and facet_grid(), which is what I'm using because I have a second factor used in facet_grid(). Still, my plots with total.density as a facet are coming out in 16, 32, 8, and I'm no

[R] Forloop/ifelse program problem and list of dataframes

2012-03-21 Thread Ian Craig
Hello R Community, I don't post to these things often so excuse me if I stumble on my forum etiquette. This is a complex problem for me, which may require two forum entries, but I will try my best to be concise. Also, I am a self taught coder, so if my code is not to convention, your constructi

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Ista Zahn
Hi Justin, this gives the correct order (8, 16, 32) on my machine: total.density <- c(8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32) total.density <- f

Re: [R] glm.fit: fitted probabilities numerically 0 or 1 occurred?

2012-03-21 Thread Ted Harding
On 21-Mar-2012 S Ellison wrote: >> I get the errors; >> glm.fit: fitted probabilities numerically 0 or 1 occurred and >> glm.fit: algorithm did not converge >> . >> Is there any way to to >> fix this problem? > > There are two separate issues. > One is the appearance of fitted values at 0 or

[R] Using extract function for dates in sqldf

2012-03-21 Thread Michael . Laviolette
I'm trying to use sqldf to query for the earliest date of a blood test when patients have had multiple tests in a given year. My query looks like this: test11 <- sqldf("select CHILD_ID, min(SAMP_DATE) from lab group by CHILD_ID having extract (ye

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
I think I understand, but I believe my original interest is in the order of levels(total.density), since ggplot appears to be using that to order the facets. Thus, I'm still getting three graphs, ordered (and displayed as) 16 to 32 to 8, rather than the more intuitive, 8 to 16 to 32. I'm sorry if

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Sarah Goslee
Ah, you're missing something crucial: > levels(total.density) [1] "8" "16" "32" is giving you the *labels* of the factor, as *strings*, and what you get if you use order() on them has nothing to do with the order of the factor levels, and everything to do with the string sort order for your loca

Re: [R] AIC models are not all fitted to the same number of observation

2012-03-21 Thread Patrick Giraudoux
Le 21/03/2012 10:56, Patrick Giraudoux a écrit : Hi, Using lme from the package nlme 3.1-103, I meet a strange warning. I am trying to compare to models with: library(nlme) lmez6=lme(lepus~vulpes,random=~1|troncon/an,data=ika_z6_test) lmez60=lme(lepus~1,random=~1|troncon/an,data=ika_z6_test)

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
Actually I've try that too, Sarah The test is to run order(levels(total.density)), which I need to be 1 2 3, not 2 3 1, and your solution still gives me 2 3 1. I also don't know how to reply to this thread with the previous message below... - Justin Montemarano Graduate Student Kent State Uni

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Sarah Goslee
Is this what you need? > total.density <- + c(8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32) > total.density <- factor(total.density, levels=c(8, 16, 3

[R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
Hi all: I'm attempting to create a faceted plot with ggplot2 and I'm having issues with a factor's order that is used to define the facet_grid(). The factor (named total.density) has three levels - 8, 16, and 32 - and I would like them presented in that order. Running order(levels(total.density)

Re: [R] glmnet() vs. lars()

2012-03-21 Thread Patrick Breheny
On 03/21/2012 06:30 AM, Vito Muggeo (UniPa) wrote: It appears that glmnet(), when "selecting" the covariates entering the model, skips from K covariates, say, to K+2 or K+3. Thus 2 or 3 variables are "added" at the same time and it is not possible to obtain a ranking of the covariates according t

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread S Ellison
> -Original Message- > Okay, try this: > > result <- with(data, > aggregate(data[,-(1:2)], by=list(ID), FUN=diff)) > > This assumes that the dataframe is sorted as in your example. > If that's not the case, then use order to arrange it first: A caveat: order and s

[R] resetting console

2012-03-21 Thread Ben quant
Hello, I'm still hoping my issue is preventable and not worthy of a bug/crash report, hence my post is in 'help'. Anyway, I'd like to know how to reset the console so it is clear of all residual effects caused by previous scripts. Details: I run a script once and it runs successfully (but very sl

Re: [R] How to do 2SLS in R

2012-03-21 Thread Priya . Saha
thanks Arne and Achim will surely use the forum on systemfit at RForge for further clarification regrads Priya . From: Arne Henningsen To: Achim Zeileis , priya.s...@zycus.com, r-help@r-project.org Date: 21-03-2012 18:35 Subject:Re: [R] How to do 2SLS in R On

Re: [R] Reshaping data from long to wide without a "timevar"

2012-03-21 Thread Paul Miller
Hello All, Tried some more Internet searches and came to the conclusion that one probably does need to create a "timevar" before reshaping from long to wide. Below is some code that creates the "timevar" and transposes the data. connection <- textConnection(" 005 1 Gemcitabine 005 2 Erlotinib

Re: [R] How to do 2SLS in R

2012-03-21 Thread Arne Henningsen
On 21 March 2012 09:32, Achim Zeileis wrote: > On Wed, 21 Mar 2012, priya.s...@zycus.com wrote: >> Hi List >> I want to carry out structural mode. Following Example l have taken from >> Basic Econometrics- Damodar Gujarati : > > Look at the "systemfit" package. For an introduction see the accompan

Re: [R] Error in fitdist- mle failed to estimate parameters

2012-03-21 Thread Ben Bolker
vinod1 gmail.com> writes: > I am trying fit certain data into Beta distribution. I get the error saying > "Error in fitdist(discrete_random_variable_c, "beta", start = NULL, fix.arg > = NULL) : the function mle failed to estimate the parameters, with the > error code 100" > > Below is the so

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread Peter Ehlers
Here's the plyr way I should have thought of earlier: require(plyr) ddply(data, "ID", numcolwise(diff)) Still requires your data to be ordered. Peter Ehlers On 2012-03-21 04:51, Eik Vettorazzi wrote: Hi Sylvain, assuming your data frame is ordered by ID and TIME, how about this aggregate(c

Re: [R] Graphic legend with mathematical symbol, numeric variable and character variable

2012-03-21 Thread Peter Ehlers
On 2012-03-20 06:09, "ECOTIÈRE David (Responsable d'activité) - CETE Est/LRPC de Strasbourg/6 Acoustique" wrote: Hi, I'd like to make a legend with a mix of mathematical symbol (tau), numeric variable and character variables.I have tried : types<-c("Type 1","Type 2","Type 2") tau<-c(1,3,2) leg

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread Eik Vettorazzi
Hi Sylvain, assuming your data frame is ordered by ID and TIME, how about this aggregate(cbind(X,Y)~ID,data, function(x)(x[2]-x[1])) #or doing this for all but the first 2 columns of data: aggregate(data[,-(1:2)],by=list(data$ID), function(x)(x[2]-x[1])) cheers. Am 21.03.2012 09:48, schrieb wph

Re: [R] glm.fit: fitted probabilities numerically 0 or 1 occurred?

2012-03-21 Thread S Ellison
> I get the errors; > glm.fit: fitted probabilities numerically 0 or 1 occurred and > glm.fit: algorithm did not converge > . > Is there any way to to > fix this problem? There are two separate issues. One is the appearance of fitted values at 0 or 1. The other is the lack of convergence.

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread wphantomfr
Okay, try this: result <- with(data, aggregate(data[,-(1:2)], by=list(ID), FUN=diff)) That's it !! I didn't knew the "diff" function. Your solution works perfectly. Thanks Peter for this ! Sylvain Le 21/03/12 12:01, Peter Ehlers a écrit : On 2012-03-21 03:37, wphantomf

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread Peter Ehlers
On 2012-03-21 03:37, wphantomfr wrote: Thanks peter for your fast answer. your is really nice but if I have say 20 variables I have to write 20 statements like "DIF.X = X[TIME=="T2"] - X[TIME=="T1"]". Does someone has a trick to avoid this ? It may not be easily possible. Okay, try this: r

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread wphantomfr
Thanks peter for your fast answer. your is really nice but if I have say 20 variables I have to write 20 statements like "DIF.X = X[TIME=="T2"] - X[TIME=="T1"]". Does someone has a trick to avoid this ? It may not be easily possible. Regards Sylvain Clément Le 21/03/12 11:03, Peter Ehle

[R] glmnet() vs. lars()

2012-03-21 Thread Vito Muggeo (UniPa)
dear all, It appears that glmnet(), when "selecting" the covariates entering the model, skips from K covariates, say, to K+2 or K+3. Thus 2 or 3 variables are "added" at the same time and it is not possible to obtain a ranking of the covariates according to their importance in the model. On t

Re: [R] anova.lm F test confusion

2012-03-21 Thread peter dalgaard
On Mar 21, 2012, at 09:04 , Rolf Turner wrote: > On 21/03/12 20:19, Gerrit Eichner wrote: >> Dear Ben, or anybody else, of course, >> >> I'd be grateful if you could point me to a reference (different from ch. 4 >> "Linear models" in "Statistical Models in S" (Chambers & Hastie (1992))) >> reg

Re: [R] how calculate seasonal component & cyclic component of time series?

2012-03-21 Thread Berend Hasselman
On 21-03-2012, at 08:10, sagarnikam123 wrote: > i am new to time series,whatever i know up till now,from that > i have uploaded time series file & what to build arma model,but for that i > want p & q values(orders) > tell me how to calculate best p & q values to find best AIC values for model >

Re: [R] Best way to compute the difference between two levels of a factor ?

2012-03-21 Thread Peter Ehlers
On 2012-03-21 01:48, wphantomfr wrote: Dear R-help Members, I am wondering if anyone think of the optimal way of computing for several numeric variable the difference between 2 levels of a factor. To be clear let's generate a simple data frame with 2 numeric variables collected for different

[R] AIC models are not all fitted to the same number of observation

2012-03-21 Thread Patrick Giraudoux
Hi, Using lme from the package nlme 3.1-103, I meet a strange warning. I am trying to compare to models with: library(nlme) lmez6=lme(lepus~vulpes,random=~1|troncon/an,data=ika_z6_test) lmez60=lme(lepus~1,random=~1|troncon/an,data=ika_z6_test) Both have the same number of observations and gr

Re: [R] Loading Dataset into R continual issue

2012-03-21 Thread Paul Hiemstra
On 03/21/2012 06:35 AM, bobo wrote: > Thank you. I was able to get it loaded however when I tried to run > > mod1<-lm(Pat2006~FHouse) > I got > Error in eval(expr, envir, enclos) : object 'Pat2006' not found > > What exactly is occurring here? > > -- > View this message in context: > http://r.7896

  1   2   >