Displaying 20 results from an estimated 1000 matches similar to: "Log-Likelihood 3d-plot and contourplot / optim() starting values"
2012 May 13
2
Discrete choice model maximum likelihood estimation
Hello,
I am new to R and I am trying to estimate a discrete model with three
choices. I am stuck at a point and cannot find a solution.
I have probability functions for occurrence of these choices, and then I
build the likelihood functions associated to these choices and finally I
build the general log-likelihood function.
There are four parameters in the model, three of them are associated to
2006 Jan 14
1
Different length of objects
Hello,
i got an warning message in the following code:
f<-1:100
t<-1:100
b<-100
ll2 <- function(b,f,t) {
t<-cumsum(t)
tn<-t[length(t)]
i<-seq(along=f)
s1<-(tn*exp(-b*tn)*sum(f[i]))/(1-exp(-b*tn))
s2<-sum((f[i]*(t[i]*exp(-b*t[i])-t[i-1]*exp(b*t[i-1])))/(exp(-b*t[i-1])-exp(-b*t[i])))
s1-s2
}
ll2(b,f,t)
i think, the problem here is, that t[0] doesn't
2010 Jun 08
1
add one point to contourplot()
Hi All,
I want to add one point to contourplot(). I used contourplot() in my code like
contourplot(z ~ a + b |c, data)
I understand there is plot.axes argument for filled.contour(), but it did not work for my code. I also tried plot() and text() for contourplot(), but got this error: "plot.new has not been called yet"
Any suggestion for adding a point in contourplot()?
Thank you very
2007 Jan 29
1
overlay xyplot on contourplot in lattice in R
Hi everybody,
I want to do a contourplot in lattice with my raw data overlaid on it(xyplot)
which seemed to be a very easy thing to do.
I've tried it in many ways, but I haven't succeeded at obtaining it.
let's say x, y, and z as the variables that comes from the data frame ''ex'':
therefore my countourplot is as followed :
contourplot(z ~ x * y, cuts=550)
I
2010 Jul 10
1
contourplot by year
Hi - I have a dataframe with 4 variables - long, lat, temp and year. I would
like to plot temperature by lat and long in contour plots by year. There
are 391 data points. When I try
contourplot(temp~long*lat|year,data=hake,cuts=10,labels = TRUE,contour =
TRUE,pretty = TRUE,region=TRUE)
I get plots with dots around by data, but not contour lines or filled in
regions.
I have also used the
2004 Aug 06
1
: (Lattice): Overlaying more than one trend surface using contourplot() and wireframe()
Hi,
Is there a way to plot more than one trend surface using the functions
contourplot() and wireframe(). I have found an add=T in contour(), but
no equivalent argument in contourplot() and wireframe()?
I have taken the example 11-2 (pages 441-451) from Design and analysis
of experiments (Montgomery 2001, 5th edition) to see if this could be
done in R. I have managed to plot individual
2003 Jul 27
1
contourplot:how to get it to label all contours like 'contour'
Hi,
one of the nice things about contour is that it labels all contour lines.
contourplot only labels each particular elevation a single time.
i.e., if there are two contour lines corresponding to z = 45, it will only
label one of them.
is there a way to get contourplot to automatically label all the contour lines,
even those that are repeated?
i ask because i want to plot contour plots *w/
2012 Oct 29
0
why isn't integrate function working in a likelihood
Dear R users,
I have been trying to solve for mle's of a function that involves an
integral and I keep getting an error. I created an example to work on first
and even the simple example doesn't give me the mle's. I am getting the
error "Error in integrate(integrand, 0, Inf) : non-finite function value".
I divided my likelihood function into two parts, one part involves
2007 May 20
1
lattice contourplot error
Hello,
A weird thing is happening to me. I have a 128x128 elements matrix m
with values between 0 and 1. If I do:
R> library(lattice)
R> contourplot (m, cuts=9)
I get the following error message: Error in validDetails.text(x) :
Invalid 'rot' value
The same for any cuts >9.
I can plot m with contourplot(m, cuts=8) but this is not detailed
enough. The 'normal'
2008 Dec 03
1
how do I eliminate excess levels in lattice contourplot key / legend?
I'm working on a contourplot( ) graph, the subject of several previous
posts to this list. The contours express probabilities from 0 - 1, but the
key that is automatically generated by contourplot pads the probability
scale with values that are impossible (i.e, range goes from -0.2 to 1.2),
which will be confusing to those who view the plot. How can I get the
scale to just run from 0 - 1?
2004 May 02
1
contourplot, xyplot, aspect ratio, mfrow
Hi,
I am gradually moving from the classical R plot functions to the library Lattice
I have some questions about contourplot () and its arguments:
1/ I am working on geographical coordinates which makes necessary that the X (longitude) and Y (latitude) units be represented with
the same distance on screen. This was obtained in the classical R plots with plot.default(x,y, asp=1,...) and then
2013 Feb 14
1
Clip a contour with shapefile while using contourplot
Hi, I have done the interpolation for my data and I was able to create the
contours in multipanel with the help of Pascal. Now, I want to clip the
contour with the shapefile. I want only the portion of contour to be
displayed which falls inside the boundary of the shapefile.
The data mydata.csv can be found on
https://www.dropbox.com/s/khi7nv0160hi68p/mydata.csv
The data for shapefile can be
2009 Apr 16
1
weird error with contourplot
Sorry if I am cluttering up this list with too many rank beginner
questions. But I *am* a rank beginner, and I am at my wit's end with
this one:
I have a data frame df, with components x,y,z. This command to make a
contour plot with lattice graphics works just fine:
> contourplot(z~x*y,data=df,cuts=20)
Then I try
> contourplot(z~x*y,data=df,cuts=20,region=T)
And it dies on me with
2009 Apr 06
1
contourplot label color
Hi everyone,
I am new to the list.
My problem is to change the color of the label in a contour plot. The
plot is quite dark and I'd like to have the line and label white, it
works for the line with a simple "col", but for the labels I need to
pass throught a panel call and :
> contourplot(Prob ~ D.CSW *
2002 May 31
1
Re: FW: Contour v Contourplot
Phil,
You write:
>> Using x,y, and z variables in the enclosed test.RData, the command
>>
>> contour(x,y,z)
>>
>> produces a lovely 2D plot, whereas
>>
>> contourplot(z~x*y)
>>
>> produces the error..
>>
>> Error in if (lim[1] > lim[2]) stop("Improper value of limit") :
>> missing value where
2007 Dec 13
2
Overlaying trellis xyplot on contourplot
Friends: I wish to overlay data points on a contour graph. The following
example produces a nice contour plot, but I have not mastered the concept
of using panel functions to modify plots. Can someone show me how to
overlay the data points (given after contour plot statement) on the
contourplot?
--Seth
model <- function(a,b,c,X1,X2) # provide model
function for contour
2010 Dec 20
1
contourplot help
Hello
I'm using the following call to create a contourplot:
library(lattice)
m <- as.matrix(read.table("data.txt"))
contourplot(m[,3] ~ m[,2] * -m[,1],
at = c(1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1),
scales = list(x = list(log = 10,
labels = c("1", "10", "100"),
2007 Sep 07
1
contourplot lines, text, and mtext
If I have a contourplot (in the lattice package) and I want to add
straight lines to it, how do I do this?
I see that there are llines() and lsegement() functions for lattice
plots, but they don't seem to do anything in this case:
library(lattice)
library(KernSmooth)
x=rnorm(10000)
y=x+rnorm(x,0,.5)
a=bkde2D(cbind(x,y),.7)
z=as.vector(a$fhat)
grid=expand.grid(x=a$x1,y=a$x2)
grid$z=z
2008 Nov 24
2
lattice contourplot background covers inward-facing ticks
I wish to have inward-pointing ticks on my contourplot graph, but the
colored background produced by the "region=TRUE" statement covers the
ticks up, is there any way around this? Sample code below. --Seth
library(lattice)
model <- function(a,b,c,d,e, f, X1,X2) # provide model function
for contour plot
{J <- a + (b*X1) + (c*X2) + (d*X1*X2) + e*(X1^2) + f*(X2^2)
pp
2011 Sep 30
1
need help with contourplot figure
I can't figure out how to add tick marks on both my X and Y axis. For example, my X axis ranges from 0 to 1 and there are both a tick mark and a number label at the X-axis values of 0.2,0.4,0.6. and 0.8. I want to add tick marks to the figure at every 0.1 value. This will help a viewer determine the values on the x axis.
I included all of my code. I apologize but it is very long. I am