Perhaps something along the lines of (untested)
t(apply(yourdata[, -1], 2, function(x) diff(log(x
is what you are looking for. See ?apply, ?diff and ?t for more
information.
HTH,
Jorge.-
On Thu, Jul 5, 2012 at 12:58 AM, Akhil dua <> wrote:
> Hello Every one
> I have data on Stock prices
Hello Every one
I have data on Stock prices and I want to calculate the return on all the
stocks
and then replace all the stock prices with the returns
can any one tell me how to do
My data is in the format given below
Date Stock1 Stock2 Stock3
01/01/20001 2
On Thu, Jul 5, 2012 at 11:40 AM, jacquesliu wrote:
> I was asked to do a WLS estimation, so I thought of lm() with weights like
> wls=lm(Y~X-1,weight=INC)
>
> however, it gives different result as below code, which use the formula of
> WLS
> y<-Y*INC^-0.5
> x<-X*INC^-0.5
> wls=lm(y~x-1)
>
> Can an
Dear Paul,
Thank you for your suggestion. I was moved by the fact that people are so
nice to help learners and ask for nothing.
With your help, I made some changes to my code and add more comments, try
to make things more clear.
If this R email list allow me to upload a pdf file to illustrate the
Hello,
A short code to include real monthly calendar to your data, similar to
the one inside NCEP2 reanalysis.
library(ncdf)
lon <- seq(from=140.0251, to=146.6751, length.out=241)
lat <- seq(from=-38.975, to=-31.025, length.out=160)
x=dim.def.ncdf("Lon","degreesE",as.double(lon))
y=dim.def.nc
I was asked to do a WLS estimation, so I thought of lm() with weights like
wls=lm(Y~X-1,weight=INC)
however, it gives different result as below code, which use the formula of
WLS
y<-Y*INC^-0.5
x<-X*INC^-0.5
wls=lm(y~x-1)
Can anybody explain to me why the first code can not give the right answer?
Apologies to Bert, I see now that "market" is a variable in the
dataset, not a generic name for market indicators. lm() with a matrix
as the outcome seems the best approach here.
Josh
On Wed, Jul 4, 2012 at 12:12 PM, Joshua Wiley wrote:
> On Wed, Jul 4, 2012 at 11:48 AM, Bert Gunter wrote:
>>
HI Bert
Thanks for the reply. You are right. In the case if it was a matrix, then lm
automatically fits each column.
Stocks<-dat1[,2:4]
> is.matrix(Stocks)
[1] FALSE
> is.data.frame(Stocks)
[1] TRUE
#Not working
models<-lm(Stocks~Market,data=dat1)
Error in model.frame.default(formula = Sto
I played around with this for a while with no success at all. I'd suggest
posting the question on the ggplot2 newsgroup in Google Groups
John Kane
Kingston ON Canada
> -Original Message-
> From: thorn.tha...@rdls.nestle.com
> Sent: Tue, 3 Jul 2012 18:50:52 +0200
> To: r-help@r-project.o
Thanks for the response. It turns out it was not a problem of R but the
problem on setting options in R studio :(
Thank you!
On Wed, Jul 4, 2012 at 2:25 PM, Peter Ehlers wrote:
> On 2012-07-04 11:25, Soyeon Kim wrote:
>
>> Hi.
>> I am trying to generate a correlated binary data set.
>> I've trie
On 2012-07-04 03:39, Tamara Hunjak wrote:
HI to you all!
I have problem with quilt.plotthis is the code:
quilt.plot(long_gridded,lat_gridded,d18O_gridded,nrow=n,ncol=m,xaxt='n',yaxt='n',xlab=NA,
ylab=NA,breaks=seq(d18O_gridded_1,d18O_gridded_2,length.out=number_colors),col=col,horizontal=FAL
On 2012-07-04 11:25, Soyeon Kim wrote:
Hi.
I am trying to generate a correlated binary data set.
I've tried to use mvtBinaryEP, binarySimCLF, and bindata packages but none
of them works in R version 2.15.1.
[...]
You'll have to be more forthcoming about what you mean
by "works". What error is p
On Wed, Jul 4, 2012 at 11:48 AM, Bert Gunter wrote:
> Please carefully read ?lm. As I previously told the OP, no looping/apply is
> necessary. The left hand side of the lm formula can be a matrix for which
> separate fits will be done on each column automatically.
Which is a great option if the d
A simple approach is to generate correlated normal data (mvrnorm
function in MASS package is one way), then use a cut-off to convert
them to binary.
On Wed, Jul 4, 2012 at 12:25 PM, Soyeon Kim wrote:
> Hi.
> I am trying to generate a correlated binary data set.
> I've tried to use mvtBinaryEP, bi
As has been mentioned, the windows GUI will not do this for you, but
here are some options.
You can save or copy the transcript file and load it into an R syntax
aware editor (e.g. emacs with ess and others) which will do the
coloring/formatting for you and may be able to print with the
coloring.
Please carefully read ?lm. As I previously told the OP, no looping/apply is
necessary. The left hand side of the lm formula can be a matrix for which
separate fits will be done on each column automatically.
-- Bert
On Wed, Jul 4, 2012 at 9:44 AM, arun wrote:
>
>
> Hi,
>
> You could also use:
>
1. This is a statistical question. Please do not post further to this list.
It is about R, and you have summarily dismissed all attempts to answer your
R questions as unhelpful. So you need to look elsewhere.
2. Consult a statistician -- you use the statistical words, but do not
understand what th
Hi.
I am trying to generate a correlated binary data set.
I've tried to use mvtBinaryEP, binarySimCLF, and bindata packages but none
of them works in R version 2.15.1.
Do you know any package to generate correlated binary covariates and work
in R version 2.15.1, or how to generate it?
Thanks,
The usual terminology uses the number of "ways" to mean the number of
factors (categorical
or classification variables, with more than one degree of freedom per
factor).
The term covariate is used for continuous variables, with exactly one df.
On Wed, Jul 4, 2012 at 9:20 AM, syrvn wrote:
> Hi!
>
Hello,
Try
makeFunction <- function(x) eval( parse(text=x) )
name <- 'hdev'
nlminb(c(9, 12), objective = makeFunction(name))
Hope this helps,
Rui Barradas
Em 04-07-2012 17:37, Freddy Hernández escreveu:
Hello
I want to use the nlminb function but I have the objective function like
charact
Hello,
You can use .filled.contour (with initial dot) with par. I've tested it
with one of the help page examples, reformulated to use the args of
.filled.contour and it works.
x <- y <- seq(-4*pi, 4*pi, len = 100)
r <- sqrt(outer(x^2, y^2, "+"))
z <- cos(r^2)*exp(-r/(2*pi))
zlim <- range(z
Dear Freddy,
Thank you for the explanation and the reproducible example. You can use
get() as follows:
nlminb(c(9, 12), objective=get(name))
Regards,
Jorge.-
On Wed, Jul 4, 2012 at 12:37 PM, Freddy Hernández <> wrote:
> Hello
>
> I want to use the nlminb function but I have the objective fu
Hi,
You could also use:
dat1 <- read.table(text="
Date Stock1 Stock2 Stock3 Market
01/01/2000 1 2 3 4
01/02/2000 5 6 7 8
01/03/2000 1 2 3 4
01/04/2000 5
Hello
I want to use the nlminb function but I have the objective function like
characters. I can summarize the problem using the first example in the
nlminb documentation.
x <- rnbinom(100, mu = 10, size = 10)
hdev <- function(par) -sum(dnbinom(x, mu = par[1], size = par[2], log =
TRUE))
nlminb
Dear Ajay Ohri,
Re:
> Dear List,
>
> Say I can use getwd() and setwd() to change my working directory. How can I
> read in all the files within that directory using command line (like a ls()
> but for the path specified)
>
I use this function,
# functions
getFolder <- function(pat)
{
Hi,
Thanks for your explanation. But still I didn't get the answer which I need.
You have mentioned the code which can obtain AIC values for all models at once.
My question is; the procedure of selecting the suitable model to predict using
R package.
If I select the model which produces the sm
Dear Sir/Madam,
I am desperately in need of some help. I am trying to access tables from
the oracle database and inserting them into R via a data frame and I keep
getting an error saying that "Error in .Call(C_RODBCFetchRows,
attr(channel, "handle_ptr"), max, buffsize, :
negative length vectors
One basic and very good one is
Cleveland, W. S. (1985). The Elements of Graphing Data. Wadsworth, Inc.
John Kane
Kingston ON Canada
> -Original Message-
> From: comtech@gmail.com
> Sent: Tue, 3 Jul 2012 18:12:00 -0500
> To: r-h...@stat.math.ethz.ch
> Subject: [R] Help! Please recomm
On Mon, Jul 02, 2012 at 06:11:37AM -0700, khris wrote:
> Hi, Petr,
>
> >
> > Hi Khris:
> >
> > If i understand the problem correctly, you have a list of (x,y)
> > coordinates, where
> > some sensor is located, but you do not know, which sensor is there. The
> > database
> > contains data fo
pboot is the proportion of the sample to select, and so if it's
greater than or equal to 1 you're using the entire sample rather than
a subsample, so of course the limits are equal.
If you look at the usage line in the help for mantel, where defaults
are given, the default for pboot = 0.9.
The de
Also look at auto.arima in the forecast package.
Michael
On Jul 4, 2012, at 4:38 AM, Rui Barradas wrote:
> Hello,
>
> Put the fitted models in a list and then use lapply with AIC(). Like this
>
>
> set.seed(1)
> x <- 1:100 + sqrt(1:100 + runif(100)) + rnorm(100)
> models <- list()
> models[
Either dir() or list.files()
Michael
On Jul 4, 2012, at 8:24 AM, Ajay Ohri wrote:
> Dear List,
>
> Say I can use getwd() and setwd() to change my working directory. How can I
> read in all the files within that directory using command line (like a ls()
> but for the path specified)
>
> Regard
Hi Pascal,
I think I figure it out.
By doing the following, I can made "lon" & "lat" become a class of
dim.ncdf:
lon <- seq(from=140.0251, to=146.6751, length.out=241)
lat <- seq(from=-38.975, to=-31.025, length.out=160)
x=dim.def.ncdf("Lon","degreesE",as.dou
On Jul 4, 2012, at 15:24 , Ajay Ohri wrote:
> Dear List,
>
> Say I can use getwd() and setwd() to change my working directory. How can I
> read in all the files within that directory using command line (like a ls()
> but for the path specified)
Something like
all <- lapply(list.files(), read.
By interpreting the code line by line and looking at the output of the lines, I
got the
following result. It looks like it needs the fifu converted to an expression,
then
evaluated. This suggests a workaround, but doesn't answer the underlying
question about
whether this is supposed to work this
On Jul 4, 2012, at 15:20 , syrvn wrote:
> Hi!
>
> as my subject says I am struggling with the different of a two-way ANOVA and
> a (two-way) ANCOVA.
>
> I found the following examples from this webpage:
>
> http://www.statmethods.net/stats/anova.html
>
> # One Way Anova (Completely Randomized
How you "read all ... files" is up to you, as that depends both on the type of
data contained in the files and on how you plan to use the data.
Most likely the solution will involve using the files.list function and either
lapply or a for loop, and the data will end up stored in a list of data
John Kane
Kingston ON Canada
> Who are the authors of the R package poLCA.
>From the R CRAN site
Author: Drew Linzer, Jeffrey Lewis.
Maintainer: Drew Linzer
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & o
R does not parallelize its operation automatically... you have to use R code
that splits the work you give it into multiple tasks.
See ?parallel
---
Jeff NewmillerThe . . Go Live...
Dear List,
Say I can use getwd() and setwd() to change my working directory. How can I
read in all the files within that directory using command line (like a ls()
but for the path specified)
Regards
Ajay
Websites-
Technology
http://decisionstats.com
[[alternative HTML version deleted]]
Dear List,
Say I can use getwd() and setwd() to change my working directory. How can I
read in all the files within that directory using command line (like a ls()
but for the path specified)
Regards
Ajay
Websites-
Technology
http://decisionstats.com
On Wed, Jul 4, 2012 at 3:30 PM, wrote:
Hi!
as my subject says I am struggling with the different of a two-way ANOVA and
a (two-way) ANCOVA.
I found the following examples from this webpage:
http://www.statmethods.net/stats/anova.html
# One Way Anova (Completely Randomized Design)
fit <- aov(y ~ A, data=mydataframe)
# Randomized Blo
On 04.07.2012 12:39, Tamara Hunjak wrote:
HI to you all!
I have problem with quilt.plotthis is the code:
quilt.plot(long_gridded,lat_gridded,d18O_gridded,nrow=n,ncol=m,xaxt='n',yaxt='n',xlab=NA,
ylab=NA,breaks=seq(d18O_gridded_1,d18O_gridded_2,length.out=number_colors),col=col,horizontal=F
This came through unformatted. Please fix. I won't look into it this way.
And please send plain text only.
Best,
Uwe Ligges
On 02.07.2012 22:28, bo yu wrote:
Dear all,I am a new user of WinBUGS and need your help. After running the following
code, I got parameters of beta0 through beta4 (
On 04.07.2012 14:44, cindy.dol wrote:
Hi,
I would like to run R with a script from MS-DOS.
I don't even know how to compile R for MS-DOS to run it under that OS. I
am using R since 1998, but we used 64-bit Solaris or 32-bit Linux or
Windows systems at the time, but no DOS left.
R is in
Hi Pascal,
Thanks a lot for your reply.
Then the problem become "lon" & "lat" no longer be a class of dim.ncdf,
they can not be used in var.def.ncdf.
Is there any way that can made "lon" & "lat" become a class of dim.ncdf?
Many thanks,
Jun
> Date: Wed, 4 Jul 2012 1
Hi,
I would like to run R with a script from MS-DOS.
R is in "My Documents "and my script too.
How to do?
--
View this message in context:
http://r.789695.n4.nabble.com/MS-DOS-script-R-tp4635398.html
Sent from the R help mailing list archive at Nabble.com.
___
Dear R users,
I have noted a difference in the merge distances given by hclust using
centroid method.
For the following data:
x<-c(1009.9,1012.5,1011.1,1011.8,1009.3,1010.6)
and using Euclidean distance, hclust using centroid method gives the
following results:
> x.dist<-dist(x)
> x.aah<-hclus
On Jul 3, 2012, at 9:01 PM, Jonathan Hughes wrote:
Dear all,
I can't figure out a way to have more than one plot using
filled.contour() in a single plate. I tried to use layout() or
par(), but the way filled.contour() is written seems to override
those commands.
Any suggestions would be
Dear Laurent,
An R proces uses only one core. It is possible to use multiple cores. Have a
look at he Hig-Performance and Parallel Computing task view
(http://cran.freestatistics.org/web/views/HighPerformanceComputing.html)
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en
HI to you all!
I have problem with quilt.plotthis is the code:
quilt.plot(long_gridded,lat_gridded,d18O_gridded,nrow=n,ncol=m,xaxt='n',yaxt='n',xlab=NA,
ylab=NA,breaks=seq(d18O_gridded_1,d18O_gridded_2,length.out=number_colors),col=col,horizontal=FALSE,nlevel=number_colors
-
1,legend.args=l
Hi,
this happen when two or more packages have functions with the same names.
Using search() you can see which package are loaded in your working
environment. Thus, using the name of the function will call the function of
the first package you see in the search output.
To use a specific function y
Dear Jun
I think you should consider to submit your question to R-SIG (special
interest group) about spatial data
http://r-sig-geo.2731867.n2.nabble.com/
This will improve the probability you get some help.
Cheers
Giuseppe Calamita
-
Giuseppe Calamita
PhD at CNR-IMAA Italian National Co
My problem is I have data with both categorial and numerical data,
currently only the categorical number contains missing data, was wondering
do I make a new dataframe containing only the categorical columns?
How would you use Latent Class Model specifically poLCA to impute the
missing data?
http:
I am currently running an R program on a computer with 16 Gb memory (Windows7,
64 bit). When I look at the task manager, I see that only 4 out of the 8 CPUs
are being used. Is this due to some missing in the R code, or should I change
something to the settings of the computer?
Laurent Franckx,
I would try first without the task scheduler:
Make a .bat file and run this from the command line.
This way you can see what is going on without the flashing window that is
opened and closed immeadiately.
maviney wrote
>
>
> I tried to task schedule, using the following code
>
> "C:\Program F
Using dev.hold() and dev.flush() immediately gave a huge improvement in
appearance.
Adding code to use contourLines() just once, and then plotting the saved lines
at each step gave the final polish.
Many thanks Bob Kinley
-Original Message-
From: r-help-boun...@r-project
On 03.07.2012 02:13, Duncan Murdoch wrote:
On 12-07-02 2:05 PM, Erin Hodgess wrote:
Dear R People:
I'm installing R 2-.15.1 on a Windows 32 bit machine from source.
I'm getting a strange error about init.win (please see below)
Does this look familiar to anyone, please?
Yes, a file was mis
I would guess that that highly depends on
-what exact "console" you have
-where exactly you paste it
For example, if i copy stuff from my console (Eclipse plugin StatEt) into this
Mailprogram, it is still colored.
With programs similar to word, they usually have paste options that tell you
what
On 04.07.2012 08:46, amarjit chandhial wrote:
Hi,I
want to be able to print in colour from the R console i.e. commands (in navy)
with
results (in red) as on the console.
From
the console if I click on File -> Print, the commands with results print
on my printer but only in monochrome, not in
Julien Moeys:
ok, I see what is the problem,
Your example does not work because MS Access is trying to "update" values in
your table according to the ID you provide
So when you provide for instance ID = 1, MS Access will look in the table
for an existing record(s) that have an ID of 1, and repla
Hello,
Following lines are wrong:
> x=dim.def.ncdf("Lon","degreesE",140.0251:146.6751)
> y=dim.def.ncdf("Lat","degreesN",(-31.025):(-38.975))
You have 241 longitudes and 160 latitudes.
lon <- seq(from=140.0251, to=146.6751, length.out=241)
lat <- seq(from=-38.975, to=-31.025, length.out=160)
Reg
Hello,
Put the fitted models in a list and then use lapply with AIC(). Like this
set.seed(1)
x <- 1:100 + sqrt(1:100 + runif(100)) + rnorm(100)
models <- list()
models[[1]] <- arima(diff(x), order = c(1, 0, 0)) # Just to show
models[[2]] <- arima(diff(x), order = c(1, 0, 1)) # several
models[
Hi,
I need to predict exchange rates using time series. So according to ACF and
PACF knowledge, mixed model (ARIMA) be the appropriate and now, I need to find
order of the model (p,d,q). So, several models were fitted to select the
suitable model using arima().
Could you please tell me the p
Hello,
Inline.
Em 04-07-2012 09:35, Sajeeka Nanayakkara escreveu:
Hi,
Sorry, since I didn't see the earlier message I resend it.
I read the help page that you mentioned. But the problem is for all
models, code is zero. According to that, all models were converged.
Considering AIC value the be
Take a look at the code for filled.contour().
You'll find a line beginning .Internal(filledcontour(
You can adapt this line and the lines around it to achieve what you want.
Good luck
Bob Kinley
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-pro
Hello,
Sorry, but do you read the answers to your posts?
Inline.
Em 04-07-2012 08:02, Sajeeka Nanayakkara escreveu:
I have already fitted several models
using R code; arima(rates,c(p,d,q))
And I have already answered to a question starting like this yesterday.
In the mean time, the subject
Hi
Well, this is help list for R not for Excel, maybe you shall contact
Microsoft guys. I believe that probably easiest would be to make a simple
macro in Excel.
If you want to do merging in R you shall go through help pages for
read.xls, merge, cbind, rbind and R data import/export manual.
R
Hi
I do not have direct answer. You shall probably search ggplot2 web.
Searching "legend" gave me about sixty results from which you probably
could learn how to modify legend(s) according to your wish.
e.g.
http://had.co.nz/ggplot2/docs/opts.html
Regards
Petr
>
> Dear all,
>
> I produced th
Hi
> Hello,
>
> It is not what happens.
>
> Function "convexhull" exists in both "siar" and "spatstat" packages. As
> you already load "spatstat", when you are loading "siar", the
> "convexhull" in "spatstat" is masked by the one in "siar".
>
> Thus, when you will run "convexhull" function,
I have already fitted several models
using R code; arima(rates,c(p,d,q))
As I heard, best model produce the
smallest AIC value, but maximum likelihood estimation procedure optimizer
should converge.
How to check whether maximum likelihood estimation procedure optimizer has
converged or not?
71 matches
Mail list logo