library(MASS) check out fitdistr( ) ... ?fitdistr
This isn't 'solver', but then again R isn't MS Excel!
Roslina Zakaria wrote:
> Dear R-users,
> Is there any function in R that works similarly like solver in Excel. I have
> a set of daily rainfall data and I would like to estimate alpha and bet
>(I don't recall any Prime Minister called Johnson or Nixon, by the way...)
That's why the variable was called "president". "prime.minister" is four
letters and a dot longer. That was too complicated ;)
-
cuncta stricte discussurus
-
-Ursprün
Dear R-users,
Is there any function in R that works similarly like solver in Excel. I have a
set of daily rainfall data and I would like to estimate alpha and beta for the
gamma function.
Here is my daily rainfall data:
[1] 0.2 1.2 0.0 0.0 0.0 0.0 0.0 0.6 0.0 0.0 0.0 0.0 0.0 0.0
Hi,
I would like to have 3d plot, and I found that there is a command
"scatterplot3d". x is V, y=sigmaV, and z=TSE (note: After some calculation, I
update TSE). How could I do to have 3d plot I want?
V<-seq(1279,1280,,100)
sigmaV<-seq(0.28,0.29,,100)
TSE<-matrix(0, length(V),length(sigmaV))
ps
I just noticed when using 2.6.1, 2.6.2 (2008-02-08), 2.6.2pat
(2008-02-21 r44582), and 2.6.2pat (2008-03-24 r44975) on my poor old
Celeron D330 (2.6 GHz; 3.5 years old) running Windows XP, that the
mouse cursor appears to be redrawn more sluggishly when the pointer is
over R windows graphics device
As far as I know there is no function called 'APPLY'
There is one called 'apply', but why are you determined to use it here?
It is essentially concealed looping.
Here is an alternative way of solving your problem:
___
x <- rbind(x1 = c(1, NA, NA, NA, NA, 1, 2, 2),
x2 = c(1, NA, NA,
Dear Everyone,
1. I have an n-dimension data.
2. I could get the shape of pdf of each one from each of their histograms.
3.?Now I would like to get the joint pdf of the all the dimensions of X.
How do we do #3 above?
Regards,
Joh
[[alternative HTML version deleted]]
___
Dear list,
Below I've written a clunky for loop that counts NA's in a row, replacing all
with NA if there are
more than 3 missing values, or keeping the values if 4 or more are present.
This is sample code from a very large
dataframe I'm trying to clean up.
I know there are many simpler mor
How about this? :-)
president <- c("Johnson", "Johnson", "Johnson"," Johnson"," Johnson",
"Johnson","Nixon", "Nixon", "Nixon", "Nixon", "Nixon", "Nixon")
approval <- c(3,4,5,6,7,8,6,5,4,3,2,1)
fn <- function (x) c(first=x[1], last=x[length(x)], mean=mean(x))
lst <- tapply(approval, president, fn)
> W <- matrix(c(2,4,2,8,1,3), ncol = 3)
> which(W == min(W), arr.ind = TRUE) note difference...
row col
[1,] 1 3
> W # chech
[,1] [,2] [,3]
[1,]221
[2,]483
Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email p
Hi,
My example is as the following,
W<-matrix(c(2,4,2,8,1,3),ncol=3)
which(W==min(W))
I would like to find the index for min of the matrix W, i.e. (1, 3) instead of
5 as the output. What command could I use?
Thanks,
Kate
[[alternative HTML version deleted]]
Here is another way, starting with similar dummy data:
PMData <-
data.frame(PM = c("Thatcher", "Thatcher", "Thatcher", "Thatcher",
"Thatcher", "Thatcher","Major", "Major", "Major",
"Major", "Major", "Major"),
appr
I found a solution. It's probably not the easiest one, but it works. It
assumes that your data frame is ordered from earliest to latest record for
each president, but it can be easily adjusted if you want to make it
dependent on a third column. The final vector "index" gives you the line
indices f
The mean problem can be solved with
president=c("Johnson","Johnson","Johnson","Johnson","Johnson","Johnson","Nix
on","Nixon","Nixon","Nixon","Nixon","Nixon")
approval=seq(1:12)
tapply(approval,president,mean)
For the other, I will try to come back. But I am sure somebody will be
faster than I.
C
I have time-series data on approval ratings of British Prime Ministers. The
prime ministers dating from MacMillan onward till today are coded as dummy
variables and the approval ratings are entered for each month. I want to
know the mean value of the approval rating of each Prime Minister in the
Thanks to all who responded so quickly.
-
cuncta stricte discussurus
-
-Ursprüngliche Nachricht-
Von: Chuck Cleland [mailto:[EMAIL PROTECTED]
Gesendet: Sunday, March 30, 2008 5:45 PM
An: Daniel Malter
Cc: [EMAIL PROTECTED]
Betreff: Re: [R
Roger Bivand Roger.Bivand at nhh.no writes:
> Merge using:
> FS1 <- spCbind(FS, agg2)
This call fails, because:
Error in spCbind(FS, agg2) : different numbers of rows
The reason is because I have data in a001ter for 79 Federal Subjects,
but russia.shp contains 193 labeled objects (93 Federal Sub
How long is it taking? Can you send me the code that you are using.
Another technique is to recode you characters into numbers and store
them as integers. You can then sample the values and reconstruct the
output. Here is a faster way:
# create some test data -- might be read in the readLines
Here is one way of doing it. I would suggest that you read in the
data with readLines and then combine into one single string so that
you can use substring on it. Since you did not provide provide
commented, minimal, self-contained, reproducible code, I will take a
guess at that your data looks
On Sun, 2008-03-30 at 17:35 -0400, Daniel Malter wrote:
> Hi,
>
> the problem I have is seemingly very simple, but not simple enough for me to
> figure out. I just want to find the most (or least) frequent element in the
> vector.
>
> a=c("Alice","Alice","Alice","Alice","Bob","Bob")
> unique(a)
>
On 3/30/2008 5:35 PM, Daniel Malter wrote:
> Hi,
>
> the problem I have is seemingly very simple, but not simple enough for me to
> figure out. I just want to find the most (or least) frequent element in the
> vector.
>
> a=c("Alice","Alice","Alice","Alice","Bob","Bob")
> unique(a)
> length(which
Try this:
ratio<-seq(0,1,by=0.01)
payoff<-NULL
for (i in 1:length(ratio) )
{
payoff1<-100*(ratio[i]>=0.7)+max(100*(1+(ratio[i]-1)*2),0)*(ratio[i]<0.7)
payoff<-c(payoff,payoff1)
}
payoff[70] <- NA # force no line
plot(ratio,payoff, xlab='ST/S0', ylab='Payoff',type='l')
points(c(ratio[69], ratio[71
Hi,
the problem I have is seemingly very simple, but not simple enough for me to
figure out. I just want to find the most (or least) frequent element in the
vector.
a=c("Alice","Alice","Alice","Alice","Bob","Bob")
unique(a)
length(which(a=="Alice"))
unique(a) shows me that the elements in my ve
Dear , Madam/Sir
I'm student doing master in statistics, I'd like to know how i can set data
in R and apply meta-analysis. i have tries many ways but I'm really stuck.
i really appreciate if you can help me in this matter.
Mohammed Owlowa
-
On Sun, Mar 30, 2008 at 7:11 PM, Che-hsu (Joe) Chang <[EMAIL PROTECTED]> wrote:
> Basically, I want to calculate the correlation between variable A and B for
> every subject in my study. (yep, that simple)
>
> What I did is this:
> by(data, id, function (x) cor.test(A,B, data=x))
This recent t
Hi,
My code is as the following,
ratio<-seq(0,1,by=0.01)
payoff<-NULL
for (i in 1:length(ratio) )
{
payoff1<-100*(ratio[i]>=0.7)+max(100*(1+(ratio[i]-1)*2),0)*(ratio[i]<0.7)
payoff<-c(payoff,payoff1)
}
plot(ratio,payoff, xlab='ST/S0', ylab='Payoff',type='l')
I have the discontinuous point at rat
Hi,
I need to resample characters from a dataset that consists of an extremely
long string that is written over hundreds of thousands of lines, each of
length 50 characters. I am currently doing this by first inserting a space
after each character in the dataset and then using the following comma
For questions like this about package development, you should ask on
R-devel, but I'll continue the thread here for one more message.
On 30/03/2008 2:54 PM, Christophe Genolini wrote:
>> See the paragraph in Writing R Extensions which explains this
> Well, I saw it again and again (before asking
The wrapper wraps, i.e. calls, another function that does the real
work but provides a different or more convenient (or more convenient
for a specific purpose) interface to it or specific syntax. Often the wrapper
has the same arguments but different defaults and sometimes that
is referred to as a
hello,
I have two 2-d normal multivariate distributions mapped out on a scatter
plot. I now need a line that equates the two discriminant functions, ie.
g1(x) = g2(x). This should be a quadratic.
How can I solve this in R?
Thanks
--
View this message in context:
http://www.nabble.com/Describing
On Mar 30, 2008, at 2:51 PM, Bryan Hanson wrote:
> I think I more or less understand what a “wrapper” is, but I’d like
> to hear
> how more experienced R users define it, and especially I'd like to
> know if
> there is a formal definition. In my reading, it seems like there
> are a
> fairly
>
> See the paragraph in Writing R Extensions which explains this
Well, I saw it again and again (before asking on the r-help) but I do
not understand. Same for the Kurt Hornik slides on the web.
>
> Create tests/myPack.R with those lines in it plus lines to actually
> run the code.
Does it mea
I think I more or less understand what a ³wrapper² is, but I¹d like to hear
how more experienced R users define it, and especially I'd like to know if
there is a formal definition. In my reading, it seems like there are a
fairly wide range of meanings, but they are all conceptually similar.
I've
Aleksandr Andreev duke.edu> writes:
>
> Greetings!
>
> I am trying plot some data on a map in R. Here's the scenario.
>
> I have a variable called probworkinghealthy which contains a predicted
> probability of employment for every individual in my sample (about
> 100,000 observations).
> I hav
On 30/03/2008 10:44 AM, Christophe Genolini wrote:
> Hi the list,
>
> Some rumour (!) say that is it possible to prepare some tests for
> checking our code using .Rin and .Rout. It seems to be a very good
> practice, but I did not manage to find information on it.
> So does someone know how it w
Che-hsu (Joe) Chang wrote:
> Hello everyone,
>
>
>
> I'm a new R user switching from SAS and JMP. In the first few days, I have
> been trying to do a fairly simple task but yet found no success. I've
> checked the help archive as well as few R textbooks but didn't seem to find
> the answer. So,
On 30/03/2008 10:06 AM, Michael Kubovy wrote:
> I've been trying to dynamically detach and attach things in my Sweave,
> in order to circumvent the problem.
>
> Here is my first attempt:
> pkg <- 'package:AlgDesign'
> p <- is.na(match(pkg, search()))
> ifelse(p == FALSE, detach(pkg), NA)
You c
On 30/03/2008 11:31 AM, Gabor Grothendieck wrote:
> On Sun, Mar 30, 2008 at 9:43 AM, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>> In my opinion, all packages should have namespaces, and I'd like to
>> create a default one if the author doesn't. (The default would be:
>> import what is listed in th
Hi Duncan,
Yes, I came to realize that ifelse was not the way to go. Here is how
I dealt with it:
if(sum('AlgDesign' == (.packages())) > 0) detach('package:AlgDesign')
It requires me (and my students) to learn only the (.packages())
construct (and avoid knowing anything about search(), match
As a medical researcher, I keep tabs on the journals Bioinformatics andd BMC
Bioinformatics. If your package is for "'omics", those are good journals to
look at.
Mark
On Sun, Mar 30, 2008 at 10:02 AM, Peter Dalgaard <[EMAIL PROTECTED]>
wrote:
> Gavin Simpson wrote:
> > On Sun, 2008-03-30 at 15:01
Hello everyone,
I'm a new R user switching from SAS and JMP. In the first few days, I have
been trying to do a fairly simple task but yet found no success. I've
checked the help archive as well as few R textbooks but didn't seem to find
the answer. So, please help me if you can.
Basically,
Thanks a lot for all your replies so far!
I now share your feeling that this might not be the best way to show the
data.
Here's what the data is about: We have search engine queries (12,000 of
them), which are grouped into semantic categories. (Some ask for a "Person",
some are about celebrity "
On Sun, Mar 23, 2008 at 01:42:01PM -0400, Yan Wang wrote:
>First I have a not-up-to-dated R 2.4.0 under ubuntu 7.04, then I tried
Please see the R FAQ; several volunteers provide up-to-date versions
of R for Ubuntu.
You also may want to consult your Ubuntu documentation about learning
what p
mika03 wrote:
> http://www.nabble.com/file/p16349649/at-length.png Hi,
> I produced this graph with R and I am very happy with it. But now I
> wonder:
> Is this some standard way of displaying data and if so, does it have
> a name?
> (like Histogram, Box plot etc.)
> I need to explain the plot
Do you mean merge them into a two column series of price
for one column and change for another column? That is what
I will assume since the result was not illustrated.
Suggest you read the help files and the three
vignettes in the zoo package.
Also R News 4/1 has info on dates.
If you were look
If I understand:
x.new <- cbind('M.Y'=paste(month.abb[x$month], x$Year, sep="-"), x[-3])
aggregate(list(Change=x.new$price),
list("M.Y"=x.new[,"M.Y"], Year=x.new$Year,
Month=x.new$month), FUN=mean)
On 30/03/2008, Richard Saba <[EMAIL PROTECT
On Sun, Mar 30, 2008 at 9:43 AM, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> In my opinion, all packages should have namespaces, and I'd like to
> create a default one if the author doesn't. (The default would be:
> import what is listed in the Depends clause, export everything.) I
> don't think
I have weekly time series data with year, month, day, and price variables.
The input data set for the weekly series takes the following form:
Year month day price
19908 20 119.1
19908 27 124.5
19909 3 124.2
19909 10
Hi the list,
Some rumour (!) say that is it possible to prepare some tests for
checking our code using .Rin and .Rout. It seems to be a very good
practice, but I did not manage to find information on it.
So does someone know how it works ? What are we suppose to write in Rin ?
More precisely :
I've been trying to dynamically detach and attach things in my Sweave,
in order to circumvent the problem.
Here is my first attempt:
pkg <- 'package:AlgDesign'
p <- is.na(match(pkg, search()))
ifelse(p == FALSE, detach(pkg), NA)
require(alr3)
My first two runs show that I've done something wro
Gavin Simpson wrote:
> On Sun, 2008-03-30 at 15:01 +0200, Christophe Genolini wrote:
>
>> Hi the list
>>
>> I made up a new statistical procedure. I will publish it in a medical
>> journal, but there will be only the way of using it, no calculation or
>> algorithme detail.
>> So is there a jou
On 30/03/2008 8:43 AM, Michael Kubovy wrote:
> Thanks, Duncan,
>
> I started a new session under the suspicion that packages were clashing.
...
> #
> # BAD INTERACTION BETWEEN alr3 and AlgDesign
> #
>
> What now?
There's not much you can do; this is up to the package authors
On Sun, 2008-03-30 at 15:01 +0200, Christophe Genolini wrote:
> Hi the list
>
> I made up a new statistical procedure. I will publish it in a medical
> journal, but there will be only the way of using it, no calculation or
> algorithme detail.
> So is there a journal (I mean scientific journal)
Wells, Brian wrote:
> Dr. Harrell,
> Thanks for you help.
>
> I tried:
>
>> print(summary(f,parse(text=paste(i,'="1st Quartile"', sep=''
>
> Same result. No error, the reference category simply doesn't change.
That's good, because the default in summary is to compare the outer
quartiles
Hi the list
I made up a new statistical procedure. I will publish it in a medical
journal, but there will be only the way of using it, no calculation or
algorithme detail.
So is there a journal (I mean scientific journal) with selection commity
to submit an article describing the detail of a pa
Hi, All:
FinTS version 0.3-1 is now available on CRAN. This version
adds a function 'apca' for "Asymptotic Principal Components Analysis",
as discussed in Tsay (2005) Analysis of Financial Time Series, 2nd ed.
(Wiley, sec. 9.6), in addition to minor improvements in the partially
comp
Thanks, Duncan,
I started a new session under the suspicion that packages were clashing.
#
# RUN 1
#
require(faraway)
# Loading required package: faraway
data(oatvar)
ov.lm <- lm(yield ~ variety + block, oatvar)
require(alr3)
# Loading required package: alr3
out <- tukey.nonadd.tes
Is the nls() algorithm based on a weighted non-linear least squares -- I
noticed you mentioned a weighted gradient matrix?
Glenn
Katharine Mullen wrote:
>sorry, the below should read:
>
> A QR decomposition is done on the weighted gradient matrix; if the
>
>
>>estimate of the rank that resul
try this:
mat <- data.matrix(read.table(
textConnection("85 .90 86 .89 87 .98 86 .87
88 .98 90 .78 88 .76 89 .56
90 .67 95 .67 89 .89 90 .87
91 .56 96 .87 90 .76 92 .98")))
closeAllConnections()
nc <- ncol(mat)
labs <- mat[, seq(1, nc, 2)]
vals <- mat[, -seq(1, nc, 2)]
lis <- split(c(vals,
59 matches
Mail list logo