Displaying 20 results from an estimated 900 matches similar to: "A problem with using the "outer" function"
2002 Nov 25
3
How top print intermediate values from inside a function?
Hi:
In R, how do I display some intermediate results calculated in a "for"
loop within a function? For example, in the attached code, how do I
get it to print the intermediate variable "mh.new" for each simulation,
when I call the function "MHsim.ind"?
thanks for any help,
Ravi.
####################################################################
MHsim.ind
2010 Sep 09
5
Help on simple problem with optim
Dear all,
I ran into problems with the function "optim" when I tried to do an mle estimation of a simple lognormal regression. Some warning message poped up saying NANs have been produced in the optimization process. But I could not figure out which part of my code has caused this. I wonder if anybody would help. The code is in the following and the data is in the attachment.
da <-
2008 Jan 27
2
Likelihood optimization numerically
Dear List,
I am not sure how should i optimize a log-likelihood numerically:
Here is a Text book example from Statistical Inference by George Casella, 2nd
Edition Casella and Berger, Roger L. Berger (2002, pp. 355, ex. 7.4 # 7.2.b):
data = x = c(20.0, 23.9, 20.9, 23.8, 25.0, 24.0, 21.7, 23.8, 22.8, 23.1, 23.1, 23.5, 23.0, 23.0)
n <- length(x)
# likelihood from a 2 parameter Gamma(alpha,
2005 Mar 02
1
Warning: number of items to replace is not a multiple of replacement length
I feel like a complete dolt, as I know this question has been asked by
others on a fairly regular basis, but I'm going in circles trying to get
the following to work:
id.prob<-function (tt)
{
library(mvtnorm)
#============================
Makeham<-function(tt)
{
a2=0.030386513
a3=0.006688287
b3=0.039047537
t<-tt-20
h.t<-a2+a3*exp(b3*t)
S.t<-exp(-a2*t+a3/b3*(1-exp(b3*t)))
2007 May 24
3
Problem with numerical integration and optimization with BFGS
Hi R users,
I have a couple of questions about some problems that I am facing with
regard to numerical integration and optimization of likelihood
functions. Let me provide a little background information: I am trying
to do maximum likelihood estimation of an econometric model that I have
developed recently. I estimate the parameters of the model using the
monthly US unemployment rate series
2012 Nov 12
1
Invalid 'times' argument three-category ordered probit with maximum likelihood
Hello,
First time poster here so let me know if you need any more information. I am
trying to run an ordered probit with maximum likelihood model in R with a
very simple model (model <- econ3 ~ partyid). Everything looks ok until i
try to run the optim() command and that's when I get " Error in rep(1,
nrow(x)) : invalid 'times' argument". I had to adapt the code from a 4
2012 Oct 02
2
Questions on converting to ConfBridge
I'm looking at what would be involved in converting from MeetMe to
ConfBridge and there seems to be a lot of missing administrative things,
but I hope I'm just missing it. We all know about the missing realtime
linkage. That's a major nuisance, but can be worked around.
More serious is that the CLI command to display users in a ConfBridge
don't show the caller ID information, so
2004 Jul 03
4
counting the occurrences of vectors
Hi:
I have two matrices, A and B, where A is n x k, and B is m x k, where n >> m >> k. Is there a computationally fast way to count the number of times each row (a k-vector) of B occurs in A? Thanks for any suggestions.
Best,
Ravi.
[[alternative HTML version deleted]]
2002 Nov 26
2
Existence of non-vectorised functions
Dear R-Group:
Recently, I ran into a problem. I was using a function called "I.1",
which evaluates the first-order modified Bessel function of the first
kind, in the package "CircStats". This function is not vectorized,
since it uses a couple of "if" conditions. However, when I called this
function with a vector argument, I got no error/warning messages in
2002 Nov 01
1
Manipulating dataframe
Hi:
Suppose, I have a dataframe (with N rows) containing the following
variables:
ID X82 X85 X88
>From this, I'd like to create a new dataframe (with 3*N rows), which
will have the following variables:
ID X82 X85 X88 Xrep
where: each ID is duplicated 3 times; X82 equals its original value for
the first row and equals NA for the other two; X85 equals its original
value for
2003 Apr 07
5
How to sort a dataframe?
Dear R-helpers,
for the purpose of plotting a dataframe, i am trying to sort a dataframe by one column, for example
tester <- data.frame(one=c(3,2,1), two=c(2,3,1))
#> tester
# one two
#1 3 2
#2 2 3
#3 1 1
# I want to sort "tester" by column "one", so that i get a dataframe
# that looks like:
#one two
#1 1
#2 3
#3 2
I know of 'sort' but
2004 Feb 02
1
Robust nonlinear regression - sin(x)/x?
You reall have only one parameter in your model, c = a/b. You can't
identify both a and b from your model, therefore, you should fit the
linear model: lm(z ~ c* sin(x)/x)
Ravi.
----- Original Message -----
From: cstrato <cstrato at aon.at>
Date: Monday, February 2, 2004 2:28 pm
Subject: [R] Robust nonlinear regression - sin(x)/x?
> Dear all
>
> Since I did not receive any
2004 Feb 24
4
Computing the mode
Hi all,
I think this question could be quite trivial, but I can?t find out the
solution... How can you compute the statistic "mode" of a sample, in
case it exists (as mode() returns the mode of an object)? I tried
help.search("mode") but I couldn't find a clue...
Any help would be much appreciated. Regards,
Aurora
2008 Jul 24
3
Should this PDF render correctly without font embedding?
A professor here at Vanderbilt sent me the following code. Each of the
text strings should right justify against the center vertical bar, but
because of font issues it doesn't. I understand that there are
workarounds, but I was just curious if this was consistent across all
platforms. On linux with R 2.7.1 and R-trunk (r46103), both acrobat
reader 8 and kpdf render it incorrectly. How
2000 Dec 18
2
Segmentation fault with expression on linux
I have a problem, that the plot of mathematical formula sometimes
crashes R on Linux (SuSE 6.2 and 7.0 on a Dual PIII/500 machine with 1GB
RAM). The problem occurs for example in demo("graphics"), i.e. in the
last part were the mathematical symbols are plotted.
There are several circumstances to reproduce this segmentation fault,
but the following is one of the most simple examples. The
2006 Feb 21
2
rotated labels in barplot with beside=T and multiple groups
I have a data set that I display using barplot. I don't know what you
call it, but when I look at it, it looks like this:
> lsu
(0,0.1] (0.1,0.2] (0.2,0.3] (0.3,0.4] (0.4,0.5] (0.5,0.6]
A 0.052631579 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
B 0.000000000 0.000000000 0.001007049 0.003021148 0.000000000 0.000000000
E 0.200000000 0.000000000
2003 Nov 02
1
Boxplot with full x-range
Hi all,
I'm new to R, and have the following problem:
I wish to draw a boxplot of simple data in two columns. The x-axis
(taken from first column) is grouped to intervals (using 'cut').
These intervals serve as x-value to the boxplot, and the data from the
second column are the y-values.
The problem is that I want to give an impression of the trend of the data
in the x-range.
2011 Dec 01
1
hi all.regarding quantile regression results..
i know this is not about R.
After applying quantile regression with t=0.5,0.6 on the data set WBC(
Wisconsin Breast Cancer)with 678 observations and 9 independent
variables(inp1,inp2,...inp9) and 1 dependent variable(op) i have got the
following results for beta values.
when t=0.5(median regression) beta values b1=0.002641,b2=0.045746,b3=0.
2002 Aug 26
5
updating n within for(i in 1:n) loop
Hi folks:
I think I'm having problems with figuring this one out:
test1 <- function()
{
n <- 2
for(i in 1:n)
{
cat(paste("i =", i, "\n")); flush.console()
n <- 5 # version 1
#n <<- 5 # version 2
#assign("n", 5, envir = environment(test1)) # version 3
}
}
I need the for(.) loop to run (say) n=5 times within the
2008 Jul 18
1
problem with putting text in outer margins (mtext outer=TRUE)
Hi there,
I'm trying to get some text in the outer margins of my plots and am
having trouble - the margin text is overlapping my plots, even though
the outer margin I'm trying to put it in is very big.
I've simplified my problem down to this:
-------------------------
X11(width=7.5,height=10)
par(mfrow=c(6,1),oma=c(20,0,20,0), mar=c(0,3.1,1,2.1))
for (i in 1:6) {