Hi Christoph,
do you install from sources?
Best
Simon
On Jun 4, 2013, at 10:41 AM, Christoph Knapp christoph.knap...@gmail.com
wrote:
Hi,
reinstalling R did not help. It still will not update the same packages. I
attached the terminal output. There were no errors while I was installing
Dear R forum
I have a dataframe (of prices) as given below -
dat
= data.frame(company = rep(c(A, B, C, D, index), each = 5),
prices = c(runif(5, 10, 12), runif(5, 108, 112), runif(5, 500, 510),
runif(5, 40, 50), runif(5, 1000, 1020)))
company prices
1 A 10.61727
2 A
Put your data in a real time series (xts) object and use the CAPM.*
functions from the PerformanceAnalytics package.
MW
On Tue, Jun 4, 2013 at 10:15 AM, Katherine Gobin
katherine_go...@yahoo.com wrote:
Dear R forum
I have a dataframe (of prices) as given below -
dat
= data.frame(company =
Usually sudo apt-get install ... Sometimes synaptic package manager. I'm
using the
/http://cran.ma.imperial.ac.uk/bin/linux/ubuntu/precise/
http://cran.stat.ucla.edu/bin/linux/ubuntu/precise
repositories. Not sure what the differences are. I had some problems
before when I installed packages
On 04/06/2013 10:50, Christoph Knapp wrote:
Usually sudo apt-get install ... Sometimes synaptic package manager. I'm
using the
So you really do need to discuss this on R-sig-debian, as those OSes
have their own non-R package layout.
Do not expect the R manuals to cover the changes made by
Hello,
A data example would be great. Try the following.
set.seed(71926) # make up some data
dat - data.frame(SIDN = 1:100,
TERM = factor(sample(4, 100, TRUE)),
GRADE = runif(100),
INST = factor(sample(5, 100, TRUE)))
head(dat)
with(dat,
Hi Christoph,
so what you could try to make sure it can run easily on your system is to
install it from sources:
First check if you have at least gcc version 4.7.2:
gcc --version
Open a terminal and type
wget ftp://ftp.stat.math.ethz.ch/Software/R/R-patched.tar.gz
tar -zxvf R-patched.tar.gz
What about a dirty workaround such as using
rm(datasetname)
To erase the dataset from memory and them resaving the workspace?
Em 03/06/2013 21:21, David Winsemius dwinsem...@comcast.net escreveu:
This may not help if the OP is using Mac or Windows since these hidden by
default. Seek out OS
Hi,
Did you try:
update.packages(installed.packages()[,1])
or
install.packages(installed.packages()[,1])
This will reinstall the packages you have on your system and for which
updates for 3.0.1 exist.
In my experience, as recounted here earlier, update.packages()
does not always work: it
Thanks David. I totally forgot that and I had that problem on Windows 3-4 years
ago before moving to linux.
John Kane
Kingston ON Canada
-Original Message-
From: dwinsem...@comcast.net
Sent: Mon, 3 Jun 2013 17:18:24 -0700
To: jrkrid...@inbox.com
Subject: Re: [R] delete active
Hello Rebecca,
Set up your your model as a bivariate VECM (use ca.jo() and create a matrix of
your x and y variables) and invoke alrtest() on the returned object as already
mentioned by you. See the example section of alrtest for how accomplishing this.
Best,
Bernhard
Dr. Bernhard Pfaff
Take a look at lmekin() in the coxme package. The motivating data set for my development
of coxme was the Minnesota Family Breast Cancer project: 24050 subjects in 462 families.
The random effect is an intercept per subject with sigma^2 K as its variance where K is
the kinship matrix (1 for
Correct. You do not seem to understand MCA very well. You have
selected to remove all of the variables from the analysis and then
project them into the space defined by the remaining variables - and
there are NO remaining variables.
-
David L Carlson
Dear R Helpers,
I have a fairly complicated list of data frames. To give you an idea of
the structure, the top of the str output is shown below.
How do I refer to the data.frame name for each data.frame in the list?
That is, how can I pull the terms Advertising2007, AirFreightDelivery2007,
Try
names(ResList)
HTH,
Jorge.-
Sent from my phone. Please excuse my brevity and misspelling.
On Jun 5, 2013, at 12:34 AM, Sparks, John James jspa...@uic.edu wrote:
Dear R Helpers,
I have a fairly complicated list of data frames. To give you an idea of
the structure, the top of the str
On Tue, Jun 4, 2013 at 10:33 AM, Sparks, John James jspa...@uic.edu wrote:
Dear R Helpers,
I have a fairly complicated list of data frames. To give you an idea of
the structure, the top of the str output is shown below.
How do I refer to the data.frame name for each data.frame in the list?
On Jun 3, 2013, at 9:51 PM, arun wrote:
If it is grouped by subid (that would be the difference in the number of
changes)
subset(ddply(df1,.(subid),mutate,delta=c(FALSE,var[-1]!=var[-length(var)])),delta)[,-4]
# subid year var
#3 36 2003 3
#7 47 2001 3
#9 47 2005 1
On Jun 3, 2013, at 9:51 PM, arun wrote:
If it is grouped by subid (that would be the difference in the number of
changes)
subset(ddply(df1,.(subid),mutate,delta=c(FALSE,var[-1]!=var[-length(var)])),delta)[,-4]
# subid year var
#3 36 2003 3
#7 47 2001 3
#9 47 2005 1
Hi,
May be this helps:
dat1- read.csv(dat7.csv,header=TRUE,stringsAsFactors=FALSE,sep=\t)
dat.bru- dat1[!is.na(dat1$evnmt_brutal),]
fun2- function(dat){
lst1- split(dat,dat$patient_id)
lst2- lapply(lst1,function(x) x[cumsum(x$evnmt_brutal==0)0,])
lst3- lapply(lst2,function(x)
Hi!
I'm running a zero-inflated negative binomial regression on a large (n=54822)
set of confidential data. I'm using the code:
ZerNegBinRegress-zeroinfl(Paper~.|., data=OvsP, dist=negbin, EM=TRUE)
And keep getting the error:
Warning message:
glm.fit: fitted probabilities numerically 0 or 1
The barp() function in plotrix seems to handle base substraction:
library(plotrix)
barp(c(2, 3), ylim=c(1, 3.25))
-
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77840-4352
From: Nicole Prause
Hello useRs,
Having trouble getting odfWeave to work here. Crashing at unzipping like noted
in many other posts. The unzip utility referred in the doc no longer exists
(page last updated in 2004 and links are not found.)
If anybody knows how to make it work on XP pls advise. I can manually
Hi, dear list.
I found that hclust causes segfault in R 3.0.1, here is the code after
starting R --vanilla:
test.data - function(dim, num, seed=17) {
set.seed(seed)
matrix(rnorm(dim * num), nrow=num)
}
m - test.data(120, 45)
library(rpud) # load rpud with rpudplus
d -
On Tue, 4 Jun 2013, Carly Bobak wrote:
Hi!
I'm running a zero-inflated negative binomial regression on a large (n=54822)
set of confidential data. I'm using the code:
ZerNegBinRegress-zeroinfl(Paper~.|., data=OvsP, dist=negbin, EM=TRUE)
And keep getting the error:
Warning message:
glm.fit:
Hi,
I am using the densCols to draw a high volume scatter plot. Instead of
using the default local density, I would like to take log of the local
density and then map them to the colors. I could not figure out how to do
that.
For example:
plot(x,y,col=densCols(x,y,log)) ?
Any help would be
Hello,
I am new in R and would be glad for any help.
My question is: Is there any available package to run a multilevel model
(random/fixed effects) with probability weights in R?
I have read an older post from 2011 but thought that perhaps there have been
new developments.
Thank you!
Best,
Dear list,
According to this presentation (
http://www.rinfinance.com/agenda/2010/MarkSeligman_Tutorial.pdf), gpuHclust
in the gputools package should be about 20x faster than clust, but after
some testing, I find it actually 4x slower. Here is the code:
test.data - function(dim, num, seed=17) {
Hi,
By comparing some of the solutions:
set.seed(25)
subid- sample(30:50,22e5,replace=TRUE)
set.seed(27)
year- sample(1990:2012,22e5,replace=TRUE)
set.seed(35)
var1- sample(c(1,3,5,7),22e5,replace=TRUE)
df2- data.frame(subid,year,var1)
df2- df2[order(df2$subid,df2$year),]
HI,
You can do this:
dat1- read.csv(dat7.csv,header=TRUE,stringsAsFactors=FALSE,sep=\t)
dat.bru- dat1[!is.na(dat1$evnmt_brutal),]
fun2- function(dat){
lst1- split(dat,dat$patient_id)
lst2- lapply(lst1,function(x) x[cumsum(x$evnmt_brutal==0)0,])
lst3- lapply(lst2,function(x)
Hi,
Try this:
set.seed(24)
b1- sample(1:40,20,replace=TRUE)
set.seed(28)
a1- sample(30:50,20,replace=TRUE)
t_test_apparie - function(x,y)
{
t.test(x,y,paired=TRUE,alternative = greater)$p.value
}
t_test_apparie(a1,b1)
#[1] 6.571404e-08
A.K.
Hi,
I have written this function :
HI ST,
In case, you wanted to further decrease the time:
library(data.table)
dt1- data.table(df2) #using the same example as below
system.time({
dt1-dt1[,indx:=c(FALSE,diff(var1)!=0),by=subid]
res3-subset(dt1,indx,select=1:3)
})
# user system elapsed
# 0.32 0.00 0.32
head(res3)
#
Since you have sorted the data.frame by 'subid', breaking ties with 'year',
doesn't the following do the same thing as the other solutions.
f4 - function(df) df[ c(TRUE,diff(df$var1)!=0) c(FALSE,diff(df$subid)==0),
]
It gives the same answer for your df2 and is quicker than the others.
Bill
My script fits a third-order polynomial to my data with something like this:
model - lm( y ~ poly(x, 3) )
What I'd like to do is find the theoretical maximum of the polynomial (i.e. the
x at which model predicts the highest y). Specifically, I'd like to predict
the maximum between 0 = x = 1.
Dear friends - I'm on windows 7, R 2.15.2
when I run the example for aareg in survival package I see this:
plot(lfit[4], ylim=c(-4,4))
error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
Is that a matter of an old R?
Best wishes
Troels
On Jun 4, 2013, at 1:36 PM, Troels Ring wrote:
Dear friends - I'm on windows 7, R 2.15.2
when I run the example for aareg in survival package I see this:
plot(lfit[4], ylim=c(-4,4))
error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
Is
Hello,
As for the first question, you can use ?optim to compute the maximum of
a function. Note that by default optim minimizes, to maximize you must
set the parameter control$fnscale to a negative value.
fit - lm(y ~ poly(x, 3))
fn - function(x, coefs) as.numeric(c(1, x, x^2, x^3) %*%
Some possibilities using existing tools.
If you create a file connection and open it before reading from it (or
writing to it), then functions like read.table and read.csv ( and
write.table for a writable connection) will read from the connection, but
not close and reset it. This means that you
1. This looks like a homework question. We should not do homework here.
2. optim() will only approximate the max.
3. optim() is not the right numerical tool for this anyway. optimize() is.
4. There is never a guarantee numerical methods will find the max.
5. This can (and should?) be done
I would like to run a loop in R. I have never done this before, so I would be
very grateful for your help !
1. I have a sample set: 25 objects. I would like to draw 1 object from it
and use it as a test set for my future external validation. The remaining 24
objects I would like to use as a
I would like to run a loop in R. I have never done this before, so I would be
very grateful for your help !
1. I have a sample set: 25 objects. I would like to draw 1 object from it
and use it as a test set for my future external validation. The remaining 24
objects I would like to use as a
This doesn't look like a task you have acquired through a real-life problem...
it looks like homework. There is a stated no-homework policy in the Posting
Guide (please read it), since you should be using the resources provided along
with your educational environment (teaching assistants,
Hi,
May be this helps:
I duplicated your dataset (only one was attached) and changed the dates.
lstf1- list.files(pattern=.txt)
lstf1
#[1] dt3031093-1.txt dt3031093-2.txt dt3031093-3.txt
#3rd one has less number of observations.
fun1- function(lstf){
lst1-lapply(lstf,function(x)
Hi,
Forgot that you wanted the result in a data.frame
fun1- function(lstf){
lst1-lapply(lstf,function(x)
read.table(x,sep=,header=TRUE,stringsAsFactors=FALSE))
lst2- lapply(lst1,function(x) x[x$V1=1961 x$V1=2005,])
lst3- lapply(lst2,function(x) {
Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
exc - list(units=list( c(m^2)) ,vars= list(c('asb')), ,label= list(c('abs
surf body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'
(',exc$units[1],')',sep='')))
plot(1:10,1:10, ylab=parse(text=
Hello,
Example not reproducible:
exc - list(units=list( c(m^2)) ,vars= list(c('asb')), ,label=
list(c('abs surf body')))
Error: object 'm' not found
Regards,
Pascal
On 05/06/13 11:39, Santosh wrote:
Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
I want to generate specific gamma distribution functions, given fixed
parameters.
This is I have k, and theta, say
k - 32.2549 # shape
theta - 26.32809 # scale
# I have an auxiliary function that produces funcions according to
# a given character (this is to have either
Hi A.K,
I go an error on line 24 when processing all the 100 files:
res-fun1(lstf1)
Error in read.table(x, sep = , header = TRUE, stringsAsFactors = FALSE) :
more columns than column names
There seem to be a difference between lstf and lstf1.
Thanks,
Atem.
Hi,
On possibility is:
par(mfrow=c(2,1), mar=c(5.1,5.1,4.1,2.1))
plot(1,1, ylab=expression(a.s.b.~(m^2)))
plot(1,1, ylab=expression(abs~surf~body~(m^2)))
Regards,
Pascal
On 05/06/13 11:39, Santosh wrote:
Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
thx, greg.
chunk boundaries have meanings. the reader needs to stop, and buffer one
line when it has crossed to the first line beyond the boundary. it is also
problem that read.csv no longer works with files---readLines then has to do
the processing. (starting read.csv over and over again with
On Jun 4, 2013, at 8:39 PM, Santosh wrote:
Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
exc - list(units=list( c(m^2)) ,vars= list(c('asb')), ,label=
list(c('abs
surf body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'
Bert Gunter gunter.berton at gene.com writes:
1. This looks like a homework question. We should not do homework here.
2. optim() will only approximate the max.
3. optim() is not the right numerical tool for this anyway. optimize() is.
4. There is never a guarantee numerical methods will find
Dear all,
I have been searching ways to run power analysis for mixed-effects models.
However, I have not been successful
in the research. Today I would like to ask your help. As long as I see from my
search, Martin Julien wrote a package
called pamm for the power analysis. One of the
Manish,
Manish K. Srivastava skrev 2013-06-03 16:19:
Hello R community members,
I'm trying to install the 'rqpd' package which is developed by Roger
Koenker and Stefan Bache. When I try to install the package using the
command 'install.packages(rqpd,repos=http://R-Forge.R-project.org;)'
I'm
Hi all,
I'm struggling with the display of several regression lines (with different
colors) on the same plot.
I manually drew what I'm trying to do with 8 lines (see attached).
Any thoughts for a code will be very much appreciated.
Thanks
Armel
attachment:
Yes,I am new to this method.
Thanks for your reply.
At 2013-06-04 22:26:24,David Carlson dcarl...@tamu.edu wrote:
Correct. You do not seem to understand MCA very well. You have selected to
remove all of the variables from the analysis and then project them into the
space defined by
hi all -- let's say i have the following simplified plyr code:
factor_table - data.frame(dim1 = 1:10, dim2 = 1:4)
foo - maply(factor_table, function(dim1, dim2) list(a = foo, b =
runif(10)))
foo will now be a 10 x 4 x 2 array (of mode 'list'), and i'll have to
access a b element like so:
56 matches
Mail list logo