Displaying 20 results from an estimated 20000 matches similar to: "plotmath question"
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
Greetings:
I would like comments on this example and after fixing it up, I need
help from someone who has access to insert this in R's help page for
plotmath.
I uploaded a drawing
http://pj.freefaculty.org/R/Normal-2009.pdf
that is created by the following code
http://pj.freefaculty.org/R/Normal1_2009_plotmathExample.R
This will be a good addition to the plotmath help page/example.
2010 Jul 06
1
plotmath vector problem; full program enclosed
Here's another example of my plotmath whipping boy, the Normal distribution.
A colleague asks for a Normal plotted above a series of axes that
represent various other distributions (T, etc).
I want to use vectors of equations in plotmath to do this, but have
run into trouble. Now I've isolated the problem down to a relatively
small piece of working example code (below). If you would
2008 Apr 08
2
plotmath "overstrikes" in output on a Linux system
I've been testing plotmath. But I'm getting some funny output one one
computer. The problem is that characters are 'jumbled' and overstrike
when symbols are introduced.
Sample code:
mu <- 440.0
sigma <- 12.5
myx <- seq( mu - 4*sigma, mu+ 4*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# Here's one way to retrieve the values of mu and sigma and
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9.
I've been experimenting with plotmath.
I wish it were easier to combine expressions in plotmath with values
from the R program itself. There are two parameters in the following
example, the mean "mymean" and standard deviation "mystd". I am able
to use bquote to write elements into the graph title like
mu = mymean
and R will
2008 May 30
2
Including a tilde in a plotmath-type call
Suppose I have a plot
plot(1:10, pch = "")
And I want some text to indicate a Normal distrubition. I could do
this:
text(5, 6, substitute(X~~~~N(mu, sigma^2)), adj = 0)
text(5.35, 6, "~", adj = 0)
But that's clumsy, and depending on your plotting device, might not even look
sensible. I'd prefer to be able to do it more directly and
simply the way these do:
text(5,
2012 May 12
2
Plotmath bug or my misunderstanding?
This is a followup to a recent post on using atop() to obtain
multiline expressions.
My reading of the plotmath docs makes it clear that issuing (in base
graphics) the specification
par(cex = 2)
doubles symbols and regular text in subsequent plotmath expressions.
However, it is unclear to me what specifying cex _within_ the
annotation function using plotmath should do, and the following seems
2008 Dec 31
3
Plotmath with values?
I hope to use the plotmath facility to print titles that mix
math and values of R variables.
The help for "plotmath" has an example, which after repeated
reading, I find baffling. Likewise, I have read the help file
for "substitute" (wqhich seems to be needed) without ever
understanding what it does, other than being used in some magic
incantations.
I would like to do
2009 Aug 07
1
Gauss-Laguerre using statmod
I believe this may be more related to analysis than it is to R, per se.
Suppose I have the following function that I wish to integrate:
ff <- function(x) pnorm((x - m)/sigma) * dnorm(x, observed, sigma)
Then, given the parameters:
mu <- 300
sigma <- 50
m <- 250
target <- 200
sigma_i <- 50
I can use the function integrate as:
> integrate(ff, lower= -Inf, upper=target)
2012 Mar 23
3
R numerical integration
Hi all,
Is there any other packages to do numerical integration other than the
default 'integrate'?
Basically, I am integrating:
integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value
The integration is ok provided sigma is >0.
However, when mu=-1.645074 and sigma=17535.26
It stopped working. On the other hand, Maple gives me a value of
0.5005299403.
It is an
2005 Jun 28
2
Producing character "given" i.e. "| " with plotmath
Hello!
Does someone know how to produce
L(y|mu)
with plotmath?
Some code with unsuccessfull results:
plot(dnorm(x = seq(from = -4, to = 4, by = 0.1)), type = "l")
## Not what I want
legend(legend = c(expression(L(y:mu))), x = "topright")
## Strange, is this a bug?
legend(legend = c(expression(L(y|mu))), x = "top")
## Group produces an error
legend(legend =
2012 Sep 11
1
Strange result from GAMLSS
Hi Folks! Just started using the gamlss package and I tried a simple code
example (see below). Why the negative sigma?
John
> y <- rt(100, df=1)> m1<-fitDist(y, type="realline")Warning messages:1: In MLE(ll3, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma, :
possible convergence problem: optim gave code=1 false convergence
(8)2: In MLE(ll4, start = list(eta.mu =
2008 Jul 23
1
R2WinBUGS problem
Dear friends - I'm on winXP, R 2.71 - I have with some help dveloped
this multivariate normal model, which gives very plausible results in
WinBUGS even without any
initial values specified. However, when I then try to run the same model
via the bugs function in R2WinBUGS with inits specified as inits=NULL
the program stops in a dead end. So I have tried to make inits for the
bugs function
2019 Dec 08
2
What should dnorm(0, 0, -Inf) return?
Yes, that looks like a bug and an easily fixable one too.
However, I spy another issue: Why do we check the !R_FINITE(x) && mu == x before checking for sd < 0 ? The difference is whether we
return ML_NAN;
or
ML_ERR_return_NAN;
but surely negative sd should always be an error?
I'd be inclined to do
if (sigma < 0) ML_ERR_return_NAN;
if(!R_FINITE(sigma)) return R_D__0;
2006 Jan 25
4
D(dnorm...)?
Can someone help me understand the following:
> D(expression(dnorm(x, mean)), "mean")
[1] 0
> sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
By my computations, this should be
2003 Aug 28
2
ks.test()
Dear All
I am trying to replicate a numerical application (not computed on R) from an
article. Using, ks.test() I computed the exact D value shown in the article
but the p-values I obtain are quite different from the one shown in the
article.
The tests are performed on a sample of 37 values (please see "[0] DATA"
below) for truncated Exponential, Pareto and truncated LogNormal
2008 Jun 26
2
constructing arbitrary (positive definite) covariance matrix
Dear list,
I am trying to use the 'mvrnorm' function from the MASS package for
simulating multivariate Gaussian data with given covariance matrix.
The diagonal elements of my covariance matrix should be the same,
i.e., all variables have the same marginal variance. Also all
correlations between all pair of variables should be identical, but
could be any value in [-1,1]. The problem I am
2005 Jun 22
1
legend
I color some area grey with polygon() (with a red border) and then I
want to have the dashed red border in the legend as well. How do I
manage it?
And I want to mix (latex) expressions with text in my legend.
Just execute my lines below and you know want I mean. Or pass by at
http://de.wikipedia.org/wiki/Bild:GBM.png to see the picture online.
Thomas
bm <- function(n=500, from=0, to=1) {
2007 Apr 05
1
Plotting multiple curves with lattice graphs
Hi List,
I would like to plot multiple curves (parametric
density curves) in one plot.
For example:
# parameters for three normal density curves
parms =
data.frame(ID=c(1,2,3),mu=c(50,55,60),sigma=c(10,12,15))
# I can easily draw three normal density curves using
curve():
curve(dnorm(x,mean=parms$mu[1],sd=parms$sigma[1]),from=0,
to=150, ylab="density", col="red")
2005 Apr 05
2
Stats Question: Single data item versus Sample from Norma l Distribution
Here's one possibility, assuming muhat and sigmahat are estimtes of mu and
sigma from N iid draws of N(mu, sigma^2):
tStat <- abs(x - muhat) / sigmahat
pValue <- pt(tStat, df=N, lower=TRUE)
I'm not quite sure what df tStat should have (exercise for math stat), but
given fairly large N, that should make little difference.
Andy
> From: Ross Clement
>
> Hi. I have a
2008 Oct 16
1
Loop avoidance in simulating a vector
All,
I'd like to simulate a vector that is formed from many distinct
distributions and avoid a loop if possible. E.g, consider:
mu = c(1, 2, 3)
sigma = c(1, 2, 3)
n = c(10, 10, 10)
And we simulate a vector of length 30 that consists of N(mu[i], sigma[i])
distributed data, each of length n[i]. Of course for just three groups we
can simply write it out as:
DV = c(rnorm(n[1], mu[1],