Displaying 20 results from an estimated 1000 matches similar to: "[] for R"
2009 Aug 20
1
Understanding R code
What is
1. par.ests <- optimfit$par
2. fisher <- hessb(negloglik, par.ests, maxvalue=maxima);
3. varcov <- solve(fisher);
4. par.ses <- sqrt(diag(varcov));
Thanks a lot,
fit.GEV <- function(maxima)
{
sigma0 <- sqrt((6. * var(maxima))/pi)
mu0 <- mean(maxima) - 0.57722 * sigma0
xi0 <- 0.1
theta <- c(xi0, mu0, sigma0)
#10/5/2007: removed assign() for maxima.nl
2009 Aug 17
2
Newbie that don't understand R code
I got some R code that I don't understand.
Question as comment in code
//where is t comming from, what is phi inverse
rAC <- function(name, n, d, theta){
#generic function for Archimedean copula simulation
illegalpar <- switch(name,
clayton = (theta < 0),
gumbel = (theta < 1),
frank = (theta < 0),
BB9 = ((theta[1] < 1) | (theta[2] < 0)),
GIG = ((theta[2] < 0) |
2009 Aug 21
3
extra .
sigma0 <- sqrt((6. * var(maxima))/pi)
What does the '.' do here?
--
View this message in context: http://www.nabble.com/extra-.-tp25073255p25073255.html
Sent from the R help mailing list archive at Nabble.com.
2010 Sep 21
2
Need help for EM algorithm ASAP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I created a EM algorithm for Generalized hyperbolic distribution.
I want to estimate mutheldaplus, sigmatheldaplus, betasigmaplus in my code.
After getting use these value , then my iteration have to be begin of this code.
But I can not to do iteration part.
Can you help me use my code and get iteration ?
Do know any useful code for EM algorithm for Generalized Hyperbolic
library(QRMlib)
2010 Nov 03
2
bugs and misfeatures in polr(MASS).... fixed!
In polr.R the (several) functions gmin and fmin contain the code
> theta <- beta[pc + 1L:q]
> gamm <- c(-100, cumsum(c(theta[1L], exp(theta[-1L]))), 100)
That's bad. There's no reason to suppose beta[pc+1L] is larger than
-100 or that the cumulative sum is smaller than 100. For practical
datasets those assumptions are frequently violated, causing the
2003 Jul 28
2
defining and plotting functions thanks to equation
Hi R lovers!
Are there any means to define and plot a function given the equation that
specifies the function?
For example I'd like to plot and work with the Gumbel Distribution density
defined by
Lambda(x)=exp(-exp(-x))
My question may appear very simple but I haven't got an idea yet about how
to do that. I could plot something with x a vector/set of value but I don't
know how to
2000 Nov 09
2
simple mixture
Dear All,
I am trying to do some simple mixture analyses. For instance, I have a
sample of n observations and I suspect they come from two different
exponential distributions with parameters rate1 and rate2, respectively.
So, I want to estimate rate1, rate2, and the proportions of both kinds of
individuals in the sample. I had a look at the packages mda and mclust, but
they do not seem to do this
2006 Oct 27
0
VGAM package released on CRAN
Dear useRs,
upon request, the VGAM package (currently version 0.7-1) has been
officially released on CRAN (the package has been at my website
http://www.stat.auckland.ac.nz/~yee/VGAM for a number of years now).
VGAM implements a general framework for several classes of
regression models using iteratively reweighted least squares
(IRLS). The key ideas are Fisher scoring, generalized linear
and
2009 Mar 03
1
SPSS data import: problems & work arounds for GSS surveys
I'm using R 2.8.1 on Ubuntu 8.10. I'm writing partly to ask what's
wrong, partly to tell other users who search that there is a work
around.
The General Social Survey is a long standing series of surveys
provided by NORC (National Opinion Research Center). I have
downloaded some years of the survey data in SPSS format (here's the
site:
2013 May 16
2
R looping help
Hey I'm not really sure what I should put on here, but I am having trouble
with my R code. I am trying to get the p-values, R^2s etc for a number of
different groups of variables that are all in one dataset.
This is the code:
#Stand counter
st<-1
#Collections
stands<-numeric(67)
slopes<-numeric(67)
intercepts<-numeric(67)
mses<-numeric(67)
rsquares<-numeric(67)
2010 Oct 03
1
Johnson Distribution Fit
Hi,
I am trying to fit a Johnson SB distribution using fitdist function in
fitdistrplus Library. I have defined the Johnson SB distribution from (
http://www.ntrand.com/johnson-sb-distribution/) . But it gives me the
follwing errors. Any help would be appreciated
#xi = xi
#lambda =l
#delta =d
#gamma = g
djohn = function(x,xi,l,d,g)
(d/(l*sqrt(2*pi)*((x-xi)/l)*(1-((x-xi)/l))))*exp[-0.5*(g +
2008 Oct 23
1
distribution fitting
Dear R-help readers,
I am writing to you in order to ask you a few questions about distribution
fitting in R.
I am trying to find out whether the set of event interarrival times that I
am currently analyzing is distributed with a Gamma or General Pareto
distribution. The event arrival granularity is in minutes and interarrival
times are in seconds, so the values I have are 0, 60, 120, 180, and
2011 Dec 02
1
1.6x speedup for requal() function (in R/src/main/unique.c)
Hi,
FWIW:
/* Taken from R/src/main/unique.c */
static int requal(SEXP x, int i, SEXP y, int j)
{
if (i < 0 || j < 0) return 0;
if (!ISNAN(REAL(x)[i]) && !ISNAN(REAL(y)[j]))
return (REAL(x)[i] == REAL(y)[j]);
else if (R_IsNA(REAL(x)[i]) && R_IsNA(REAL(y)[j])) return 1;
else if (R_IsNaN(REAL(x)[i]) && R_IsNaN(REAL(y)[j])) return 1;
2007 Dec 11
1
R computing speed
Dear helpers,
I am using R version 2.5.1 to estimate a multinomial logit model using my
own maximum likelihood function (I work with share data and the default
function of R cannot deal with that).
However, the computer (I have an Athlon XP 3200+ with 512 GB ram) takes
quite a while to estimate the model.
With 3 categories, 5 explanatory variables and roughly 5000 observations it
takes 2-3 min.
2024 Feb 29
1
[EXT] Initializing vector and matrices
Hello Eik:
Thanks. I do not need to sample. Essentially, I have a do loop which
produces 24 vectors of length of some length (say k=300) and 24 matrices
of 300x300. Then, I simply need to? take the averages of these 24
vectors and matrices:
x=(x1+x2+...+x24)/k
y=(y1+y2+...+y24)/k
I am just looking for ways to do this in a do loop, which requires
initialization (to 0's) of x and y. My
2006 Mar 01
1
a strange problem with integrate()
Dear all,
I am stuck on the following problem with integrate(). I have been out of
luck using RSiteSearch()..
My function is
g2<-function(b,theta,xi,yi,sigma2){
xi<-cbind(1,xi)
eta<-drop(xi%*%theta)
num<-exp((eta + rep(b,length(eta)))*yi)
den<- 1 + exp(eta + rep(b,length(eta)))
result=(num/den)*exp((-b^2)/sigma2)/sqrt(2*pi*sigma2)
2008 Sep 25
1
grid.newpage()
Hi,
I'm trying to customize a window with 2 graphs.
I'm able to do the first one with something like this general example
par(mfrow=c(1,2),cex.axis=0.85,cex.lab=0.80,mai=c(1.3,1,0.5,0),las=3)
bplot<-barplot(bar.values,names.arg=cf.names,width=0.5,ylab="% Area held")
abline(h=0.3,lty=3,col="red")
abline(h=0.1,lty=3,col="blue")
2010 Apr 27
1
TikzDevice and texi2dvi
Dear All,
I am starting to use the tikzDevice package, but I am experiencing some
(minor problems).
If I try to run the script at the end of the email, I get the following
error
Error in tools::texi2dvi("normal.tex", pdf = T) :
Running 'texi2dvi' on 'normal.tex' failed.
Messages:
sh: /usr/bin/texi2dvi: not found
How do I install the missing texi2dvi?
I found some
2004 Dec 10
1
Porting optimisation setup from Excel Solver to R
Hi all,
I am currently optimising a small portfolio I have
created as a part of my research project in Excel. I
am unable to find the appropriate package to port this
into R. My problem set up is as follows
Minimise ABS(Sum(Xi-Xi')+10*Sum(XiMi)/Mavg)
Subject to:
0 <= Xi <= 0.05
ABS(Sum(Xi)) = 0.2
where
Mi - Market Cap of Stock i
Xi - Initial weight of Stock i
Xi' - New weight of
2024 Feb 28
1
[EXT] Initializing vector and matrices
Hi Steven,
It's not entirely clear what you actually want to achieve in the end.
As soon as you "know" x1, and assuming that the different "xi" do not
differ in length in the real application, you know the length of the
target vector.
Instead of the loop, you can use 'Reduce' without having to initialize a
starting vector.
# generate sample vectors, put them in