Dear R users
I am trying to sum selective elements of a vector but my solution
is not cutting it.
Example:
g - 1:5;
from - 1:3;
to - 3:5;
from to
1 3
2 4
3 5
so I expect 3 sums from g
1+2+3 that is 1 to 3 of g
2+3+4 that is 2 to 4 of g
3+4+5 that is 3
Hi,
This may belong more to r-develop, but general discussion may be useful
(for the how many-th time ?)
seq(2,5,-2)
seq(5,2,2)
both result in
Error in seq.default(2, 5, -2) : wrong sign in 'by' argument
But often, if not always, mathematicians and programmers want a
behaviour e.g. in for
create a matrix and then use apply:
g - 1:5;
from - 1:3;
to - 3:5;
index - cbind(from,to)
apply(index, 1, function(x) sum(g[x[1]:x[2]]))
[1] 6 9 12
On 3/27/06, Fred J. [EMAIL PROTECTED] wrote:
Dear R users
I am trying to sum selective elements of a vector but my solution
is
On 3/27/06, Martin Maechler [EMAIL PROTECTED] wrote:
Gottfried == Gottfried Gruber [EMAIL PROTECTED]
on Sun, 26 Mar 2006 10:27:35 +0200 writes:
Gottfried hello, i have run around 65000 regressions and
Gottfried stored them in a list. then i stored the session
Gottfried with
Hello everybody,
i already searched the archieves, but i still don't know what is wrong
in my implementation, mybe anybody coud give me some advice
ll1-function(rho,theta,beta1,beta2,beta3,beta4,t,Szenariosw5,Testfaellew5,X1,X2)
{
n-length(t)
t-cumsum(t)
tn-t[length(t)]
Hello, I am trying to create directories with R. I would like R to
create directories because it is platform independent. I tried using
file() and searching in R Data Import/Export but I did not succeed.
I think it must be some function since exists the unlink to remove
directories (and files).
On Mon, 27 Mar 2006, [EMAIL PROTECTED] wrote:
Hello everybody,
i already searched the archieves, but i still don't know what is wrong
in my implementation, mybe anybody coud give me some advice
ll1-function(rho,theta,beta1,beta2,beta3,beta4,t,Szenariosw5,Testfaellew5,X1,X2)
{
On 3/27/06 12:19 AM, kumar zaman [EMAIL PROTECTED] wrote:
Dear Gabor and all ;
I know this will work; but i already have a distance matrix calculated using
my distance measure Dij = 0.5 * ( 1 - cos(theta_i - theta_j)), if i do
hclust(as.dist(df)) then i am taking distance another
?dir.create
On Mon, 2006-03-27 at 13:07 +0200, pau carre wrote:
Hello, I am trying to create directories with R. I would like R to
create directories because it is platform independent. I tried using
file() and searching in R Data Import/Export but I did not succeed.
I think it must be some
Dear R list,
Can anyone help with a plotting question? I'm trying to display some data
on a plot and I've almost got the format I need (see code below), but 2
things I can't get:
1. How to get Jan,Feb,Mar on the x=axis instead of 1:3?
2. How to get Ts on the end of my error bars like you have in
I think you need to use system(mkdir) or whatever is appropriate
for your OS. Making directories is a function of the OS, not of R. If
you need to make a truly cross-platform solution, you might need
to check within your code what OS is being used, and call the
appropriate system statement. (I
On 3/27/2006 4:41 AM, Christian Hoffmann wrote:
Hi,
This may belong more to r-develop, but general discussion may be useful
(for the how many-th time ?)
seq(2,5,-2)
seq(5,2,2)
both result in
Error in seq.default(2, 5, -2) : wrong sign in 'by' argument
But often, if not always,
You should be able to do it yourself; e.g.,
my.seq - function(...) if((to - from) * by 0) NULL else seq(...)
and use that instead when you want that behavior.
Andy
From: Christian Hoffmann
Hi,
This may belong more to r-develop, but general discussion may
be useful
(for the how
On Mon, 27 Mar 2006, Christian Hoffmann wrote:
Hi,
This may belong more to r-develop, but general discussion may be useful
(for the how many-th time ?)
The place for general discussion of changes to R is the R-devel list.
There is almost no scope to change things like this, as there is so
On Mon, 27 Mar 2006, pau carre wrote:
Hello, I am trying to create directories with R. I would like R to
create directories because it is platform independent. I tried using
file() and searching in R Data Import/Export but I did not succeed.
I think it must be some function since exists the
help.search(directory) would have given you:
R.home(base)Return the R Home Directory
files(base) File and Directory Manipulation
getwd(base) Get or Set Working Directory
list.files(base)List the Files in a Directory/Folder
unlink(base)
Dear R Users,
I'm looking for a similar function as step() or drop1() for glmmML models,
but couldn't yet find any. I would appreciate if anyone could help me find
such a function.
Thanks,
Istvan
__
R-help@stat.math.ethz.ch mailing list
apply(cbind(from,to), 1, function(x) sum(g[x[1]:x[2]]))
Fred J. a écrit :
Dear R users
I am trying to sum selective elements of a vector but my solution
is not cutting it.
Example:
g - 1:5;
from - 1:3;
to - 3:5;
from to
1 3
2 4
3 5
so I expect 3 sums from
thanks a lot ! it runs well now
Pierre Clauss
Gabor Grothendieck [EMAIL PROTECTED] a écrit :
Make sure your x axis variable really is of class Date: class(x)
plot(Sys.Date() + 0:99, 1:100)
See ?str ?class ?as.Date, ?axis.Date and the help desk article in
R News 4/1 on dates for more info.
On 3/27/06 6:55 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Dear R list,
Can anyone help with a plotting question? I'm trying to display some data
on a plot and I've almost got the format I need (see code below), but 2
things I can't get:
1. How to get Jan,Feb,Mar on the x=axis
Dear R Users,
I'm looking for a similar function as step() or drop1() for glmmML models,
but couldn't yet find any. I would appreciate if anyone could help me find
such a function.
Thanks,
Istvan
- Original Message -
From: [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Monday,
See ?dir.create, and take care at the 'recursive' argument in case you
have to create several subdir levels at once.
Best,
Philippe Grosjean
Sarah Goslee wrote:
I think you need to use system(mkdir) or whatever is appropriate
for your OS. Making directories is a function of the OS, not of R.
Hi.
seq() is a complex beast indeed. 'by' being the wrong
sign is a special case of the behaviour seen in the
following code snippets, the first of which is correctly
rejected by seq(), the second of which should arguably
return a three element complex vector.
seq(from=1,to=3,by=1+1i)
Error
On 3/27/2006 8:28 AM, Robin Hankin wrote:
Hi.
seq() is a complex beast indeed. 'by' being the wrong
sign is a special case of the behaviour seen in the
following code snippets, the first of which is correctly
rejected by seq(), the second of which should arguably
return a three element
Hi Duncan et al
I don't think seq() could reasonably be expected to handle to and
by arguments with complex values. Trying to divide the (to-from)
difference by (by) to find how many steps to take would usually
result in enough rounding error that the result wouldn't be real-
Thank you Marc and Don's help, especially Marc's.
Output- subset(FireDataAppling, select = c(STARTDATE, County, TOTAL,
CAUSE))
Worked!
STARTDATE IS a factor and I used the following command to get the
-mm-dd format of the date
Output$Date- as.POSIXct(Output$STARTDATE)
Thank you!
Daniel
yOn Mon, 27 Mar 2006, Szentirmai Istvan wrote:
Dear R Users,
I'm looking for a similar function as step() or drop1() for glmmML models,
but couldn't yet find any. I would appreciate if anyone could help me find
such a function.
If you read the help for those functions, you will see that
Dear R-community
My ODE problems looks as follows:
(1) dA/dt = u*A - v*B
(2) dB/dt = v*B - u*A
where u is a constant, and v=k*t (k=constant, t=time)
Does anybody knows a good function/procedure of solving? Should one
involve the equation (3) dv/dt = k?
Thanks for your support.
--
Dominik
See plotCI in package gplots.
For dates you can make use of the builtin vector month.abb
plot(1:3, 11:13, xaxt = n)
axis(1, 1:3, month.abb[1:3])
or use Date class:
xvals - seq(as.Date(2006-01-01), length = 3, by = month)
plot(xvals, 1:3)
or with specific control over x axis:
xvals -
I have used R a lot in the past, but never for simulation. I have a code in
SAS for the Graded Response Model (GRM), also known as Samejima's model. This
code simulates an ordinal response, provided item characteristics (A=item
discrimination, BB(G) are thresholds between various categorical
Two comments:
1) The log-likelihood and hence AIC for a model for log X are not
comparable with those of a model for X. You need to make an additive
adjustment when you transform: it is quite easy to work out what from the
definitions.
2) The AIC given by glm() for weighted models was wrong
Dominik Heinzmann [EMAIL PROTECTED] writes:
Dear R-community
My ODE problems looks as follows:
(1) dA/dt = u*A - v*B
(2) dB/dt = v*B - u*A
where u is a constant, and v=k*t (k=constant, t=time)
Does anybody knows a good function/procedure of solving? Should one
involve the equation
Dear useRs,
we are happy to inform you that the program for the 2nd R user conference
useR! 2006 is now available online from the conference Web page at
http://www.R-project.org/useR-2006/program.html
We would like to thank the useR community for submitting so many
interesting abstracts about
The issue here is that you are using a UTF-8 locale (you sent this message
in UTF-8), and you need appropriately encoded X11 fonts. R-2.0.1 did not
support UTF-8, and so you got incorrect output for non-ASCII characters.
It *is* an X11 installation/fontpath problem.
On Thu, 23 Mar 2006,
The general problem I am trying to solve is to determine if a series of
subsets of data can be described with a single regression slope. This
involves fitting the data to each subset, calculating a joint slope
followed by F tests to show that the variances are equal the final slope is
valid.
Hello,
I am using the glm model with a poisson distribution. The model runs
just fine but when I try to get the null deviance for the model of the
null degrees of freedom I get the following errors:
null.deviance(pAmeir_1)
Error: couldn't find function null.deviance
df.null(pAmeir_1)
Error:
Dominik,
Adding (1) and (2) yields,
A(t) + B(t) = constant = A(0) + B(0) = c
So, plug in B = c - A in (1) and solve for A. This should be an easy
solution.
Hope this is helpful,
Ravi.
-Original Message-
From: [EMAIL PROTECTED] [mailto:r-help-
[EMAIL PROTECTED] On Behalf Of Peter
Is your question how to run a regression with separate slopes
and then with one slope and then to complare them? If that
is it here is an example:
# test data - ind is factor which defines the groups
set.seed(1)
y1 - 10 + 20 * seq(100) + rnorm(100)
y2 - -200 + 35 * seq(100) + rnorm(100)
yy -
Why are you trying to extract the values by calling a function with the name
of the value? glm objects are stored as a list i.e.
str(pAmeir_1)
Hence, you can extract what you need by selecting the values on the list
i.e.
pAmeir_1$df.null
pAmeir_1$null.deviance
Cheers
Francisco
From:
If I understand you correctly, I would say that this is a standard analysis
of covariance problem that you are approaching incorrectly. You should not
be testing for equal variances, IMO. Instead,
1. Combine all your data into 3 columnsS x, y, and group= subset.
2. Model.1: y ~ x
3. Model.2: y ~
Hi,
I would like to read in multi-dimensional data from a
text file, i.e. tables with more than 2 dimensions.
I have looked for a function which I can abuse for
that but haven't found anything.
I would appreciate it a lot if somebody gave me a hint
if such functions already exist somewhere.
How is the data organized? You could 'linearize' the data (e.g., column
order) and supply the dimensions of the data that you would apply after the
data was read in.
If you had three dimensions and you separated each 2D page with a blank
line, you again could reconstruct the data. If you have
Dear R users
graphing with plot(x) seams to work for a small length(x), when length(x) is
too large it seams to clutter the display, a solution would be to display
subsets of x at a time, yet a better way which I hope R supports is to place a
sliding bar on the display window to control
Hi
Following on from the Distributed Statistical Computing conferences in
Vienna (1999, 2001, 2003) and the Directions in Statistical Computing
conference in Seattle last year ...
DSC 2007, a conference on systems and environments for statistical
computing, will take place in Auckland, New
Does the following (or some simple modification of it) do what you
want?:
library(tkrplot)
y - rnorm(1, 10, 2) + 5*sin( (1:1)/1000 )
tt - tktoplevel()
left - tclVar(1)
oldleft - tclVar(1)
right - tclVar(100)
f1 - function(){
lleft - as.numeric(tclvalue(left))
rright -
Dear All,
I'm running a binomial model using the lmer() function, and I get p values
for the parameter estimates only with family=binomial, but not with
quasibinomial? Why is that so? I wanted to use quasibinomial family, because
my data were overdispersed.
Thanks,
Istvan
Hi
I can do this:
formula = as.factor(outcome) ~ .
in glm and other model building functions. I think there is a way to
get the product of the determinants (that is d1 * d2, d1 * d3, etc) and
also another way to get all the polynomials (that is like poly(d1,2)
would produce for a single
Hi
Does anyone know what this means:
glm.model = glm(formula = as.factor(nextDay) ~ ., family=binomial,
data=spi[1:1000,])
pred - predict(glm.model, spi[1001:1250,-9], type=response)
Warning message:
prediction from a rank-deficient fit may be misleading in:
predict.lm(object, newdata,
Hi,
I was surprised that apply and sapply don't return the same results in
the example below. Can someone tell me what I'm missing?
zls - function(x) character(0)
m - matrix(0, nrow=2, ncol=2)
apply(m, 1, zls)
character(0)
sapply(m, zls)
[[1]]
character(0)
[[2]]
character(0)
[[3]]
dear R wizards:
X is factor with 20,000*20=800,000 observations of 20,000 factors.
I.e., each factor has 20 observations. y is 800,000 normally
distributed data points. I want to see how much R^2 the X factors can
provide. Easy, right?
lm ( y ~ X)
and
aov( y ~ X)
Error: cannot allocate
I'll give it a shot:
apply() is only a wrapper around a for loop through the requested
dimension(s). In this case it would run zls() once for each row in m; i.e.,
twice. The `Value' section of apply() explains what it does if the function
being applied returns vector of length 0.
sapply() is
I guess you meant X has 20,000 levels (and 40 observations each)? In that
case lm() will attempt to create a design matrix that's 8e5 by 2e4, and
that's unlikely to fit in the RAM.
It is very easy to compute by hand. I'm using a smaller data size first to
check the result against summary(lm()),
Hmm... didn't read the whole post before I hit `send'...
I think you basically will have to fit the model `by hand', which is not
that hard, given the simple structure of the model(s). The formulae for the
quantities of interests are quite straightforward and easy to code in R
(similar to the
Have you tried the following:
lme(y~1, random=~1|X, data=DF)
where DF = a data.frame with columns y and X.
The authoritative reference on library(nlme) is Pinheiro and Bates
(2000) Mixed-Effects Models in S and S-Plus (Springer). I've learned a
lot from Bates
Hello,
I'm getting the following error message when I try to run 'tsdiag' on what
seems to be a valid time series:
tsdiag(small)
returns:
[Error in tsdiag(small) : no applicable method for tsdiag]
where small is a little test series where I have isolated this problem (the
original has
The default is taken from S-PLUS, so the reference is the S-PLUS manual.
It is pretty similar to the recommendation of Brockwell Davis.
On Mon, 27 Mar 2006, Spencer Graves wrote:
I don't know why the default lag.max is 10*log10(N/m) for m series.
The acf help page includes the
tsdiag is for diagnostic plots from time-series fits, not time series.
On Tue, 28 Mar 2006, Rafael Algara wrote:
Hello,
I'm getting the following error message when I try to run 'tsdiag' on what
seems to be a valid time series:
tsdiag(small)
returns:
[Error in tsdiag(small) : no
There is a very similar example worked through in section 7.2 of `S
Programming'.
On Mon, 27 Mar 2006, Liaw, Andy wrote:
Hmm... didn't read the whole post before I hit `send'...
I think you basically will have to fit the model `by hand', which is not
that hard, given the simple structure of
58 matches
Mail list logo