Re: [R] exact string match?

2009-10-30 Thread Linlin Yan
How about using operator ==

On Sat, Oct 31, 2009 at 5:00 AM, bamsel benam...@gmail.com wrote:

 Dear R users:
 I need to compare character strings stored in 2 separate data frames. I need
 an exact match, so finding a in animal is no good.
 I've tried regexpr, match, and grepl, but to no avail.
 Anybody know how to accomplish this?
 Ben
 --
 View this message in context: 
 http://old.nabble.com/exact-string-match--tp26136677p26136677.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Multiple linear regression with constraint (imposition)

2009-10-30 Thread David Winsemius


On Oct 30, 2009, at 7:47 PM, CE.KA wrote:



Sorry there was a mistake:


I could not see what was different?



Hi R users

I want to do a multiple linear regression with R

With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
lm(Y~X1+X2)

My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
What is the program for such a model?



Try calculating X3= X2-X1 and estimate the shared parameter with:

lm(y ~ X3)

or instead;

lm(Y ~ I(X2 - X1) )

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] possible memory leak in predict.gbm(), package gbm ?

2009-10-30 Thread Ridgeway, Greg
All of the memory allocations for predictions use R's allocVector(). See
gbm_pred in gbmentry.cpp. That is, R's memory manager is doing all the
work. gbm_pred is not allocating memory separate from R. It's just
creating R objects within R that can be deleted or garbage collected.

 

Make sure your gbm object does not have a Terms component. I don't
think it should if you called gbm.fit() directly. Without a Terms
component it will not run model.frame() and shouldn't really take so
much memory.

 

If you want to experiment with the latest development version you can
find it at https://r-forge.r-project.org/projects/gbm/

 

Greg

 



From: Markus Loecher [mailto:markus.loec...@gmail.com] 
Sent: Friday, October 30, 2009 6:17 AM
To: r-help@r-project.org
Cc: Ridgeway, Greg
Subject: possible memory leak in predict.gbm(), package gbm ?



Dear gbm users,
When running predict.gbm() on a large dataset (150,000 rows, 300
columns, 500 trees), I notice that the memory used by R grows beyond
reasonable limits. My 14GB of RAM are often not sufficient. I am
interpreting this as a memory leak since there should be no reason to
expand memory needs once the data are loaded and passed to predict.gbm()
?


Running R version 2.9.2 on Linux, gbm package 1.6-3.

Thanks,

Markus


__

This email message is for the sole use of the intended r...{{dropped:9}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Johnson-Neyman procedure (ANCOVA)

2009-10-30 Thread Stropharia

Dear R users,

Does anyone know of a package that implements the Johnson-Neyman procedure -
for testing differences among groups when the regression slopes are
heterogeneous (in an ANCOVA model)? I did not get any matches for functions
when searching using R Site Search.

If it has not been implemented in R, does anyone know of another statistical
package that has this procedure? I found very old scripts available for
Mathematica, but have had difficulty getting them to work.

Thanks in advance.

best,

Steve
-- 
View this message in context: 
http://old.nabble.com/Johnson-Neyman-procedure-%28ANCOVA%29-tp26138992p26138992.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Stratified Maximum Likelihood

2009-10-30 Thread Noah Silverman

Hi,

I've search rseek.org high and low and can't seem to find an answer to this.

I want to maximize likelihood for a set of training data, but the data 
is grouped.  (Think multiple trials.)


It would probably be possible to do this with some nested for loops 
manually, but would be painfully slow.


The general formula is this...  (Please excuse my notation, but I can't 
write proper math formulas in an email.)


L(a) = product(
for( trial in 1:length(groups)){
exp(a * X) / sum(exp(a * X))
}
)

As you can see, a normal logLik function will lose all the group data.  
This seems like a common enough application that there must me some easy 
function in R.


THEN, just to complicate things, I need to run a second logLik with some 
trickier data. There are 14 variables and I need to adjust them all to 
find the maximum likelihood from a formula. (kelly criterion.)


Any suggestions would be gratefully appreciated.

Thanks!

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Formula with in memory data.frame

2009-10-30 Thread rkevinburton
I have an array of data.frame(s) that I would like to smooth with loess one at 
a time. the array is master and the two variable that I am interested in is 
Period and Quantity. So my first attempt at calling loess is:

loess(Quantity ~ Period, master[[i]])

But I get the following error:

Error: NA/NaN/Inf in foreign function call (arg 2)
In addition: Warning message:
NAs introduced by coercion 

I did a str on the array element str(master[[j]]):

'data.frame':   58 obs. of  3 variables:
 Factor w/ 41 levels 10\ Plates,..: 1 1 1 1 1 1 1 1 1 1 ...
 $ Period  : POSIXct, format: 0001-01-20 0002-01-20 ...
 $ Quantity: int  0 0 0 0 0 0 0 0 0 0 ...

So am I doing something wrong?

Thank you.

Kevin

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plots with k-means

2009-10-30 Thread Iuri Gavronski
Hi,

I'm doing a k-means cluster with 6 clusters and 15 variables. Any
suggestions on how to plot the results?

I've tried the standard xy plot, but couldn't get much of it.

Thansk in advance,

Iuri.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Multiple linear regression with constraint (imposition)

2009-10-30 Thread Ravi Varadhan

Simply do this:

lm(y ~ I(X1 - X2))


Ravi.


Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu


- Original Message -
From: CE.KA ce.kay...@yahoo.fr
Date: Friday, October 30, 2009 7:48 pm
Subject: Re: [R] Multiple linear regression with constraint (imposition)
To: r-help@r-project.org


 Sorry there was a mistake:
 
 Hi R users
 
 I want to do a multiple linear regression with R
 
 With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
 lm(Y~X1+X2)
 
 My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
 What is the program for such a model?
 
 Best regards
 
 
 -- 
 View this message in context: 
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 
 PLEASE do read the posting guide 
 and provide commented, minimal, self-contained, reproducible code.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


<    1   2