On Wed, Sep 05, 2007 at 04:43:19PM -0700, Yuchen Luo wrote:
Dear friends.
I use nls() and encounter the following puzzling problem:
I have a function f(a,b,c,x), I have a data vector of x and a vectory y of
realized value of f.
Case1
I tried to estimate c with (a=0.3,
Oliver,
I am attaching an HTML document in which I have plotted -2Log(x) vs. x. If you
examine the plot you will see that -2Log(x) can be negative. Since -2Log(x) is
part of AIC and BIC, AIC and BIC can be negative.
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA
Dear Niccolo,
a) your example program
works for me
and on a Pentium 4, 3 Ghz, 1GB ram, The model fit uses
user system elapsed
146.920.76 143.32
library(geepack)
set.seed(299)
header - rep.int(seq(1:615),sample(seq(1:19),size=615,replace=T))
inr -
Anybody?
From: Cory Nissen
Sent: Tue 9/4/2007 9:30 AM
To: r-help@stat.math.ethz.ch
Subject: variable format
Okay, I want to do something similar to SAS proc format.
I usually do this...
a - NULL
a$divisionOld - c(1,2,3,4,5)
divisionTable -
Others have already pointed out %in% but regarding your comment about
SQL, you can use SQL to manipulate R data frames using the sqldf package
which provides an interface to lower level RSQLite (and RMySQL in the future)
routines. The following examples use SQLite underneath:
DF -
Hi R-users!!
I have some trouble with the survey pakage and i would be very glad if you
can give me an advice.
I have a sample from a survey where household were interviewed. The sample
has 4 criteria on which the stratification was based: REGION, SIZE OF
HOUSEHOLD, SIZE OF
Hi Greg,
Actually, I'm using the scatterplot function in the car namespace. My
understanding is that the scatterplot is turned into a boxplot when the x
variable is a factor, but I can't see that in the code of the function.
I've successfully modified the function to output regression stats
Your columns are factors, not character strings. Use as.is = TRUE as
an argument to read.table. Also its a bit dangerous to use T although
not wrong. Its safer to use TRUE.
On 9/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Dear List,
I have a newbie question. I have read in a
A matrix is for situations where every element is of the same class
but your columns have different classes so use a data frame:
DF - data.frame(a = 11:15, b = letters[1:5], stringsAsFactors = FALSE)
subset(DF, a %in% 11:13)
subset(DF, a %in% c(0, 11:13)) # same
Suggest you review the
Dear List,
I have a newbie question. I have read in a data.frame as follows:
data = read.table(table.txt, header = T)
data
X1 X2 X3 X4
A AB AC AB AC
B AB AC AA AB
C AA AB AA AB
D AA AB AB AC
E AB AA AA AB
F AB AA AB AC
B AB AC AB AA
I would like to replace AA values by BB in column X2. I
From: Dong-hyun Oh
Dear UseRs,
I would like to know which function is the most efficient in finding
convex hull of points in 3(or 2)-dimensional case?
Functions for finding convex hull is the following:
convex.hull (tripack), chull (grDevices), in.chull (sgeostat),
convhulln
Try this:
library(zoo)
plot(na.approx(zoo(as.matrix(data[-1]), data[,1])), plot.type = single)
See ?na.approx, ?plot.zoo, ?xyplot.zoo and vignette(zoo)
On 9/7/07, Markus Schmidberger [EMAIL PROTECTED] wrote:
Hello,
I have this kind of dataframe and have to plot it.
data - data.frame(sw=
Thanks a lot Gabor, that was very helpful. All sorted now!
Best
David
Your columns are factors, not character strings. Use as.is = TRUE as
an argument to read.table. Also its a bit dangerous to use T
although
not wrong. Its safer to use TRUE.
On 9/7/07, [EMAIL PROTECTED] [EMAIL
The posting guide (a link at the bottom of every e-mail from the list)
suggests including a small example of what you are trying to do.
Without an example, we have to guess at what you are trying to do.
I am still guessing since you still did not include an example. It
appears that part of the
Dear All,
When one loads certain packages, some other dependent packages are
loaded as well. Is there some way of detaching them automatically when
one detaches the first package loaded? For instance,
library(sqldf)
Loading required package: RSQLite
Loading required package: DBI
Loading
Markus Schmidberger wrote:
Hello,
I have this kind of dataframe and have to plot it.
data - data.frame(sw= c(1,2,3,4,5,6,7,8,9,10,11,12,15),
zehn =
c(33.44,20.67,18.20,18.19,17.89,19.65,20.05,19.87,20.55,22.53,NA,NA,NA),
zwanzig =
Phil,
If you have only a list of addresses and nothing else - i have to recognize i
am lost. But if you have more info you can use a GIS software and it will
calculate your distance automatically for all your addresses. To have your
distance in miles or Km you need to have a projection in
6. set the reset.par argument to FALSE in calling scatterplot as it
states in the documentation for scatterplot. (still look at the help on
'xpd' argment to par if you want to add text to the margins).
Hi Greg,
That seems to have done it partly. I set it to false once and then I could
see
Hello,
I have this kind of dataframe and have to plot it.
data - data.frame(sw= c(1,2,3,4,5,6,7,8,9,10,11,12,15),
zehn =
c(33.44,20.67,18.20,18.19,17.89,19.65,20.05,19.87,20.55,22.53,NA,NA,NA),
zwanzig =
Dear Cory,
I am not familiar with SAS, but is this what you are looking for?
divisionTable - matrix(c(1, New England,
2, Middle Atlantic,
3, East North Central,
4, West North Central,
5, South
hi,
A very quick search of PCA in R results in a lot of packages involving
that function. Just wondering which one is generally used for fat
data like microarray, esp. when the number of features is really big?
Thanks for comments
--
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.
Did you
Looking at the help for scatterplot, it looks like there is a 6th option
(which is probably the preferred method):
6. set the reset.par argument to FALSE in calling scatterplot as it
states in the documentation for scatterplot. (still look at the help on
'xpd' argment to par if you want to add
Yes but delete does not return anything so its not useful. In the devel
version of sqldf you can pass multiple command so try this using the
builtin data frame BOD noting that the record with demand = 8.3 was
removed:
library(sqldf)
Loading required package: RSQLite
Loading required package:
Paul Smith wrote:
Dear All,
When one loads certain packages, some other dependent packages are
loaded as well. Is there some way of detaching them automatically when
one detaches the first package loaded? For instance,
library(sqldf)
Loading required package: RSQLite
Loading required
On 9/7/2007 12:36 PM, Gene Selkov wrote:
I have found two prior instances of this question in R-help, but I can't
find the answer, and I'm giving up on mindless tinkering.
http://tolstoy.newcastle.edu.au/R/help/03a/5994.html
I have found two prior instances of this question in R-help, but I can't
find the answer, and I'm giving up on mindless tinkering.
http://tolstoy.newcastle.edu.au/R/help/03a/5994.html
https://stat.ethz.ch/pipermail/r-help/2004-December/062259.html
I must be able to pipe the poltting
Olivier,
type ?AIC and have a look at the description
Description:
Generic function calculating the Akaike information criterion for
one or several fitted model objects for which a log-likelihood
value can be obtained, according to the formula -2*log-likelihood
+ k*npar,
I have a feeling that this may be a stupid question, but here goes anyway:
is there a function that I can use to replace loess but which allows a
larger number of predictors?
(I have a situation in which it would be very convenient to use 5
predictors, which violates the constraint in loess that
On 7/9/07 12:36 AM, eugen pircalabelu wrote:
I'm trying to use the Survey package for a stratified sample which
has 4 criteria on which the stratification is based. I would like to get
the corrected weights and for every element i get a weight of 1
E.g: tipping
design -
locfit() in the locfit package can do that.
Andy
From: D. R. Evans
I have a feeling that this may be a stupid question, but here
goes anyway:
is there a function that I can use to replace loess but which allows a
larger number of predictors?
(I have a situation in which it would be
observation %in% ID
--- Takatsugu Kobayashi [EMAIL PROTECTED] wrote:
Hi RUsers,
I am wonder if I can search observations whose IDs
matches any of the
values in another vector, such as in MySQL. While I
am learing MySQL for
future database management, I appreciate if anyone
could give
If its good enough just to get rid of all attached packages since after startup
you could just do repeated detaches like this making use of the fact that
search() has 9 components on startup:
replicate(length(search()) - 9, detach())
On 9/7/07, Paul Smith [EMAIL PROTECTED] wrote:
Dear All,
On Thu, 6 Sep 2007, Monica Pisica wrote:
Hi,
Doing more search i've discovered package RGDAL that can write a geotiff
file with projection. I saved a geotiff file in UTM projection and if i
read the file back in R and check the projection seems that everything
is OK. But if i load the
On Fri, Sep 07, 2007 at 08:34:45PM +0200, Jose Luis Aznarte M. wrote:
Hi! I'm translating some code from Matlab to R and I found a problem.
I need to translate Matlab's function 'lsqnonlin'
(http://www-ccs.ucsd.edu/matlab/toolbox/optim/lsqnonlin.html) into R,
Do you want the nls
Hi all,
I obtained negative values for AIC and BIC criteria for a particular
model that I have
developped...
I don't remember to have negative values for these crietria for others
applications, so I am a
little suprised... Could anyone tell me if something is wrong or his
conclusion
On 9/7/07, Barry Rowlingson [EMAIL PROTECTED] wrote:
When one loads certain packages, some other dependent packages are
loaded as well. Is there some way of detaching them automatically when
one detaches the first package loaded? For instance,
library(sqldf)
Loading required package:
The thread you linked to regarding Levenberg-Marquardt's supposed lack of
availability is from 2001; it has been possible to get
to the MINPACK implementation of Levenberg-Marquardt within R via the
package minpack.lm
(http://cran.r-project.org/src/contrib/Descriptions/minpack.lm.html) since
2005.
Hi! I'm translating some code from Matlab to R and I found a problem.
I need to translate Matlab's function 'lsqnonlin'
(http://www-ccs.ucsd.edu/matlab/toolbox/optim/lsqnonlin.html) into R,
and at the beginning I thought it would be the same as R's 'optim'. But
then I looked at the
Thanks a ton, Duncan!
So I have verified that this line works:
echo postscript(file=\\, command=\cat\); plot(0) | r --vanilla --slave
Wonderful! (albeit a little unobvious)
--Gene
On Fri, 7 Sep 2007, Duncan Murdoch wrote:
On 9/7/2007 12:36 PM, Gene Selkov wrote:
I have found two prior
On 9/7/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
Yes but delete does not return anything so its not useful. In the devel
version of sqldf you can pass multiple command so try this using the
builtin data frame BOD noting that the record with demand = 8.3 was
removed:
library(sqldf)
This was what I was looking for. I figured factor was the way to go, but I
wasn't sure how to implement it.
The car recommendation looks good too, but I want to try to stay away from
having to download another package if I can.
Thanks
cn
From: Martin
I need to optimize a multivariate function f(w, x, y, z, ...) under an absolute
value constraint. For instance:
min { (2x+y) (w-z) }
under the constraint:
|w| + |x| + |y| + |z| = 1.0 .
Is there any R function that does this? Thank you for your help!
Phil Xiang
On 9/7/2007 2:15 PM, Gene Selkov wrote:
Thanks a ton, Duncan!
So I have verified that this line works:
echo postscript(file=\\, command=\cat\); plot(0) | r --vanilla
--slave
Wonderful! (albeit a little unobvious)
I would include an explicit dev.off() after the plotting; I'm not
On 9/7/2007 2:05 PM, Paul Smith wrote:
On 9/7/07, Barry Rowlingson [EMAIL PROTECTED] wrote:
When one loads certain packages, some other dependent packages are
loaded as well. Is there some way of detaching them automatically when
one detaches the first package loaded? For instance,
this should be possible in the lasso2 package.
url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax: 217-244-6678Champaign, IL 61820
On Sep
Martin Becker wrote:
Dear Cory,
I am not familiar with SAS, but is this what you are looking for?
divisionTable - matrix(c(1, New England,
2, Middle Atlantic,
3, East North Central,
4, West North Central,
Hi,
I am using aggregate to compute means for later plotting.
There are two factors involved and the problem is that the values of the
second factor ( Age ) in the means are not in the right order because
10 comes inbetween 1 and 2
What I really want is the numeric value of Age but as.numeric
Is there a way to run a simple perl script from R?
Kenneth B. Pierce Jr.
Research Ecologist
Landscape Ecology, Modeling, Mapping and Analysis Team
PNW Research Station - USDA-FS
3200 SW Jefferson Way, Corvallis, OR 97331
[EMAIL PROTECTED]
541 750-7393
Try this.
as.numeric(levels(fishdata$Age))[fishdata$Age]
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en
I have a list of observations that are -1, 1 or 0. I would like to
represent them in a horizontal bar color coded based on value like a
stacked bar graph. I can achieve this in the form of a png with the
following code:
A = floor(runif(10)*3) - 1
png(width=100, height=10)
Hi,
Ive written some code to obtain a confusion matrix when the true
classification and the predicted classification are known. Suppose true
classification is called tr and predicted classification is pr. I have 4
classes in tr, but only 3 classes out of 4 are predicted in pr.
All sqldf does is pass the command to sqlite and retrieve whatever it
sends back translating the two directions to and from R. sqldf
does not change the meaning of any sql statements. Perhaps the
meaning you expect is desirable but its not how sqlite works. If
sqlite were changed to adopt that
Dear Monica,
try this:
cm = table(tr, pr)
cm
pr
tr 1 2 3
1 2 1 0
2 2 1 0
3 0 0 3
4 0 1 0
rowSums(cm)
colSums(cm)
Best wishes
Wolfgang Huber
Monica Pisica ha scritto:
Hi,
I�ve written some code to obtain a confusion matrix when the true
classification and
On Fri, Sep 07, 2007 at 02:27:00PM -0400, Duncan Murdoch wrote:
On 9/7/2007 2:15 PM, Gene Selkov wrote:
Thanks a ton, Duncan!
So I have verified that this line works:
echo postscript(file=\\, command=\cat\); plot(0) | r --vanilla
--slave
Wonderful! (albeit a little
On Fri, Sep 07, 2007 at 12:15:51PM -0700, Pierce, Ken wrote:
Is there a way to run a simple perl script from R?
?system
Hth, Dirk
--
Three out of two people have difficulties with fractions.
__
R-help@stat.math.ethz.ch mailing list
On Fri, 2007-09-07 at 12:45 -0700, Luis Naver wrote:
I have a list of observations that are -1, 1 or 0. I would like to
represent them in a horizontal bar color coded based on value like a
stacked bar graph. I can achieve this in the form of a png with the
following code:
A =
On Fri, 7 Sep 2007, Luis Naver wrote:
I have a list of observations that are -1, 1 or 0. I would like to
represent them in a horizontal bar color coded based on value like a
stacked bar graph. I can achieve this in the form of a png with the
following code:
A = floor(runif(10)*3) - 1
On Fri, 2007-09-07 at 15:07 -0500, Marc Schwartz wrote:
On Fri, 2007-09-07 at 12:45 -0700, Luis Naver wrote:
I have a list of observations that are -1, 1 or 0. I would like to
represent them in a horizontal bar color coded based on value like a
stacked bar graph. I can achieve this in
Dear friends.
I am using function
constrOptim(c(0.5,0.3,0.5), fit.error, fit.error.grr, ui=-1*ui,ci=-1*ci)
and I am confronted with error message initial value not feasible
I plug in the initial value of (0.5,0.3,0.5) to function fit.error and
fit.error.grr and have pretty reasonable result. I
Dear List,
I have read that a lognormal mixture model having a pdf of the form
f(x)=w1*f1(x)+(1-w1)*f2(x) fits most data sets quite well, where f1
and f2 are lognormal distributions.
Any pointers on how to create a function that would produce the 5
parameters of f(x) would be greatly
I've tried various configurations of .script, system and shell to no
avail. It seems to pause and run something but then no output is
created.
-Original Message-
From: Dirk Eddelbuettel [mailto:[EMAIL PROTECTED]
Sent: Friday, September 07, 2007 1:11 PM
To: Pierce, Ken
Cc: r-help
What I am trying to do is as follows:
- I have listed names of all wanted objects (datasets A,B,C... ) in current
workspace as a vector:
obj - c('A','B','C')
- then i need to use these objects, say to extract all the 1st columns and
bind to an existing dataset ('data'):
for ( i in 1:3){
Dear Petr,
I tried replying directly to you but my communication was rejected as spam.
On second thought, it is possible that it is.
Thank you very much for taking the time and interest to answer my enquiry to
the R Help Group.
My interest isnt so much in the particular data set as
I am running R 2.5 on a Mac platform and have a difficulty loading the
Tcl/Tk package.
Specifically:
Rlibrary(tcltk)
Loading Tcl/Tk interface ... Error in fun(...) : couldn't connect to
display :0
Error : .onLoad failed in 'loadNamespace' for 'tcltk'
Error: package/namespace load failed for
Thanks to all who replied (and very quickly). Unfortunatly I was
not clear enough as to my intentions. My goal is to replicate a
graph I saw in the work by Perry, Miller and Enright in A comparison
of methods for the statistical analysis of spatial point patterns in
plant ecology
This should work:
do.call(cbind, lapply(1:length(obj), function(i) get(obj[i])[,1]))
Best,
Giovanni
Date: Fri, 07 Sep 2007 14:42:07 -0700 (PDT)
From: runner [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
Precedence: list
What I am trying to do is as follows:
- I have listed names of
See http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#TclTk-issues
Gabor
On Fri, Sep 07, 2007 at 05:59:31PM -0400, Jon Loehrke wrote:
I am running R 2.5 on a Mac platform and have a difficulty loading the
Tcl/Tk package.
Specifically:
Rlibrary(tcltk)
Loading Tcl/Tk interface ...
get might be good enough for you:
a - 10
name - a
get(a)
[1] 10
get(name)
[1] 10
Gabor
On Fri, Sep 07, 2007 at 02:42:07PM -0700, runner wrote:
What I am trying to do is as follows:
- I have listed names of all wanted objects (datasets A,B,C... ) in current
workspace as a vector:
On 9/7/07, Phil Xiang [EMAIL PROTECTED] wrote:
I need to optimize a multivariate function f(w, x, y, z, ...) under an
absolute value constraint. For instance:
min { (2x+y) (w-z) }
under the constraint:
|w| + |x| + |y| + |z| = 1.0 .
Is there any R function that does this? Thank
I am using R to plot baseball spray charts from play-by-play data. I have
used the following command to plot the diamond:
plot (0:250, -250:0, type=n, bg=white)
lines(c(125,150,125,100,125),c(-210,-180,-150,-180,-210),
col=c(black))
I have also plotted different hit locations using
Sure -2*log(x) can be negative, and it can outweigh the k*npar term. Just do:
curve(-2*log(x)+2, 0.1, 10) # for AIC with npar = 1
abline(h=0, v=exp(1), lty=3)
However, that only happens for x exp(1) or even bigger if npar 1. I
think Olivier's real question is: do we believe in likelihoods 1
Hi,
Is there any build-in function allowing us to remove a particular group of
elements in a vector?
For example, if I want to remove all the NA in the output of answer
function . Please help. Thanks
answer(100)
[1] 1 2 NA 4 NA NA 7 8 NA NA 11 NA 13 14 NA 16 17 NA 19 NA NA 22 23
NA
Man,
I love this package and the guy who contributes it!
--
===
I am dying with the help of too many
physicians. - Alexander the Great, on his deathbed
===
WenSui Liu
(http://spaces.msn.com/statcompute/blog)
On Fri, 7 Sep 2007, Pierce, Ken wrote:
I've tried various configurations of .script, system and shell to no
avail. It seems to pause and run something but then no output is
created.
Works for me:
cat( 'print Hello World\n;',file=hello.pl )
system(perl hello.pl)
Hello World
Maybe a path
On Fri, 7 Sep 2007, Jacques Wagnor wrote:
Dear List,
I have read that a lognormal mixture model having a pdf of the form
f(x)=w1*f1(x)+(1-w1)*f2(x) fits most data sets quite well, where f1
and f2 are lognormal distributions.
Whoa! There have to be a lot of qualifiers on an assertion like
Dear friends,
I have a data set with 23 columns and 38000 rows. It is a panel running from
the years 1991 through 2005. I want to aggregate the data and get the medians
of each of the 23 columns for each of the years. In other words my output
should be like this
Year Median
1991
This function should do it for you:
file1 - read.table(textConnection( id rx week dv1
+ 1 1 11 1
+ 2 1 12 1
+ 3 1 13 2
+ 4 2 11 3
+ 5 2 12 4
+ 6 2 13 1
+ 7 3 11 2
+ 8 3 12 3
+ 9 3 13 4
+ 10 4 11 2
+ 11 4
?segments
On 9/7/07, lawnboy34 [EMAIL PROTECTED] wrote:
I am using R to plot baseball spray charts from play-by-play data. I have
used the following command to plot the diamond:
plot (0:250, -250:0, type=n, bg=white)
lines(c(125,150,125,100,125),c(-210,-180,-150,-180,-210),
Dear Friends,
I forgot to add, the idea is to aggregate the entire dataset based on year and
get the median value for each of the columns. Hence the output should be like
this
YearX1 X2X3 ...
1991102030...
199230 2010...
1993
x - answer(100)
x - x[!is.na(x)] # remove NAs
On 9/7/07, kevinchang [EMAIL PROTECTED] wrote:
Hi,
Is there any build-in function allowing us to remove a particular group of
elements in a vector?
For example, if I want to remove all the NA in the output of answer
function . Please help.
Your 'lst' is not the same length as either set1 or set2. If one of
your columns in the dataframe is the year, then you should have:
aggregate(set1, set1$year, median)
On 9/7/07, Anup Nandialath [EMAIL PROTECTED] wrote:
Dear friends,
I have a data set with 23 columns and 38000 rows. It is a
[Duncan Murdoch]
You could also look at Ross Ihaka's paper that is online here:
http://cran.r-project.org/doc/html/interface98-paper/paper.html
Interesting read. Thanks for this reference!
--
François Pinard http://pinard.progiciels-bpi.ca
__
[Roland Rau]
[François Pinard]
I wonder what happened, for R to hide the underlying Scheme so fully,
at least at the level of the surface language (despite there are
hints).
To further foster portability, we chose to write R in ANSI C
Yes, of course. Scheme is also (often) implemented
A slightly easier way to construct first and last if the vector x is
sorted (as is assumed in SAS) is:
first - !duplicated(x)
last - !duplicated(x, fromLast = TRUE)
where the fromLast= argument is added in R 2.6.0.
On 9/7/07, Gerard Smits [EMAIL PROTECTED] wrote:
Hi R users,
I have a
Hello Everyone,
I have recently been introduced to the ggplot package by Hadley Wickham
and must say I am quite impressed so far at how easy it is to make
attractive plots, but one thing I am struggling over is how to
consolidate legends.
I have 3 plots that I would like to put on a single
85 matches
Mail list logo