Re: [R] GLM Question

2009-12-03 Thread Peter Flom
Knut Krueger r...@krueger-family.de wrote I think this is more an general question to GLMs. The result was better in all prior GLMs when I admitted the non significant factors, but this is the first time that the result is worse than before. What could be the reason for that?

Re: [R] Histogram probabilities 1 ????!!!

2009-12-02 Thread Peter Flom
Trafim rdapam...@gmail.com wrote well, I definitely don't understand anything. Why the hist function with freq=FALSE gives such a strange result??? R - c(-1.10, 0.79, -1.17, -0.53, -0.26, -0.22, 0.29, -0.26, -0.26, 0.39) hist(R, freq=FALSE, breaks=10) The total AREA has to equal 1, which

[R] Finding cases in one subset that are closet to another subset

2009-12-02 Thread Peter Flom
Good afternoon Running R2.10.0 on Windows I have a data frame that includes (among much else) a factor (In_2006) and a continuous variable (math_3_4). I would like to find the 2 cases for In_2006 = 0 that are closest to each case where In_2006 = 1. My data looks like In_2006 math_3_4

Re: [R] Finding cases in one subset that are closet to another subset

2009-12-02 Thread Peter Flom
David Winsemius dwinsem...@comcast.net wrote On Dec 2, 2009, at 3:01 PM, Peter Flom wrote: Good afternoon Running R2.10.0 on Windows I have a data frame that includes (among much else) a factor (In_2006) and a continuous variable (math_3_4). I would like to find the 2 cases

Re: [R] Finding cases in one subset that are closet to another subset

2009-12-02 Thread Peter Flom
Thanks Chuck I did not know about that MatchIt. I will check it out Peter -Original Message- From: Chuck Cleland cclel...@optonline.net Sent: Dec 2, 2009 3:47 PM To: Peter Flom peterflomconsult...@mindspring.com Cc: r help r-help@r-project.org Subject: Re: [R] Finding cases in one

Re: [R] calling R from sas

2009-11-29 Thread Peter Flom
Arnab Maity arnab_ma...@isb.edu wrote I like to call R from SAS. Could you please help me? There are two methods that I know of: 1) Phil Rack has written a program called A Bridge to R see: http://minequest.com/WordPress/?p=102 2) If you have SAS/IML licensed, you can link to R through

[R] Stat question mixed models with time varying covariate

2009-11-12 Thread Peter Flom
Please xcuse me for being slightly off-topic and cross-posting I have a data set of schools, with scores for 4 years. The goal is to evaluate the effect of an intervention on the scores, accounting for some covariates which are not problematic. The chief problem is that the intervention could

[R] Windows 7 editor - I can't make RWinEdt work

2009-11-08 Thread Peter Flom
Good morning I just got a new computer with Windows 7. R works fine, but the editor I am used to using RWinEdt does not. I did find one blog post on how to get RWinEdt to work in Windows 7, but I could not get those instructions to work either. Is there a patch for RWinEdt? If not, is

[R] Variable selection in NLME or LME4

2009-11-04 Thread Peter Flom
Good morning I am learning about NLME and LME4, using Pinheiro and Bates and other materials from Douglas Bates, but I have not seen anything on how to do variable selection sensibly in this type of model. In OLS regression, I frequently use the lasso, but googling did not reveal a method for

Re: [R] qqplot

2009-11-02 Thread Peter Flom
David Winsemius dwinsem...@comcast.net wrote I always assumed that the intercept was zero and the slope = unity. y - rt(200, df = 5) qqnorm(y); qqline(y, col = 2) qqplot(y, rt(300, df = 5)) abline(0, 1, col=red) Suppose you have the following x - rnorm(500) y - 500*(x + runif(500,

Re: [R] qqplot

2009-11-02 Thread Peter Flom
carol white wht_...@yahoo.com wrote So the conclusion is that abline(0,1) should always be used and if it doesn't go through the qqplot, the two distributions are not similar? I think it depends what you mean by similar. E.g., if you mean are both of these distributions (e.g.) normal? then

Re: [R] qqplot

2009-11-02 Thread Peter Flom
John Fox j...@mcmaster.ca wrote I assumed that Carol wanted to compare the shapes of the distributions and to adjust for differences in centre and spread. To put a line through the quartiles or to base a line on the medians and IQRs is more robust than using the means and sds. Hi John Indeed it

Re: [R] qqplot

2009-11-02 Thread Peter Flom
Peter Ehlers ehl...@ucalgary.ca wrote That's not what qqline() does and for good reason - it treats x and y asymmetrically. But qqline() is a very simple function, using the quartiles as also suggested by John. Here's a modified version that should work for Carol: qqline2 - function (x, y, ...)

Re: [R] Invert the sign of a number

2009-10-29 Thread Peter Flom
Fran100681 franar...@hotmail.it wrote just a simple question How can I do to invert the sign of a number? (for example: -4 to 4, 2 to -2 and so on..) I was looking for a specific function in R but I didn't found it... thank you Is there something wrong with *-1 ? Peter Peter L. Flom, PhD

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Peter Flom
Ravi Varadhan rvarad...@jhmi.edu wrote I have heard this (i.e. only head-to-head comparisons are valid) and various other folklores about AIC and BIC based model selection before, including one that these information criteria are only applicable for comparing two nested models. Where has it

Re: [R] Boxplot with grouped data

2009-10-22 Thread Peter Flom
Paul Smith phh...@gmail.com wrote Is there some way of drawing a boxplot, with R, when one does not have the original continuous data, but only the data grouped in classes? The function boxplot() can only deal with original data. It's not clear how the data are, now. What are the classes? Are

Re: [R] Bayesian regression stepwise function?

2009-10-22 Thread Peter Flom
Frank E Harrell Jr f.harr...@vanderbilt.edu wrote Ben Bolker wrote: Allan.Y wrote: Hi everyone, I am wondering if there exists a stepwise regression function for the Bayesian regression model. I tried googling, but I couldn't find anything. I know step function exists for regular

[R] Question on mixed effect models with LME

2009-10-21 Thread Peter Flom
Good afternoon Using R 2.9.2 on a machine running Windows XP I have a longitudinal data set, with data on schools and their test scores over a four year period. I have centered year, and run the following m1.mod1 - lme(fixed = math_1 ~ I(year-2007.5)*TFC_, data = long,

[R] Missing data and LME models and diagnostic plots

2009-10-21 Thread Peter Flom
Hello Running R2.9.2 on Windows XP I am puzzled by the performance of LME in situations where there are missing data. As I understand it, one of the strengths of this sort of model is how well it deals with missing data, yet lme requires nonmissing data. Thus, m1.mod1 - lme(fixed =

Re: [R] Missing data and LME models and diagnostic plots

2009-10-21 Thread Peter Flom
I wrote I am puzzled by the performance of LME in situations where there are missing data. As I understand it, one of the strengths of this sort of model is how well it deals with missing data, yet lme requires nonmissing data. Mark Difford replied You are confusing missing data with

[R] A question about digest mode

2009-07-10 Thread Peter Flom
Good morning I recently shifted to digest mode; I get the digest each day (sometimes two in a day) and when I open the first file it opens as a text file with a list of topics; but then it is hard to find the right message. In a list of 100 or so links, counting to find link number 53 or

Re: [R] SAS-like method of recoding variables?

2009-06-23 Thread Peter Flom
Dieter Menne wrote: IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2); vehicles - ifelse(TYPE=='TRUCK' count=12, TRUCK+((CAR+BIKE)/2.2), NA) Read both versions to an audience, and you will have to admit that this is one of the cases where SAS is superior. And Peter

Re: [R] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Peter Flom
Carlos J. Gil Bellosta c...@datanalytics.com wrote I had a conversation with a guy working in a business intelligence department at a major Spanish bank. They rely on recursive partitioning methods to rank customers according to certain criteria. They use both SAS EM and Salford Systems' CART.

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
Patrick Burns pbu...@pburns.seanet.com wrote Proposal That a new mailing list be established that pertains exclusively to R documentation. The purpose of the list would be to discuss weak sections of the documentation and establish fixes for those weak spots. Pro If it works, there would be

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
to faxing) Peter Flom peterflomconsult...@mindspring.com 6/14/2009 7:05 AM Patrick Burns pbu...@pburns.seanet.com wrote Proposal That a new mailing list be established that pertains exclusively to R documentation. The purpose of the list would be to discuss weak sections of the documentation

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
I certainly don't have anything against the WIKI, but I think that the documentation is where the action is, especially for newbies. It's the natural first step when you want to learn about a function or when you get an error message you don't understand. Peter Peter L. Flom, PhD

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
Well, suppose I wanted to suggest changes to some documentation, or write an alternate help file for some function. Where would I put it? Let's say I type, in R, ?median. Now suppose I have suggestions. If I look at http://wiki.r-project.org/rwiki/doku.php?id=idx=rdoc:base I don't see the

Re: [R] Insignificant variable improves AIC (multinom)?

2009-06-13 Thread Peter Flom
Werner Wernersen pensterfuz...@yahoo.de wrote Hi, I am trying to specify a multinomial logit model using the multinom function from the nnet package. Now I add another independent variable and it halves the AIC as given by summary(multinom()). But when I call Anova(multinom()) from the car

Re: [R] Comparing model fits for NLME when models are not nested

2009-06-12 Thread Peter Flom
Lindsay Banin l.bani...@leeds.ac.uk wrote Hi there, I am looking to compare nonlinear mixed effects models that have different nonlinear functions (different types of growth curve)embedded. Most of the literature I can find focuses on comparing nested models with likelihood ratios and AIC. Is

Re: [R] (no subject)

2009-06-06 Thread Peter Flom
Christophe Genolini cgeno...@u-paris10.fr wrote Thanks for yours answers. So if I understand: - Trajectories are continuous, the other are discrete. - The difference between time series and longitudinal is that time series are made at regular time whereas longitudinal are not ? - Repeated

Re: [R] Constraining linear regression model

2009-05-23 Thread Peter Flom
Jean-Paul Kibambe Lubamba jean-paul.kiba...@uclouvain.be wrote I have two questions: I am computing a linear regression model with 0 as Intercept. Well, I would like the sum of my predicted values be equal to a constant and therefore analyze if my coefficients are significatively different

Re: [R] minmun p-value for wilcox.test and correlation

2009-05-20 Thread Peter Flom
charles78 hu...@hotmail.com wrote I have a stupid question on how to get the real p-values for wilcox.test and correlation. the minmun can be reached is 2.2E-16 using the R version 2.6.2. I do not think it is the R version causing this but other issues. Any help is highly appreciated. Can I

Re: [R] How do you save in R?

2009-05-18 Thread Peter Flom
Dieter Menne dieter.me...@menne-biomed.de wrote Technically a good point, but I found it helpful for starters who want to avoid the inferno of what's attached now? not to use it at all. My suggestion is to use with() instead because it has a higher locality. I know, many of the examples use

Re: [R] intermediate iterations of stepwise regression

2009-05-18 Thread Peter Flom
utkarshsinghal utkarsh.sing...@global-analytics.com wrote Hi all, I am performing a stepwise regression by running the step function on an lm object. Now I want to save the intermediate iterations. I know the argument trace=T will print it on the console, but I rather want to assign it to

Re: [R] Simulation

2009-05-14 Thread Peter Flom
Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote Seriously? You think: lapply(1:n, rnorm, 0, 1) is 'clearer' than: x=list() for(i in 1:n){ x[[i]]=rnorm(i,0,1) } for beginners? Firstly, using 'lapply' introduces a function (lapply) that doesn't have an intuitive

Re: [R] Simulation)

2009-05-14 Thread Peter Flom
I wrote As a beginner, I agree the for loop is much clearer to me. Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no replied well, that's quite likely. especially given that typical courses in programming, afaik, include for looping but not necessarily functional stuff -- are

Re: [R] General Question about Graphics

2009-05-06 Thread Peter Flom
steve_fried...@nps.gov wrote I have encountered a situation with regards to plotting barcharts with associated error bars. My search for clues on how to accomplish this turned up some interesting information. Basically, I found that including error bars with barplots is not desirable and hence

Re: [R] Do you use R for data manipulation?

2009-05-06 Thread Peter Flom
Simon Pickett simon.pick...@bto.org wrote My institute uses SAS religiously, I am the only R heathen. I have resisted learning to use SAS because I dont see the point after years of using R and I like being able to do everything using one program. However, my colleagues maintain that SAS is

Re: [R] Producing a legend successfullly

2009-05-04 Thread Peter Flom
Steve Murray smurray...@hotmail.com wrote I'm attempting to insert a legend into a line graph. I've sorted out the positioning, but I'm unable to display the sample line and associated colour to go within the legend box. Instead, under the variable names, the numbers 1, 2, 2, 3 are displayed

Re: [R] Problems producing a simple plot

2009-05-02 Thread Peter Flom
Steve Murray smurray...@hotmail.com wrote I have a data frame of the nature: I am hoping to plot columns 2 and 3 against Latitude. I understand that you have to do this by plotting one column at a time, so I have been starting by attempting the following, but receiving errors: I'm

Re: [R] correlation coefficient

2009-04-29 Thread Peter Flom
Dieter Menne dieter.me...@menne-biomed.de wrote I noted the and was misleading. Read: Good journals like Lancet, New English and many British Journal of XXX really help you to do better. I am one of the statistical editors for PLoS Medicine, and I try to help people do better; often, the

Re: [R] truehist and density plots

2009-04-28 Thread Peter Flom
carol white wht_...@yahoo.com wrote Consider a vector of 100 elements (attached files). then, truehist(b) lines(density(b[20:50])) How is it possible to have density plots of all subsets like b[20:50] within histogram (without exceeding the max of historgram on y axis)? I didn't open your

Re: [R] ANOVA/statistics question

2009-04-26 Thread Peter Flom
drmh douglasrmhol...@googlemail.com wrote Hello again, In my situation, I have three variables: pretest, posttest, and cohesion. I want to work out the correlation between postest and cohesion. cor(cohesion, posttest) gives you this. I looked at multiple sets of data and created ANOVA

Re: [R] Stepwise

2008-09-04 Thread Peter Flom
Robin Williams wrote Is there any facility in R to perform a stepwise process on a model, which will remove any highly-correlated explanatory variables? I am told there is in SPSS. I have a large number of variables (some correlated), which I would like to just chuck in to a model and perform

[R] Simple programming problem with 'with' or 'data ='

2008-08-27 Thread Peter Flom
Hello I wrote a simple program to modify a boxplot: gdsbox - function(indvar){ boxplot(indvar~gds3lev, main = paste('Boxplot of', substitute(indvar), for GDS groups), names = c('1', '3', '4, 5, 6')) } If I attach the dataframe gdsgraph, this works fine. However, I've been warned

[R] Graphics function question

2008-07-29 Thread Peter Flom
Hello I have created a graph using the following commands: startBReP3O1T - diffs$BReP3O1T - diffs$diff_BReP3O1T endBReP3O1T - diffs$BReP3O1T x - seq(47,89, length = 10) ymin - min(min(startBReP3O1T), min(endBReP3O1T)) ymax - max(max(startBReP3O1T), max(endBReP3O1T)) y - seq(ymin, ymax, length

[R] Question about GCL function

2008-07-02 Thread Peter Flom
Hello again I recently downloaded the gcl package, which computes a fuzzy rules or tree classifier from data. It is very interesting and is giving good results. However, rather than return a list, it returns a function. Per the example in the documentation: library(gcl) library(datasets)

[R] LDA on pre-assigned training and testing data sets

2008-06-25 Thread Peter Flom
Dear r-help I am trying to run LDA on a training data set, and test it on another data set with the same variables. I found examples using crossvalidation, and using training and testing data sets set up with sample, but not when they are preassigned. Here is what I tried # FIRST SET UP A

[R] Question on lda and predict

2008-06-10 Thread Peter Flom
Hello Using R 2.7.0 on Windows. I am running a linear discriminant analysis as follows discrim1 - lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+ cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ absifmahal, subset = train) prediction - predict(discrim1,

Re: [R] Question on lda and predict

2008-06-10 Thread Peter Flom
I wrote (in part) I am running a linear discriminant analysis as follows discrim1 - lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+ cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ absifmahal, subset = train) prediction - predict(discrim1,

Re: [R] Question on lda and predict

2008-06-10 Thread Peter Flom
I wrote Hello Using R 2.7.0 on Windows. I am running a linear discriminant analysis as follows discrim1 - lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+ cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ absifmahal, subset = train) prediction -