27;Std. Error']
}
#
# Finally, let's analyse it
# The distribution of (m.bar - m) / m.std.error should be
# a Student's t with n - 2 degrees of freedom.
# Is it? Let's test!
#
print(ks.test((m.bar - m) / m.std.error, rt(NN, n - 2)))
... and now it's not.
What
e first value of
the series x is deterministic, and two degrees are lost in the
estimation of ar1 and intercept)
What am I misunderstanding?
BTW, a similar example:
x <- 1:10
y <- sin(x)
reg <- lm(y ~ x)
summary(reg)
will give a t-value for 'x' = 0.704 with P(>|t|) = 0.501
pointwise product of vectors
delta > 0 is a logical array with TRUE or FALSE
sum(delta > 0) coerces TRUE to 1 and FALSE to 0
length(delta) is the length of delta (n)
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mail
there's no point in repeating them (but
corrections are welcome!) :-)
Alberto Monteiro
__
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.
you want:
image(x, y, z, nlevels=256, col=rgb(0, seq(0, 1, length=256), 0))
Explanation:
rgb(0, seq(0, 1, length=256), 0)
creates a vector of colours that begin with "black" = "#0" and
ends up with "green" = "#00FF00".
of data type double,
> it always returns N/A.
>
So, x_ema includes one (or more) NA (and not N/A) in it.
Test: if (any(is.na(x_ema))) cat("Oops! NAs in x_ema\n")
If you want to get which of them are na: which(is.na(x_ema))
Alberto Monteiro
___
The second way (and simpler) is to enclose the "mean" function
into the script string, and then invoke the magic words:
x<-c(1:10)
script<-"x, trim = 0, na.rm = FALSE"
# Step 1: convert script to the calling of mean - but still as a string
mean.string <- paste("
Function arma is crashing in some (pathological, but crashing is never good)
cases.
For example:
library(tseries)
arma(c(2.01, 2.22, 2.09, 2.17, 2.42), order=c(1,0))
I came to that pathological series while doing test cases; probably there
are crashing cases with longer series.
Alberto
Another pathological test.
arima does not crash for that series that crashes arma:
arima(c(2.01, 2.22, 2.09, 2.17, 2.42), order=c(1,0,0))
However, arima crashes for this:
arima(c(1.71, 1.78, 1.95, 1.59, 2.13), order=c(1,0,0))
arima seems pretty consistent in its crashing behaviour, since crash
s at once!
>
> In other words, I'm looking for an expression which will return
> the vector
>
> c(C.W[[1]]$level,C.W[[2]]$level,...,C.W[[28]]$level)
>
H...
Did you try this?
# reproducible example
C.W <- list(list(level = 1, x = 2), list(level = 2, y = 3), list(l
Barry Rowlingson wrote:
>
>> However, arima crashes for this:
>>
>> arima(c(1.71, 1.78, 1.95, 1.59, 2.13), order=c(1,0,0))
>
> I'm not getting what I'd call 'crashes' with your arma or arima
> examples- I get an error message and a warning:
>
>> arma(c(2.01, 2.22, 2.09, 2.17, 2.42), order=c(1,0)
Barry Rowlingson wrote:
>
> If you're doing anything in a loop that has the potential to fail
> because of singularities or other conditions when your model can't be
> fitted, you need to stick what you are doing in a 'try' clause. This
> lets you trap errors and do something with them.
>
> Pl
.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.01, 0.11, 0.21, 0.31, 0.41,
0.51, 0.61, 0.71, 0.81, 0.91, 0.02, 0.12, 0.22, 0.32,
Is there any R function that generates those sequences?
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/m
The Runuran package includes a simulation for the Triangular Distribution,
urtriang. But I didn't find an analogue of the q* functions (rnorm - qnorm,
runif - qunif), that would invert the CDF (?uqtriang).
Are there any such functions?
Alberto Mon
he transposition of
matrix.in (that is _not_ a matrix) and the pasting of the
lines of matrix.out?
Alberto Monteiro
PS: this is not a homework, this is evangelism to a Visual Basic
programmer :-)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mail
E, col.names = FALSE)
>
Unfortunately, it doesn't work. In fact, read.table(file.in) returns
an error:
Erro em scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
linha 1 não tinha 1362 elementos
which means
line 1 does not have 1362 elements
(whatever that means!)
, like:
"1/2/2003" "0.5638""0.6233""0.4559""0.8746"
I didn't find in the documentation of write.table a way to
remove those quotes, because qmethod is either escape or double :-(
Alberto Monteiro
__
Suppose that I have a matrix like:
m <- rbind(c(1,2,3,4), c(2,3,2,1))
Is there any way to efficiently plot the _lines_ as if
I was doing:
plot(m[1,], type="l")
points(m[2,], type="l", col="red")
(of course, in the "real world" there much more t
I found a curious bug in read.xls. I don't know if it's reproducible.
It's like this: suppose I do a read.xls in a spreadsheet. A column
begins with a number. Then, any strings below it will be rendered as NA.
If the column begins with a string, then it will be rendered corr
Why does as.numeric convert matrices and arrays to vectors?
as.numeric(matrix(c("1", "2", "3", "4"), 2, 2))
[1] 1 2 3 4
I could only figure out ugly ways to bypass this, like:
x <- matrix(c("1", "2", "3", "4"),
Is there any way to _test_ if a given sequence is a
low-discrepancy sequence?
Or, equivalently, is there any way to measure the "discrepancy"
of a sequence?
WTIW, ...
http://en.wikipedia.org/wiki/Low-discrepancy_sequence
... doesn't look like something implementation-friend
elieve it would be too hard to implement metric parameters
in every function.
Maybe Humanity must lose a few more people in airplane crashes
or nuclear plant meltdowns before we ban those unscientific units
from use.
Alberto Monteiro
__
R-help@r-
uot;Entities should not be needlessly multplied" (Occam's Razor),
so let's do it without the explicit mention of f:
Val <- outer(0:n, 0:n, function(j,i) ifelse(j > i, 0, u^j*d^(i-j)))
(if u and d are positive integers, there might be a much
fa
loop is simple, but somehow tricky.
You are computing each j-th term as the same j-th term combined
with the (j+1)-th term. So, you take a combination of js in
the 1:i range and combine with js in the 2:(i+1) range... So:
OVal[1:i, i] <- a*((1-p)*OVal[1:i, i+1] + p*OVal[2:(i+1), i+1
Bert Gunter wrote:
>
> Yes. And, amazingly, one can find out about it by typing
>
> help.search("t distribution") .
>
> Why don't you try it for yourself?
>
Maybe because the obvious search is
help.search("t")
:-)
Alberto Monteiro
_
ust give more information.
How are those numbers distributed? Are they normal? Positive?
If they can be anything, just generate X1, X2 and then compute X3, X4.
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-h
is d2
for (j in 1:length(d1)) { # again
delta.t <- abs(new.dt2[i]$time2 - d1$time1) # get a vector of deltat's
j.min <- which.min(delta.t)
if (delta.t[j.min] <= 15 minutes)
new.d2[i]$time1 <- d1[j.min]$time1
}
}
# and now merge them
". The function to use for testing whether (say)
> 'x' is "NA" is is.na(x).
>
Just as an off-topic tangent, I found it quite interesting
that real-world language Aymara (see ...
http://en.wikipedia.org/wiki/Aymara_language
...) uses this three value logic system (I think
- function(x) x + 1
f2 <- function(x)
# put something here
2 * f1(x)
# probably put something else here too
f2(10)
# 22
f1 <- function(x) x - 1
f2(10)
# 22 - f1 inside f2 does not change
Alberto Monteiro
__
R-help@r-project.org mailing list
https://s
Is there any function to write a XML structure, after it was
read using xmlTreeParse?
Ex:
library(XML)
x <- xmlTreeParse("Irpf2008/aplicacao/dados/12345678901/12345678901.xml")
# write it...
Alberto Monteiro
PS: please, brazilians, don't be offended b
and then I can edit the saved file to cut some extra information
not-xml related (and do what I want - again, sorry for the foul
language).
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
n * t(vectors)))
>
This example only works for _diagonalizable_ matrices. It
crashes, for example, in cases like:
m <- rbind(c(1,1,0), c(0,1,1), c(0,0,1))
m %^% 2
m %*% m
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch
m
# matpow
res=mat.pow(m,6)
# Check point
all.equal(goal,res)
This algorithm would be fast, unless n is a _very_ big number.
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting
tseries, but didn't understant how
the output from its summary relate to the above quantities.
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-projec
out necessarily
> having to move it around in argument lists. In the C community, it
> would be called a "global" variable.
>
Global variables in R are used with <<- instead of <-.
For example:
x <- 1
y <- 1
f <- function() {
x <- 2
y <<
ot;, but the name is misleading: it should
> really be called the "user workspace".
>
Got it.
So, in this case:
x <- 1
f <- function() {
x <- 2
g <- function() {
x <<- 3
}
g()
x
}
f()
It's expected that f will return 3, but x would still be 1?
ng like "if (okpressed) xxx else yyy" What
> values does this command give and how are they used?
>
Why don't you test it yourself?
library(tcltk)
x <- tkmessageBox(title="",message="x",icon="question",type="okcancel&
I need arguments pro-S-PLUS and against SAS for a meeting I will
have next week. S-Plus is (90 - 99)% compatible with R, so using
S-Plus will make things much easier for everyone. But I can't use
this argument. What other arguments could I use?
Alberto Mon
n't_ free memory when it finishes, and
naively says that C is 50 times faster than R?
Alberto Monteiro
__
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/po
#x27; konnte nicht geladen werden
>
Packet 'tcltk' can't be loaded (?)
My guess: check if the above mentioned libraries
exist, and check if there is some file protection.
Probably there's a problem with:
/usr/X11R6/lib/libX11.6.dylib
Alberto Monteiro
PS: is there any way t
d the direction atan2(y',x')
became the hue
Probably you could do the same here, converting height and
value to colors?
OTOH, if it's a function from R^3 to R:
f: (lat, lon, h) -> (value)
then I guess the best way is to replace one dimension to time,
and create animations.
Al
robably brazilian or portuguese. Windows,
in Portuguese, does a very stupid thing (not as stupid as
spaces inside filenames, but a close second): it uses _accented_
characters in filenames and paths. And they are not standard.
So there may be a filename conflict here.
Alberto Monteiro
Is there any (list.files)-like function that sorts the files by
(modification) date?
Alberto Monteiro
__
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
n(x) x-x
>
> no error is generated.
>
> Is this a bug?
>
No; simplify it:
g1 <- function(x) 0
g2 <- function(x) x - x
g1(anything) will return (scalar) 0
g2(scalar) will return (scalar) 0, g2(vector) will return
(vector) 0, g2(matrix) will return (ma
lt;-length(digits)
> if(digilen == 2 && digits[2] == 1) return(teens[digits[1]+1])
> digitext<-units[digits[1]]
> if(digilen > 1) digitext<-c(digitext,tens[digits[2]])
> if(digilen > 2) digitext<-c(digitext,"hundred",units[digits[3]])
> if(
m the original file, because
there are ugly white borders around it.
Alberto Monteiro
__
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
Venus
Aphrodite
1.6
I want to have a list of the planet names in roman, but
x[,1] is not an array of strings, and cat(x[,1]) gives an error.
--- end of fictional message ---
FWIW, the reply to this message is:
y <- as.matrix(x)
cat(y[,1])
Alberto Monteiro
r interface, with R? or I have
> create this interface with other language.
>
> Thank you very much, and I hope that you understand my english.
>
You mean like a GUI? There are many GUI packages in R, probably
the simpler is the tcltk package.
Alberto Monteiro
I just noticed a weird feature in rimage. It seems that, when
reading an image, the line/colums are transposed.
See this reproducible example. The final image should be black - but (as
expected) not an absolute black (mean(z) is 0.015, sd(z) is 0.055 but
max(z) is 1).
Alberto Monteiro
inted at their native resolution.
>
I saw that R can write in SVG format, using the RSVGTipsDevice
library. I think SVG is the closest format to losslessness
when printing.
Of course, my ecological motivation would ban all formats that
make printing easy, to save the environment by saving
10 of the way over from the y
> axis and 1/2 of the way up from the x axis? Thanks.
>
See the help of par:
?par
Namely:
plot(rnorm(100), rnorm(100))
pu <- par()$usr
x <- pu[1] * 0.5 + pu[2] * 0.5
y <- pu[3] * 0.1 + pu[4] * 0.9
text(x, y, "the quick brown fox jum
with x >= 0 in lightgreen. Is there any simple way to
do it?
I think I can do it in two steps:
x.hist <- hist(x, plot=FALSE)
plot(x.hist, col=c(rep("red", 5), rep("green", 12)))
but maybe a more direct way is available.
Alberto Monteiro
___
2008-02-28") - as.Date("2007-02-28"))/365.25)
# 0, should be 1
Alberto Monteiro (purely destructive - sorry)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://w
quot;R rulez!\n"); WordExit()
will prompt for the Yes/No/Cancel prompt, and if I answer "Yes", it opens
the menu to "Save As".
(2) is there any way to write formulas in the evil Word formula format, but
with input as decent latex-like format?
Alberto Monteiro
to
a XML that can be correctly interpreted by MS-Word?
Alberto Monteiro
__
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.
e string <- format(Sys.Date, "%s") (or, generically,
string <- format(sin, "%s"), etc), but it will just put some
description of the function in the string.
Also, the assignment in R is "<-", not "=".
Try:
foot <- function(){
str1 <- forma
probably work, but maybe there's a more direct (and
less memory hungry) option.
Alberto Monteiro
__
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-
mmand...
RSiteSearch("Replacement in an expression - can't use parse()")
... will get it among others)
Quoting and adapting:
e <- expression(1+2*pred+3*lat)
do.call("substitute", list(e[[1]], list(pred=quote(x1),lat=quote(x2
# 1
respond to
> independent throws of 10 dice each time?
>
# get 10*100 random d6s
x <- sample(1:6, 10*100, replace=T)
# transform into a 10 x 100 matrix
y <- matrix(x, 10, 100)
# sum the cols
z <- colSums(y)
Of course, you can combine these three lines into one.
Alberto Monteiro
___
that package actually be useful?)
>
A long time ago, I noticed that programming that I do for fun
is much more useful for my work in the long range than
programming that I do for work; the algorithms and ideas
that we put into gaming or hobbies are usually flawless
and optimized :-)
What are t
X
XXX
X
XXX
(where the border "X"s could be truncated).
I searched the rimage package, but it seems that there is no
such function.
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-hel
Prof Brian Ripley wrote:
>
> Read ?par and the descriptiuon in 'An Introduction to R'. "din",
> "fin", "mai", "omi", "pin" and "usr" are relevant.
>
Is there any hope that, i
o view the probability density function),
it's easy so see that chi2 for large n is normal-like, with
mean close to df, and standard deviation close to sqrt(df).
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/list
that, probably, will appear after this one - Murphy
rulez]
Alberto Monteiro
__
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 comm
hus:
>>
>> par(pin=mm2in(126))
>
> But be sure to use it consistently!
> http://www4.cnn.com/TECH/space/9911/10/orbiter.03/
>
> ;)
>
That's why it should not be done _at all_, and all functions
should have SI inputs (unless you are from Liberia, Myanmar, etc).
Albert
ction
then call
f(...)
Rprof will report that f (and not my.slow.function) was
called .
I noticed that because I "tested" Rprof with one of my
programs that do test cases; these test cases run with
an array of functions, by calling each function from
the array - precisely what can
e user to
create horrible filenames (when I become the World's Evil Overlord,
I will hunt the jerk that introduced whitespaces in filenames, and
send him/her to the paredón), but not under Linux.
Alberto Monteiro
__
R-help@r-project.org mailing l
se
is writen in Excel by people who only knows how to write
Excel spreadshits, and you want to automate the reading
and interpretation of such data so that you, as a R
user, does not have to use Excel to convert the data to
text.
Alberto Monteiro
__
R-hel
t f(x,y) is max
maximize g(x,y) in order to y %means%
(2) for every x, find y = g1(x) such that g(x,y) is max
simultaneously %means%
(3) x = f1(y) and y = g1(x).
So, for your example, we would have:
(1) => x = y
(2) => y = 1
(3) => x = y = 1
Alberto Monteiro
_
value = now,
offvalue = "No time")
# (...)
# display everything
# (...)
tkpack(c2, anchor = 'w', fill = 'x')
# (...)
# enter main event collecting loop - necessary in perl but not in R
I tried to contact the author for permissions to translate, adapt
and post the examples to
it is
evaluated as a Tcl command whenever the entry is invoked. This
is not supported on Windows.
Maybe that's the reason.
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do r
text = "File", underline = 0)
# pack everything from the menubar
tkpack(mb, side = "top", fill = "x")
tkpack(m_file, side = "left")
now create the submenus
# the file menus
#
# HERE!!! What is the magic inchantation that I must use here?
#
# $m_file
eation time" of its objects... but I have
no idea how to do it (I think I could do it in C++, but I am
illiterate in R++ oops S4 classes).
Alberto Monteiro
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do re
.)
>
> Can the same be done for C++ code?
>
If it can be done in C, it probably (P > 99%) can be done in C++,
because C++ can call C functions. Just write the C++ code as:
extern "C" int myfunction(int x1, int x2)
{
// write C++ code here
return rval;
}
Alberto Montei
)
I am using R as a generic programming language for doing
jobs in Windows that I can't do using DOS batch - things
like taking a text in Latin-1 and removing the accented
characters, or looping through a directory and renaming
files with weird names, or creating a .wpl file with th
is easy: the error output should go to 2> and not to >,
like this:
"/usr/bin/R --quiet --slave < /perl/outfiles/Rscript19785065.R
> /perl/outfiles/error19785065.txt 2> error.log"
Alberto Monteiro
__
R-help@r-project.org mailin
adn't known that I could abbreviate
function arguments... Thanks for the (accidental) help :-)
Alberto Monteiro
__
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
ted by
rational numbers is transcendental. The number that gets
the _worse_ approximations is the ubiquitous Golden Ratio:
phi <- (1 + sqrt(5))/2
There's a way to express this precisely, something like
|x - p/q| < 1/q^n (http://en.wikipedia.org/wiki/Liouville
Does anybody know how to deffine in the test tukeyHSD the pairs of
comparison that you want to get? It is throw the lmat commnad, but I
don't know the correct usage...
Thanks a lot!
José
--
MSc José Alberto F. Monteiro
Botanisches Institut
Universität Basel
السلام عليكم
__
I am trying to plot a small graphic inside the graphic area of a bigger
graphic. Does anybody know the commend for that?
Thanks a lot!
--
MSc José Alberto F. Monteiro
Botanisches Institut
Universität Basel
Ø§ÙØ³ÙاÙ
عÙÙÙÙ
[[alternative HTML version deleted]]
_
Dear friends
I am analysing the leaf expansion of a grass species and am interested in
the speed of expansion. I produced exponential models for each of the
treatments and got the equation for leaf size in function of time. I want to
compare the coeficients that gives the initial inclination of the
I am tryindo to do a very simple thing but cannont find how to do it
anywhere. I need to formap part of my title as subscript ans superscript.
How can I do it?
Thanks a lot in advance
José
--
MSc José Alberto F. Monteiro
Botanisches Institut
Universität Basel
[[alternative HTML version d
82 matches
Mail list logo