Displaying 20 results from an estimated 5000 matches similar to: "Minimizing the negative log likelihood function..."
2008 Jun 02
2
How can I solve this function in R?
I would like to solve the following function in R:
G <- function(k) (2*(1 - k)*(1 + 2*k)^.5)/(1+3*k)
I want to be able to find "k" for a given "G"
Thanks!
Francois Aucoin
[[alternative HTML version deleted]]
2008 Jul 19
2
How to solve systems of nonlinear equations in R?
Hey,
I was wondering if there existed a R function similar to 'fsolve' or
'fzero' Matlab functions?
Thanks!
Francois Aucoin
[[alternative HTML version deleted]]
2009 Nov 13
4
processing log file
Dear all, I'm trying to process a log file which logs the date, the username and the computer number accessed. The table looks like this:
>table.users
Date UserName Machine
1 2008-11-25 John 641
2 2008-11-25 Clive 611
3 2008-11-25 Jeremy 641
4 2008-11-25 Walt 722
5 2008-11-25 Tony 645
6 2008-11-26 Tony 645
7 2008-11-26
2013 Feb 08
3
Border width on symbols plotted with the lattice package
Dear list members,
I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice'
package to respect the 'lwd' value for specifying the border with for
*symbols* (for lines it works fine). Example:
-----
# Base graphics works fine (gives a 'fat? circle)
plot(5, cex=10, pch=21, lwd=10)
# But 'xyplot' or 'dotplot' doesn't
2009 Oct 05
2
Long for Loop- calling C from R - Parallel Computing
Hello everyone,
I'm running the following for loop to generate random variables in chunks of
60 at a time (l), here h is of order in millions (could be 5 to 6 millions),
note that generating all the variables at once could have an impact on the
final results
for(j in 1:h){
dat$t.o[seq(0,g1,l)[j]+1:l]<-dat$mu[seq(0,g1,l)[j]+1:l] +
rnorm(l,0,dat$g.var[seq(0,g1,l)[j]+1:l])
}
Is there any
2009 Oct 19
2
Possible bug in plot.POSIXct regarding x axis
I believe I have found a bug (or at least a misfeature) in plot.POSIXct.
See the following example code.
set.seed(1)
x=seq(1,1e8,length=100)+round(runif(100)*1e8)
y=as.POSIXct(x,origin="2001-01-01")
plot(y)
This plots some random (date)times against their indices. The y axis
correctly shows appropriate values (years), but the x axis contains the
single number '59:58' in the
2011 Feb 02
3
Applying multiple functions to one object
Dear list members,
I recall seeing a convenience function for applying multiple functions to
one object (i.e., almost the opposite of 'mapply?) somewhere.
Example: If the function was named ?fun? the output of
fun(3.14, mode, typeof, class)
would be identical to the output of
c(mode(3.14), typeof(3.14), class(3.14))
Is my memory failing me, or does such a function already exists in a
2009 Mar 20
2
Accuracy of R and other platforms
Hi,
The paper
@ARTICLE{AlmironSilvaMM:2009,
author = {Almiron, M. and Almeida, E. S. and Miranda, M.},
title = {The Reliability of Statistical Functions in Four Software Packages
Freely used in Numerical Computation},
journal = {Brazilian Journal of Probability and Statistics},
year = {in press},
volume = {Special Issue on Statistical Image and Signal Processing},
url =
2008 Apr 22
2
Getting rid of borders on semi-transparent plotting symbols
R version 2.7.0 RC (2008-04-20 r45403)
When using semi-transparent filled plotting symbols, the border of the
symbol has a different (darker) colour than the interior:
plot(0, 0, pch=19, col="#FF000022")
(Saving this as a PDF and looking at it magnified may make it easier to
see.)
This is pretty annoying, since when plotting partially overlapping
points, the border colour dominates,
2009 Oct 30
2
data.frame extracting data row-wise
Dear All,
I am struggling with extracting data from a data frame:
x=data.frame(a=1:11,b=100:110)
What I want is a list/vector in this sence: 1 100 2 101 3 102...
For single rows, this works fine:
as.matrix(x)[1,]
For, say 2 rows, this works fine:
z=c(as.matrix(x)[1,],as.matrix(x)[2,])
But
z=c(as.matrix(x)[1:2,])
gives 1 2 100 101!?
Is there an 'automated way' to produce a
2007 Jul 13
1
Choosing the number of colour breaks in ggplot2
A seemingly simple problem has me stumped. Is it possible to choose the
number of colour breaks for a gradient scale in the current version of
ggplot2?
Here is a simple example:
---------------------------------------------
x=-10:10
y=-10:10
dat=expand.grid(x=x,y=y)
dat$z=dat$x^2+dat$y^2-100
ggplot(dat, mapping=aes(x=x, y=y, fill=z)) +
geom_tile() + scale_fill_gradient2()
2009 Oct 21
1
ggplot2: Histogram with negative values on x-axis doesn't work
I have a dataset that contains numbers between -10 and 0. E.g. x =
c(-9.23, -9.56, -1.40, ...)
If I no do a
> qplot(x, geom="histogram")
I get the error:
Error: position_stack requires non-overlapping x intervals
Strangely, the following both work:
> qplot(x * -1, geom="histogram")
> qplot(x+100, geom="histogram")
Has anyone else encountered this? Is this a
2009 Dec 10
3
How to figure out which the version of split is used?
There are a number of functions that are dispatched to from split().
> methods('split')
[1] split.data.frame split.Date split.default split.POSIXct
Is there a way to figure out which of these variants is actually
dispatched to when I call split? I know that if the argument is of the
type data.frame, split.data.frame will be called? Is it the case that
if the argument is not
2007 Jul 16
2
Different axis limits for each facet in ggplot2
Hi!
Is it possible to have different axis limit for each facet in a ggplot2
plot? Here is an example:
--------------------------------------------------------------
library(ggplot2)
x=seq(-10,10,.1)
y=cos(x)
z=sin(x)*10
dat=melt(data.frame(x,y,z), id.var="x")
qplot( x, value, data=dat, facets=variable~., geom="line" )
2009 Oct 30
1
Applying a function on n nearest neighbours
I'm having a problem where I have to apply a function to a subset of a
variable, where the subset is defined by the n nearest neighbours of a
second variable.
Here's an example applied to the 'iris' dataset:
$ head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4
2009 Nov 25
1
Kerning issues with CairoPDF
Dear list members
I'm using CairoPDF to generate PDF (because of its font embedding and
support for transparent colours). However, at least on my (Windows)
system, the text it outputs seems to have completely wrong kerning.
Here's an example:
CairoPDF("test.pdf")
plot(rnorm(100),xlab="Ovreset")
dev.off()
The v is (slightly) too far away from the O, it's much
2008 Apr 07
1
How to include a vignette with my package?
I want to include a vignette with a package I wrote. I did follow the
"Writting R extentions" document step by step, but went I run "Rcmd build",
an error occurs. It goes like this:
"
* creating vignettes ... ERROR
.
.
.
.
:7: Emergency stop
L7L ==> Fatal error occurred, no output PDF file produced!texify: pdflatex
failed for some reason <see log file>.
2007 Feb 17
1
Solve in maximum likelihood estimation
Hi,
I got the following problem.
I am doing a maximum likelihood estimation for a Kalman Filter.
For this purpose, I have to invert an error matrix Ffast of dimension
"no. parameters X no.parameters". The usualy optim methods often find only
local minima, so I decided to make the optimization using the SANN
algorithm, which is very slow already.
However, this becomes a real problem
2006 Sep 12
1
lattice cloud and conditional axis limits
I'm using the 'cloud' function in the 'lattice' package to produce
multi-panel 3D scatter plots. The range of the values used vary much
between each panel (especially on the z axis), so I wish the axis limits
to be calculated based on the (conditional) data.
Here's a minimal example:
library(lattice)
z=1:200
x=runif(200)
y=runif(200)
s=factor(rep(c(1,2),each=100))
2008 Apr 15
1
Text-based graphics/plots
When discussing statistics in e-mail based discussion groups, or in
newsgroups, it is sometimes useful to include simple, text-based
statistical graphics. Here is an example, a histogram (only useful
with a fixed-width font, obviously).
:.....
..:::::::::.
.:::::::::::::::