Hi all,
I am attempting to use latin hypercube sampling to sample different
variable functions in a series of simultaneous differential equations.
There is very little code online about lhs or clhs, so from different
other help threads I have seen, it seems I need to create a
probability density
Hi,
Thanks. I tried this code below, why does expanded dataset 'res1' has m1=3 and
n1=3
, dataset 'd3' doesn't have m1=3, n1=3.
d3-structure(list(m1 = c(2, 3, 2), n1 = c(2, 2, 3), cterm1_P0L = c(0.9025,
0.857375, 0.9025), cterm1_P1L = c(0.64, 0.512, 0.64), cterm1_P0H = c(0.9025,
0.9025,
Hi,
If you don't want the m1=3, n1=3 combination in the final dataset:
library(plyr)
res2- join(res1,d3,by=c(m1,n1),type=inner)
tail(res2)
# m1 n1 x1 y1 m n x y cterm1_P0L cterm1_P1L cterm1_P0H cterm1_P1H
#235 3 2 2 1 5 4 3 1 0.857375 0.512 0.9025 0.64
#236 3 2 2 1 5 4
Hi everyone,
From your helps of giving me several ideas, eventually I can solve the
posted problem. Here is the R code. It can be done by applying the
uniroot.all to the data frame together with the proper form of equation
(slightly modification of the original equation).
#Generate the sample
Dear R-List,
I would like to recode my data according to quantile breaks, i.e. all data
within the range of 0%-25% should get a 1, 25%-50% a 2 etc.
Is there a nice way to do this with all columns in a dataframe.
e.g.
df-
Hello,
Try the following.
levels - c(democrat, republican, other)
dem - c(1,1,1,1,0,0,0,0)
rep - c(1,1,1,0,0,0,0,0)
other - c(1,0,0,0,0,0,0,0)
party - factor(rep(levels, c(sum(dem), sum(rep), sum(other
party
Hope this helps,
Rui Barradas
Em 19-02-2013 00:01, Nicole Ford escreveu:
Hi Alain,
The following should get you started:
apply(df[,-1], 2, function(x) cut(x, breaks = quantile(x), include.lowest =
TRUE, labels = 1:4))
Check ?cut and ?apply for more information.
HTH,
Jorge.-
On Tue, Feb 19, 2013 at 9:01 PM, D. Alain wrote:
Dear R-List,
I would like to recode
Hi Nelissa
I hope the answers from Joshua and Milan helped you figure out a good
solution.
So basically in R you have two big parallel packages, the parallel/snow
described by Joshua, or the foreach one. If you would be to use foreach,
you would need probably a nested loop, which is described in
Hi,
I want to plot means with standard deviations of Total Nitrogen (TN) across
4 stations (S1-S4) and over 3 years (2007-2009). I want this plot in one
panel.
I do not want medians (bwplot, boxplot).
I have tried a few different packages and it seems that ggplots with
plotmeans was the
On 19/02/2013, r-help-requ...@r-project.org
r-help-requ...@r-project.org wrote:
--
Message: 22
Subject: Re: [R] mtext unicode failure
On 18/02/2013 14:15, e-letter wrote:
Readers,
How to solve this unicode input error please?
On what system, in what locale?
On 18.02.2013 13:39, Jamora, Nelissa wrote:
Hi! I'm a recent convert from Stata, so forgive my ignorance.
In Stata, I can write foreach loops (example below)
foreach var of varlist p1-p14 {
foreach y of varlist p15-p269 {
reg `var' `y'
}
}
It's looping p1-p15, p1-p16,
Hi,
I have a data with three variables (X,Y,Z) and I have an equation as
Z=X/(1+L*X/Y) where L is a constant which need to be estimated from data.
How should I write the formula in lm or is it possible to fit a linear
model in this case?
Thanks!
Hallen
[[alternative HTML version
Thank you Bert but i already stumbled upon that kind of article (especially
those of Radcliffe, the precursor). I'm looking for something more pratical, if
not a package, a piece of code i coud use in R.Â
But maybe, it's a good opportunity for me to work on my developer's skills ;-).
Bye.
2013/2/18 Daniel Nordlund djnordl...@frontier.com:
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Mauricio Zambrano-Bigiarini
Sent: Monday, February 18, 2013 1:33 AM
To: r-help@r-project.org
Subject: [R] Random number
Aimee Kopolow alj27 at georgetown.edu writes:
Hi all,
I am attempting to use latin hypercube sampling to sample different
variable functions in a series of simultaneous differential equations.
There is very little code online about lhs or clhs, so from different
other help threads I have
This thread unfortunately pushes a number of buttons:
- Excel computing a model by linearization which fits to
residual = log(data) - log(model)
rather than
wanted_residual = data - model
The COBB.RES example in my (freely available but rather dated) book
at
On 19.02.2013 11:23, hellen wrote:
Hi,
I have a data with three variables (X,Y,Z) and I have an equation as
Z=X/(1+L*X/Y) where L is a constant which need to be estimated from data.
How should I write the formula in lm or is it possible to fit a linear
model in this case?
Neither, it is
On 18.02.2013 05:24, Jia Liu wrote:
Hi all,
I used both OpenBugs and R function bugs{R2WinBUGS} to run a linear mixed
effects model based on the same data set and initial values. I got the same
summary statistics but different posterior samples. However, if I order
these two sets of samples,
On 17.02.2013 08:47, Andy Cox wrote:
I am trying to learn to use winBUGS from R, I have experience with R.
I have managed to successfully run a simple example from R with no
problems. I have been trying to run the Leuk: Survival from winBUGS
examples Volume 1. I have managed to run this from
Uwe Ligges ligges at statistik.tu-dortmund.de writes:
On 19.02.2013 11:23, hellen wrote:
Hi,
I have a data with three variables (X,Y,Z) and I have an equation as
Z=X/(1+L*X/Y) where L is a constant which need to be estimated from data.
How should I write the formula in lm or is it
Jeff Newmiller jdnewmil at dcn.davis.ca.us writes:
Excel definitely does not use nonlinear least squares fitting for power
curve fitting. It uses linear LS fitting of the logs of x and y. There
should be no surprise in the OP's observation.
May I be allowed to say that the general comments
Hi,
I'm trying to carry out Cramer von Mises tests between pairs of vectors
belonging to a discrete distribution (concretely frequencies from 0 to 200).
However, the program crashes in the attempt. The problem seems to be that these
vectors only have positive integer numbers (+ zero). When I
Hi Anna,
A small point -- there is no package called ggplots. There is a package called
gplots and one called ggplot2, which in earlier form was called ggplot.
To see what is happening I believe we need some sample data from the three
data files or some mock-up data that matches your actual
I use Excel regularly, and do not consider this a slam... it is a fact. I am
aware of Solver, but the query was about trend lines generated by Excel. In
general it is possible to do arbitrarily complex computations with a four
function calculator, but we don't describe that as something the
On 19-02-2013, at 09:55, Prakasit Singkateera asltjoey.rs...@gmail.com wrote:
Hi everyone,
From your helps of giving me several ideas, eventually I can solve the posted
problem. Here is the R code. It can be done by applying the uniroot.all to
the data frame together with the proper form
bradleyd wrote
Excuse the request from an R novice! I have a data frame (DATA) that has
two numeric columns (YEAR and DAY) and 4000 rows. For each YEAR I need to
determine the 10% and 90% quantiles of DAY. I'm sure this is easy enough,
but I am a new to this.
quantile(DATA$DAY,c(0.1,0.9))
Hi,
Try this:
el- read.csv(el.csv,header=TRUE,sep=\t,stringsAsFactors=FALSE)
elsplit- split(el,el$st)
datetrial-data.frame(date1=seq.Date(as.Date(1930.1.1,format=%Y.%m.%d),as.Date(2010.12.31,format=%Y.%m.%d),by=day))
elsplit1- lapply(elsplit,function(x)
I tried to use calcMin with a function that uses a number of ...
arguments (all args from resid on) besides the vector of parameters
being fit. Same idea as optim, nlm, nlminb for which this form of ...
syntax works. But with calcMin I get an error regarding unused
arguments. No partial matches to
Hello,
The expansion was based on the unique values of m1 and n1 in dataset d3. I
guess that is the way it works for expansion.
I am not sure what kind of results you are expecting.
Even the code that you provided will also give the combination of m1=3 and
n1=3.
As I mentioned in the
Hey
For classification I use the svm from package e1071.
Since I have unbalanced data sets I would like to train the model based on
balanced accuracy not on just accuracy. I couldn't find an option in the svm
function to do so.
Does anyone know if it is possible to tell the svm which kind of
bradleyd wrote
Thanks for your help Pete. I can almost get it to work with;
by(day,year,quantile)
but this only gives me 0% 25% 50% 75% 100%, not the ones I'm looking
for, 10% and 90%.
I have tried;
by(day,year,quantile(c(0.1, 0.9))) but this is rejected by
Error in FUN(X[[1L]],
Hi R Users,
I was wondering if there is any R package available to do the harmonic
analysis of tide. Any suggestion is highly appreciated.
Janesh
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
On Tue, Feb 19, 2013 at 2:49 PM, Santiago Guallar sgual...@yahoo.com wrote:
Hi,
I'm trying to carry out Cramer von Mises tests between pairs of vectors
belonging to a discrete distribution (concretely frequencies from 0 to 200).
However, the program crashes in the attempt. The problem seems
Hi ,
I am trying to convert the date as factor to date using as.date function
in R. I have the date in the following format
2008-01-01 02:30
I tried to use the following command :
as.Date(mydata$Date, format=%y-%m-%d )
Can somebody help me with this ? I was able to convert the
Dear R People:
I'm looking at some data which has the time in seconds since 1992/10/8,
15:15:42.5
Are there any functions currently available to translate this or should I
just do my own?
I figured that I'd check first.
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer
Hi,Another thing you could do will be to use ?paste()
#for example.
#d3 dataset
paste(d3$m1,d3$n1)
#[1] 2 2 3 2 2 3
#then you use that instead of unique(d3$m1), unique(d3$n1) in the loop.
I didn't try it. But, that is one possibility.
You still didn't show me the results you expected in the
Hi,
Try this:
res1- do.call(rbind,lapply(paste(d3$m1,d3$n1),function(m1)
do.call(rbind,lapply(0:(as.numeric(substr(m1,1,1))-1),function(x1)
do.call(rbind,lapply(0:(as.numeric(substr(m1,3,3))-1),function(y1)
On 19.02.2013 18:52, Erin Hodgess wrote:
Dear R People:
I'm looking at some data which has the time in seconds since 1992/10/8,
15:15:42.5
Just ask R to
strptime(1992/10/8,15:15:42.5, %Y/%m/%d,%H:%M:%OS) + NumberOfSeconds
and you get the actual date after the given amount of
On 19.02.2013 18:47, Janesh Devkota wrote:
Hi ,
I am trying to convert the date as factor to date using as.date function
in R. I have the date in the following format
2008-01-01 02:30
I tried to use the following command :
as.Date(mydata$Date, format=%y-%m-%d )
Can somebody help me
jdbaba wrote
Hi ,
I am trying to convert the date as factor to date using as.date function
in R. I have the date in the following format
2008-01-01 02:30
I tried to use the following command :
as.Date(mydata$Date, format=%y-%m-%d )
Can somebody help me with this
Your subject line says you want to calculate seconds... the body of your
message says you want to translate seconds (to something unspecified).
I am not sure how we are supposed to respond. Can you give us a short example
of what you have and what you want using R syntax?
Hello,
Try the following.
x - 2008-01-01 02:30
as.POSIXct(x, format = %Y-%m-%d %H:%M)
Hope this helps,
Rui Barradas
Em 19-02-2013 17:47, Janesh Devkota escreveu:
Hi ,
I am trying to convert the date as factor to date using as.date function
in R. I have the date in the following format
It is possible to squeeze a square peg into a round hole, but often you will
not be satisfied with the result. Date is for... surprise, dates. You may want
to use the chron package or the POSIXct type. The R Journal of June 2004
(Volume 4/1) R Help Desk column is recommended reading.
bradleyd wrote
That does it, thanks. Do you think you help me a little bit further?
I actually have 4 columns, YEAR, DAY, TEMP , and IBI. They are all
numeric. I need to calculate the average TEMP and IBI values between the
10% and 90% quantiles for each YEAR.
The code
*
HI Alain,
Try this:
df.breaks-data.frame(id=df[,1],sapply(df[,-1],function(x)
findInterval(x,quantile(x),rightmost.closed=TRUE)),stringsAsFactors=FALSE)
df.breaks
# id a b c
#1 x01 1 1 1
#2 x02 1 1 1
#3 x03 2 2 2
#4 x04 3 3 3
#5 x05 4 4 4
#6 x06 4 4 4
A.K.
- Original Message -
From:
You need to convert the factor to character.
as.Date( as.character(mydata$Date), %Y-%m-%d)
should do it.
John Kane
Kingston ON Canada
-Original Message-
From: janesh.devk...@gmail.com
Sent: Tue, 19 Feb 2013 11:47:04 -0600
To: r-help@r-project.org
Subject: [R] Converting the data
Hello,
I open some files in a directory and get a list.
open.list - sapply (namen, function (x) {file - list.files (ddir,
pattern=x, full.names=TRUE) # namen is vector and each element detects a
special file to open
file - read.table (file)
On 02/19/2013 10:38 PM, Anna Zakrisson wrote:
Hi,
I want to plot means with standard deviations of Total Nitrogen (TN) across
4 stations (S1-S4) and over 3 years (2007-2009). I want this plot in one
panel.
I do not want medians (bwplot, boxplot).
...
Hi Anna,
From your description, the
Hello,
I'm not sure I understabd, but if the names are in 'namen' then the
following might do what you want.
names(open.list) - namen
Hope this helps,
Rui Barradas
Em 19-02-2013 18:09, Hermann Norpois escreveu:
Hello,
I open some files in a directory and get a list.
open.list - sapply
bradleyd wrote
Thanks Pete. The TRIM argument in the MEAN function tells me how to trim
off decimal points, but I am lost as to how to append the mean values of
TEMP and IBI between the 10% and 90% quantiles of DAY in each YEAR.
DAY is the julian date that an event occurred in certain
I have carefully read the CARET documentation at:
http://caret.r-forge.r-project.org/training.html, the vignettes, and
everything is quite clear (the examples on the website help a lot!), but I
am still a confused about the relationship between two arguments to
trainControl:
method
index
and the
this is the data I expected
suppose that I have a dataset 'd'
m1 n1A B C D
1 2 2 0.9025000.640 0.90250.64
2 3 2 0.8573750.512 0.90250.64
I want to add x1 (from 0 to m1), y1(from 0 to n1), m (range from m1+2 to
7-n1), n(from n1+2 to
Hi,
suppose that I have a dataset 'd'
m1 n1 A B C D
1 2 2 0.902500 0.640 0.9025 0.64
2 3 2 0.857375 0.512 0.9025 0.64
I want to add x1 (from 0 to m1), y1(from 0 to n1), m (range from
m1+2 to 7-n1), n(from n1+2 to 9-m), x (x1 to x1+m-m1),
I have a dataset which contains several multi-column measurement sets per row.
Col 1 identifies patient:
Col1Col2Col3 Col 4Col 5 Col 6
Col7 ...
Patient Treatment Outcome Advice Treatment Outcome Advice
P1 T1 O1
Hi,
Try this:
dat1- read.table(text=
Patient Treatment Outcome Advice Treatment Outcome Advice
P1 T1 O1 A1 T2 O2 A2
,sep=,header=TRUE,stringsAsFactors=FALSE)
names(dat1)[-1]-paste(gsub(\\..*,,names(dat1)[-1]),_,rep(1:2,each=3),sep=)
Hi,
When writing a script, I often start with:
library(ISwR)
attach(thuesen)
Then write some more code, testing it as I write to see if it runs.
Then, at the end, a final:
detach(thuesen)
However, what happens is that I often get errors, which cause an attach, but
no subsequent detach. Now,
Have a look thru the Time Series task view...
http://cran.r-project.org/web/views/TimeSeries.html
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Janesh Devkota
Sent: Wednesday, 20 February 2013 5:52a
To: r-help@r-project.org
In general, creating variables while attached leads to problems such as you
describe. Normally the recommendation is to avoid the use of attach and detach
entirely in favor of explicit reference to the data frame using [[]], [,], $,
and the data= argument supported by many functions.
Hi,
Try this:
files-paste(MSMS_,23,PepInfo.txt,sep=)
read.data-function(x) {names(x)-gsub(^(.*)\\/.*,\\1,x);
lapply(x,function(y) read.table(y,header=TRUE,sep =
\t,stringsAsFactors=FALSE,fill=TRUE))}
Jeff Newmiller jdnewmil at dcn.davis.ca.us writes:
In general, creating variables while attached leads to problems such
as you describe. Normally the recommendation is to avoid the use of
attach and detach entirely in favor of explicit reference to the
data frame using [[]], [,], $, and the
Hi, list
I am doing 100,000 iterations of Bayesian simulations.
What I did is I split it into 4 different R sessions, each one runs 25,000
iteration. But two of the sessions gave the simulation result.
I did not use any set.seed(). What is going on here?
Thanks,
Mike
[[alternative
Hello --
The question I have is about the gmm() function from the 'gmm' package
(v. 1.4-5).
The manual accompanying the package says that the gmm() function is
programmed to use either of four numerical solvers -- optim, optimize,
constrOptim, or nlminb -- for the minimization of the GMM
Duncan and Bert,
Thank you very much for your help with my question. It's very much
appreciated.
I used your suggestions to get the plot I needed:
* 3x3 lattice of dotplots,
* x-limits are the same for all panels,
* y-limits and y-ticks in each row are the same,
* y-limits and
On Feb 19, 2013, at 5:25 PM, Malikov, Emir wrote:
Hello --
The question I have is about the gmm() function from the 'gmm' package
(v. 1.4-5).
The manual accompanying the package says that the gmm() function is
programmed to use either of four numerical solvers -- optim, optimize,
Hi,
On Tue, Feb 19, 2013 at 7:09 PM, Ian Renner ian_ren...@yahoo.com wrote:
Hi,
I am trying to save a plot as a PDF with different line types. In the example
below, R displays the plot correctly with 2 curves in solid lines, 2 curves
in dashed lines and 1 curve as a dotted line. However,
Hi Ista,
I'm using Adobe Reader XI. It's good to hear that the plot was produced
correctly and that it is Adobe that is failing to represent it properly. Thanks!
Ian
From: Ista Zahn istaz...@gmail.com
Cc: r-help@r-project.org r-help@r-project.org
Sent:
Hi Berend,
Your method is really much better. Thank you very much. (Yes I also forgot
to add the $root at the end.)
Best,
Prakasit
On Tue, Feb 19, 2013 at 10:51 PM, Berend Hasselman b...@xs4all.nl wrote:
On 19-02-2013, at 09:55, Prakasit Singkateera asltjoey.rs...@gmail.com
wrote:
Hi
On Tue, Feb 19, 2013 at 10:20 PM, Ian Renner ian_ren...@yahoo.com wrote:
Hi Ista,
I'm using Adobe Reader XI. It's good to hear that the plot was produced
correctly and that it is Adobe that is failing to represent it properly.
Right, well I just installed acroread (adobe reader for linux) and
Hi,
I also see the expected lines on your pdf file with Evince (3.2.1) using
poppler/cairo (0.18.0).
Regards,
Pascal
Le 20/02/2013 09:09, Ian Renner a écrit :
Hi,
I am trying to save a plot as a PDF with different line types. In the example
below, R displays the plot correctly with 2
On Feb 19, 2013, at 7:40 PM, Ista Zahn wrote:
On Tue, Feb 19, 2013 at 10:20 PM, Ian Renner ian_ren...@yahoo.com wrote:
Hi Ista,
I'm using Adobe Reader XI. It's good to hear that the plot was produced
correctly and that it is Adobe that is failing to represent it properly.
Right, well I
Ian
No differences with Adobe X with the following
windows(6,6)
#pdf(file = TestPlot.pdf, 6, 6)
#{
plot(b, l, type = l, ylim = c(y.min, y.max), lwd = 2, xlab =
expression(beta), ylab = , col = green, yaxt = n, xaxt = n)
points(b, p, type = l, lty = dotted, lwd = 2, col = red)
points(b,
Dear Mr/Mrs
I am Lili Puspita Rahayu, student from magister third level of Statistics in
Bogor Agriculture University.
Mr/
Mrs, now I'm analyzing the Zero inflated Poisson (ZIP), which is a solution of
the Poisson regression
where the response variable (Y) has zero excess. ZIP now
I was doing
On Tue, Feb 19, 2013 at 7:18 AM, Uwe Ligges lig...@statistik.tu-dortmund.de
wrote:
On 18.02.2013 05:24, Jia Liu wrote:
Hi all,
I used both OpenBugs and R function bugs{R2WinBUGS} to run a linear mixed
effects model based on the same data set and initial values. I got the
same
summary
73 matches
Mail list logo