Why not use the subset option? Something like:
lm(diff ~ Age + Race, data=data, subset=data$Meno==PRE)
should do the trick, and be much easier to read!
On 18/01/07, John Sorkin [EMAIL PROTECTED] wrote:
I am having trouble selecting rows of a dataframe that will be included
in a regression. I
About 3D plots:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/6439.html
Many other plot examples:
http://addictedtor.free.fr/graphiques/allgraph.php
I used rgl, it can produce interactive plots, which can be rotated, increased
and decreased with the mouse.
Hi all R users,
I want to
The statement that it is for windows only in the first link in my previous post
seems to me obsolete now.
Unfortunately, I don't remember exactly, probably, I have used it in Linux.
__
R-help@stat.math.ethz.ch mailing list
Why not use the subset option? Something like:
lm(diff ~ Age + Race, data=data, subset=data$Meno==PRE)
should do the trick, and be much easier to read!
data$ could be omitted, simply
lm(diff ~ Age + Race, data=data, subset=Meno==PRE)
__
On Wed, 17 Jan 2007, Patrick Burns wrote:
A logical reason for the phenomenon is that
matrices are stored down their columns. For
example:
matrix(1:15,5)
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
[4,]49 14
[5,]5 10 15
When an
Thank you guys! I got it.
Best,
Feng
- Original Message -
From: Benilton Carvalho [EMAIL PROTECTED]
To: Feng Qiu [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Thursday, January 18, 2007 12:20 AM
Subject: Re: [R] how to get the index of entry with max value in an array?
Hello all,
When using the 'barplot' function, how would one go about creating
labels on the top of the bars corresponding to the actual frequency
values (i.e., the height of the bar). For histograms, one can use
the 'LABEL=T' parameter to this effect, but it is not available for
barplot.
On 18 Jan 2007, at 08:42, Prof Brian Ripley wrote:
On Wed, 17 Jan 2007, Patrick Burns wrote:
A logical reason for the phenomenon is that
matrices are stored down their columns. For
example:
[snip]
Or that the vision of the original designer was not limited to
matrices.
It just so
Try this where you probably only want one of the last two lines:
# population of 5 US states
pop - state.x77[1:5,1]
bp - barplot(pop, ylim = range(pop) * c(0, 1.1))
text(bp, pop, pop, adj = c(0.5, -0.5)) # place num above bar
mtext(1, at = bp, text = pop, line = 3) # place num below label
On
Probably, you have to manually create, but it is easy:
# for beside=F
mp - barplot(VADeaths)
text(mp,y-t(apply(VADeaths,2,cumsum)),y) # labels are values itself
# or
mp - barplot(VADeaths)
text(mp,t(apply(VADeaths,2,cumsum)),VADeaths) # labels are cumsum of values
# for besides=T
mp -
Justin Gengler wrote:
Hello all,
When using the 'barplot' function, how would one go about creating
labels on the top of the bars corresponding to the actual frequency
values (i.e., the height of the bar). For histograms, one can use
the 'LABEL=T' parameter to this effect, but it is not
How to formulate an analytical gradient?
Suppose I have the following function/expression:
fr-function(x){
x1=x[1]
x2=x[2]
x3=x[3]
x4=x[4]
x5=x[5]
z-((gamma(x1+n)))/((gamma(x1)*factorial(n))*((1+(e/x2))^x1)*((1+(x2/e))^n))
At 08:19 18/01/2007, David Barron wrote:
Why not use the subset option? Something like:
lm(diff ~ Age + Race, data=data, subset=data$Meno==PRE)
should do the trick, and be much easier to read!
And indeed the advice in
library(fortunes)
fortune(dog)
Firstly, don't call your matrix
Thx Jim. The Code works perfect when I run it in a plain way.
It gives a dataframe with 160 columns (like it should)
But when I run the code in a function it gives a dataframe with 161 columns
and the order of the columns has changed into an alfabethical order. Do you
know why this occurs?
I want to modify the arima function. Can anyone can tell me what are the
objects: R_ARIMA_transPars,R_ARIMA_Like, R_ARIMA_Invtrans, R_ARIMA_undoPars...?
Thanks.
best regards.
YG
-
[[alternative HTML version deleted]]
Dear R-people,
I would like to construct a model frame while keeping eventual NA-s in
it. The code looks like in lm():
m - match(c(formula, data, subset, weights, na.action,
offset), names(mf), 0)
mfO - mf[c(1, m)]
mfO$drop.unused.levels - TRUE
mfO[[1]] -
Dear Peter,
The file that I'm reading contains the upstream regions of the yeast
genome, with each upstream region labeled using a FASTA header, i.e.:
FASTA header for gene 1
upstream region.
.
FASTA header for gene 2
upstream
you may
On Thu, 2007-01-18 at 04:49 +, Prof Brian Ripley wrote:
One thing to watch with experiments like this is that the locale will
matter. Character operations will be faster in a single-byte locale (as
used here) than in a variable-byte locale (and I suspect Seth and Marc
used UTF-8), and
Dear R Users,
I request your help to optimize a loop.
Given a series of observations, I want to know how many consecutive past
observations are below the last one.
e.g :
my_series - c(3, 4, 10,14,8,3,4,6,9)
As the last number (9) is higher than the four preceding numbers (6, 4, 3, 8),
this
On Thu, 18 Jan 2007, Ott Toomet wrote:
Dear R-people,
I would like to construct a model frame while keeping eventual NA-s in
it. The code looks like in lm():
m - match(c(formula, data, subset, weights, na.action,
offset), names(mf), 0)
mfO - mf[c(1, m)]
Hi
discard your loop do not optimise it.
rle is your friend
my_fun-function(x) {
+
+ len-length(x)
+ x1-rle(x[len]x[1:len-1])
+ last-length(x1$values)
+ ifelse(x1$values[last],x1$lengths[last],0)
+ }
my_fun(my_series)
[1] 0
my_series - c(3, 4, 10,14,8,3,4,6,9)
my_fun(my_series)
[1] 4
and
Hi,
I updated my os to freebsd 6.2 and built R-patched with no changes in
configure. I pass make check and copy the R executable to
/usr/local/bin/R. Then when I start R, I get
/libexec/ld-elf.so.1: Shared object libRblas.so not found, required by R
and have to copy/link the two shared object
Nicolas Prune wrote:
Dear R Users,
I request your help to optimize a loop.
Given a series of observations, I want to know how many consecutive past
observations are below the last one.
e.g :
my_series - c(3, 4, 10,14,8,3,4,6,9)
As the last number (9) is higher than the four
Petr Pikal schrieb:
Hi
discard your loop do not optimise it.
rle is your friend
I do not agree. For some purposes, an efficient loop is faster. IMHO
this is one of these purposes.
I propose the following modification of the loop (to increase speed):
myfun1 - function(series=c(3, 4,
Thanks to all for your insightful comments. I must admit I was unaware
of the application to arrays.
Ben
Prof Brian Ripley wrote:
Or that the vision of the original designer was not limited to
matrices. It just so happens that in this example the replacement is a
single dimension the same
Hi,
Hiroyuki Kawakatsu wrote:
Hi,
I updated my os to freebsd 6.2 and built R-patched with no changes in
configure. I pass make check and copy the R executable to
/usr/local/bin/R. Then when I start R, I get
/libexec/ld-elf.so.1: Shared object libRblas.so not found, required by R
and have
Sorry, I accidentaly lost one line of the function code (result -0),
see below...
Regards, Martin
Martin Becker schrieb:
myfun1 - function(series=c(3, 4, 10,14,8,3,4,6,9)) {
result - 0# NEW
len-length(series)
for (i in (len-1):1)
{
if
On Thu, 18 Jan 2007, Hiroyuki Kawakatsu wrote:
Hi,
I updated my os to freebsd 6.2 and built R-patched with no changes in
configure. I pass make check and copy the R executable to
/usr/local/bin/R. Then when I start R, I get
/libexec/ld-elf.so.1: Shared object libRblas.so not found,
Hello
I have a rather simple code and for some reason it produces an error
message. If someone can tell me why and how to fix it, I would be very
greatful. Thank you in advance.
# create data
set.seed(10)
n - 200 # number of training points
n.test - 200 #
I have a dataset like this:
IDvalue week of visit
1 4.2 0 (baseline)
1 2.5 6
1 4.1 10
1 3.0 12
.
.
.
And so on for more than 11000 records (more than 1000 subjects). I need to
add rows in order
I have what is probably a very simple problem but I would be very
grateful to the list for any help or pointers to implement a solution in
R.
We have two types of measurements on the eye that we have collected in
62 patients at 5 fixed time points during a clinical visit over an
office day. We
Thanks to everyone who answered, in public or in private.
I successfully rewrote my function with rle.
For my sample, the total computation times (I call this function around 1000
times) are roughly the same. However, I thank you for letting me know rle, and
S Poetry.
Regards,
Nicolas
This should get you started
tmp - data.frame(y1=rnorm(62*5),
y2=rnorm(62*5),
time=rep(1:5, 62),
id=factor(rep(1:62, each=5))
)
xyplot(y1 ~ y2 | id, data=tmp, group=time, pch=as.character(1:5))
tmp.aov - aov(y1 ~
Try this. It does a small sample with 15 weeks and only 10 patients, but
the algorithm is easily changed for 52.
require(zoo) # need the 'zoo' library for 'na.locf'
# create test data
visits - data.frame(id=rep(1:10, each=10),value=runif(100),
week=sample(1:15,100,TRUE))
# removed duplicated
Hi,
I have a question about the function lme() in R.
I have a 2*2*3 layout with some missing data (labelled as *). These 3
factors are labelled as A,B,C, the response is Score. The layout is as
follows:-
A B CScore
1 1
Aov is not the right function for this problem. Lmer is designed for
multilevel modeling. There are a lot of resources, but start with the
following vignette
Library(lme4)
vignette(MlmRevSoft)
And then turn to Pinhiero and Bates
-Original Message-
From: [EMAIL PROTECTED]
Folks,
The betareg package appears to be polished and works well. But I would
like to look at the exact formulas for the underlying model being
estimated, the likelihood function, etc. E.g. if one has to compute
\frac{\partial E(y)}{\partial x_i}, this requires careful calculations
through these
--
Hello,
I am attempting to fit monthly stock returns to possible copula functions using
the copula package in R. Below is my code (mat2 is a 2x119 matrix of the two
stock returns):
my.cop - normalCopula(param=.3, dim = 2, dispstr = un)
myfit - fitCopula(mat2,my.cop, start=.65,
On 1/18/07, w jj [EMAIL PROTECTED] wrote:
I have a question about the function lme() in R.
I have a 2*2*3 layout with some missing data (labelled as *). These 3
factors are labelled as A,B,C, the response is Score. The layout is as
follows:-
A B C
On Thu, 2007-01-18 at 20:00 +0530, Ajay Narottam Shah wrote:
Folks,
The betareg package appears to be polished and works well. But I would
like to look at the exact formulas for the underlying model being
estimated, the likelihood function, etc. E.g. if one has to compute
\frac{\partial
What else should I be reading about beta regressions? :-)
Ajay,
you could begin by reading the paper cited in betareg package:
FERRARI, S.L.P., CRIBARI-NETO, F. (2004).
Beta regression for modeling rates and proportions.
Journal of Applied Statistics, v. 31, n. 7, p. 799-815
I'd bet that there
this command is used in tseries
adf.test(x, alternative = c(stationary, explosive),
k = trunc((length(x)-1)^(1/3)))
this command apply adf test on data given in x .here general
equatiuon
that is, equation with constant and trend is used.if i did not include
constant or trend
On Thu, 18 Jan 2007, Hiroyuki Kawakatsu wrote:
On 1/18/07, Prof Brian D Ripley [EMAIL PROTECTED] wrote:
The R front end sets LD_LIBRARY_PATH to include the place it puts libR.so.
It looks like that is not effective on your machine, but you will have to
investigate for us why. I am pretty
On 1/18/07, Prof Brian D Ripley [EMAIL PROTECTED] wrote:
The R front end sets LD_LIBRARY_PATH to include the place it puts libR.so.
It looks like that is not effective on your machine, but you will have to
investigate for us why. I am pretty sure other FreeBSD users (6.2 and 7)
on AMD64
Prof Brian Ripley wrote:
On Mon, 15 Jan 2007, Ulrich Keller wrote:
Hello everyone,
I use latex() (Hmisc) for report generation and thus have been affected by
the problem with rounding decimals described, for example, in this post:
On Thu, 18 Jan 2007, Charles Dupont wrote:
Prof Brian Ripley wrote:
On Mon, 15 Jan 2007, Ulrich Keller wrote:
Hello everyone,
I use latex() (Hmisc) for report generation and thus have been affected by
the problem with rounding decimals described, for example, in this post:
Hi.
I'm checking into robust methods for principal components analysis. There
seem to be several floating around. I'm currently focusing my attention on
a method of Hubert, Rousseeuw, and Vanden Branden
(http://wis.kuleuven.be/stat/Papers/robpca.pdf) mainly because I'm familiar
with other
Hello!
I need to perform weighted multidimensional scaling analysis(WMDS). I did
rsitesearch, googled, but I could find no info on how to perform WMDS using R.
In several places they say it is possible with the ALSCAL algorithm, but I
could not find the relevant function to carry it out.
Is there an R package that can model time series with multiple seasonal
cycles, e.g., 7 wkdy x 24 hr , I have tried searching the Help, but have
been unable to find anything. Any help would be appreciated.
thank you,
Spencer
[[alternative HTML version deleted]]
Hello.
--- Martin Ivanov [EMAIL PROTECTED] wrote:
I need to perform weighted multidimensional scaling
analysis(WMDS). I did rsitesearch, googled, but I
could find no info on how to perform WMDS using R.
In several places they say it is possible with the
ALSCAL algorithm, but I could not
Hello everybody,
I'm using rpart to fit a classification tree. I'm interested in the
way rpart estimates the class membership probabilities. Does it
implement the Laplace correction rule? Is there any parameter I can
use to ask rpart to do that?
I was not able to find this option in the manual
I must express thanks to Peter Konings, Gary Collins, David Barron,
Prof. Brian Ripley, Vladimir Eremeev, and Michael Dewey (I hope I did
not leave anyone out) all of whom suggested I used the subset parameter
of lm to restrict the subjects included in my lm. R is a special
programming language
I am trying to read an ftable using read.ftable, but I get the
following error message:
jobSatTable -
read.ftable(http://definetti.uark.edu/~gpetris/stat5333/jobSatisfaction.dat,skip=2)
Error in seek(file, where = 0) : no applicable method for seek
In addition: Warning messages:
1: no
A further note. The Cushny Peebles article can be viewed here:
http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1465734
and the page with the data is here:
http://www.pubmedcentral.nih.gov/pagerender.fcgi?artid=1465734pageindex=9
A machine readable version of the
You seem not to have received a reply.
You can use cov.rob in MASS or cov.Mcd in robustbase or undoubtedly others
to obtain a robust covariance matrix and then use that for PCA.
-- Bert
Bert Gunter
Nonclinical Statistics
7-7374
-Original Message-
From: [EMAIL PROTECTED]
Hi Bert.
Thank you, that sounds like an excellent idea. After my initial post, I
also found an implementation of ROBPCA in S-PLUS at
(http://wis.kuleuven.be/stat/robust/programs.html).
-- TMK --
212-460-5430home
917-656-5351cell
From: Bert Gunter [EMAIL PROTECTED]
To: 'Talbot
Hi all.
I'm trying to numerically invert the characteristic function
of a quadratic form following Imhof's (1961, Biometrika 48)
procedure.
The parameters are:
lambda=c(.6,.3,.1)
h=c(2,2,2)
sigma=c(0,0,0)
q=3
I've implemented Imhof's procedure two ways that, for me,
should give the same
The do give the same answer, unfortunately the examples you sent were not
the same. Integral2 was missing a 'sin'. So I would assume there might be
something else wrong with your functions. You might want to try breaking it
down into smaller steps so you can see what you are doing. It
I asked the maintainer and he indicated that it might be a dll problem. Has
anyone see this problem? I had installed the latest copy of tkrplot. I was
trying to use teachingDemos when I first got the error.
On 1/18/07, Luke Tierney [EMAIL PROTECTED] wrote:
Looks like tcl can't find the dll
On 1/18/2007 8:57 PM, jim holtman wrote:
I asked the maintainer and he indicated that it might be a dll problem. Has
anyone see this problem? I had installed the latest copy of tkrplot. I was
trying to use teachingDemos when I first got the error.
I just installed tkrplot in R 2.4.1 and it
Like kile for LaTeX, Linux/KDE's kate editor is an excellent editor for
R, with easy code submission to a running R process. Syntax
highlighting is good. I have not been able to figure out two things:
- how to automatically reformat a line or region of text using good
indentation rules
Hello,
I'm doing some scripting and I've noticed that R doesn't seem to
have an
if (cond){
do
}ifelse (cond) {
do
} else {
do
}
type block.
Is this correct or am I missing something.
THX
Paul
--
Research Technician
Mass Spectrometry
o The
/
o Scripps
\
o Research
G'day Martin and others,
On Thu, 18 Jan 2007 15:22:07 +0100
Martin Becker [EMAIL PROTECTED] wrote:
Sorry, I accidentaly lost one line of the function code (result -0),
see below...
But even with that line, the code doesn't work properly. :)
Since you changed the order of the for loop (from i
On Thu, 18 Jan 2007 19:02:49 -0800,
H. Paul Benton [EMAIL PROTECTED] wrote:
Hello,
I'm doing some scripting and I've noticed that R doesn't seem to
have an
if (cond){
do
}ifelse (cond) {
do
} else {
do
}
type block.
It's legal to join if else statements together:
On my system it is not set: so it must be something else. It happens on
both of my windows systems. Guess I will have to look somewhere else to see
what might be missing.
.Platform
$OS.type
[1] windows
$file.sep
[1] /
$dynlib.ext
[1] .dll
$GUI
[1] Rgui
$endian
[1] little
$pkgType
[1]
On Thu, 2007-01-18 at 20:30 -0600, Frank E Harrell Jr wrote:
Like kile for LaTeX, Linux/KDE's kate editor is an excellent editor for
R, with easy code submission to a running R process. Syntax
highlighting is good. I have not been able to figure out two things:
- how to automatically
Hi my friends,
I have an issue with ability estimates when running GRM of IRT. I
have responses from 242 subjects but got 183 ability estimates.
Below is what I did to get the estimates.
1) I have a csv file P1.csv and I imported it into R and loaded
the ltm package by doing:
As it happens I used TeachingDemos/tkrplot on Windows (R 2.4.1) with a
class example yesterday.
It looks to me as if the issue is in the R installation. Remember that Tcl
support is optional when R is installed, and can be influenced by
environment variables. So my first check would be that
Consider a matrix like
ma = matrix(10:15, nr = 3)
ma
[,1] [,2]
[1,] 10 13
[2,] 11 14
[3,] 12 15
I want to rearrange each column according to row indexes (1 to 3)
given in another matrix, as in
idx = matrix(c(1,3,2, 2,3,1), nr = 3)
idx
[,1] [,2]
[1,]12
You cannot seek on a url() connection. Try downloading the file and
reading it locally.
There's a bug in the function which forgets to open its temporary file: I
will attend to that.
On Thu, 18 Jan 2007, Giovanni Petris wrote:
I am trying to read an ftable using read.ftable, but I get the
On Fri, 19 Jan 2007, Prof Brian Ripley wrote:
You cannot seek on a url() connection. Try downloading the file and reading
it locally.
You will need to edit it to fit the ftable format as well.
There's a bug in the function which forgets to open its temporary file: I
will attend to that.
71 matches
Mail list logo