Displaying 20 results from an estimated 1000 matches similar to: "integral with error:non-finite function value"
2012 Nov 01
3
convert list without same component length to matrix
Hi,
I have this lame question. I want to convert a list (each with varies in
length) to matrix with same row length by eliminating vectors outside the
needed range.
For example:
l<-list(NULL)
l[[1]]=1,2,3.7
l[[2]]=3,4,5,6,3
l[[3]]=4,2,5,7
l[[4]]=2,4,6,3,2
l[[5]]=3,5,7,2
#so say I want to only have 4 rows and 5 column in my matrix (or
data.frame) and eliminating the 5th index value in l[[2]]
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
2003 Jan 22
1
negative multinomial regression models
Hello,
I''ve spent a lot of time during the past month trying to get negative
multinomial regression models for clustered event counts as described in
(Guang Guo. 1996. "Negative Multinomial Regression Models For Clustered
Event Counts." Sociological Methodology 26: 113-132., abstract at
http://depts.washington.edu/socmeth2/4abst96.htm) implemented in R. A
FORTRAN version of the
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
2012 Jun 20
2
lmomco in gev estimation
Hi guys,
I'm trying to use lmomco package. first I did the manual calculation on
what is the estimates scale and location parameter given L-CV=0.2, L1=1000
L-moments and k (shape parameter) =- 0.1. so what i get is:
location: 821.0445
scale: 260.7590
shape: -0.1000
#I assign this as GEV vectors using vec2par
GEVpara2<-vec2par(c( 821.0445 , 260.7590 ,-0.1),'gev')
#then I
2012 Jun 15
1
Replication of linear model/autoregressive model
Hi,
I would like to make a replication of 10 of a linear, first order
Autoregressive function, with respect to the replication of its innovation,
e. for example:
#where e is a random variables of innovation (from GEV distribution-that
explains the rgev)
#by using the arima.sim model from TSA package, I try to produce Y
replicates, with respect to every replicates of e,
#means for e[,1], I want
2012 Oct 23
2
vector indexing
Hi,
I got a small problem on how to define the vector index without manually
inspect the vector.
example:
y=c(2,3,5,2,4,6,8,3,6,2,5) #I have ten set of this kind of vectors (with
different values but same length) that I would also like to run the routine
below
#say;
v=the first index in y where the value is larger than 4, in this case index
3, value 5
#what I would like to do is take y[1:v]
2012 Jun 27
2
how to apply the same function to multiple data set
Hi R-users,
I'm trying to repeat the same procedure to 1000 data set. I know this is
very easy, but I got stuck finding the right and fastest way in running it.
IID50=Riidf[1:50,1:1000] #where IID50 is a dataframe consist of 1000 time
series(as column) and 50 time scales (row).
#what I tried to do:
estIID50=rep(NA,1000)
for (i in 1:1000)
estIID50[i]=pargev(lmom.ub(IID50[1:50,i]))
#warning
2004 Sep 29
2
Approximate a f(x,y)
Hi all,
Running simulations, I'm generating market response to 2 factors X&Y..
There is no closed form for the market response.. The results are store in a
matrix Z(X <- seq(.02,.98,.02), Y <- seq(.01,.19,.01))..
For optmization purpose I need to approximate the values for any factor X in
0,02-0,98 and Y in 0,01-0,19
How can I do it ?
For one factor : Xn-1 < x <= Xn
2004 Apr 07
1
eigenvalues for a sparse matrix
Hi,
I have the following problem. It has two parts.
1. I need to calculate the stationary probabilities of a Markov chain,
eg if the transition matrix is P, I need x such that
xP = x
in other words, the left eigenvectors of P which have an eigenvalue of
one.
Currently I am using eigen(t(P)) and then pick out the vectors I need.
However, this seems to be an overkill (I only need a single
2003 Apr 02
8
lm with an arbitrary number of terms
Hello folks,
Any ideas how to do this?
data.frame is a data frame with column names "x1",...,"xn"
y is a response variable of length dim(data.frame)[1]
I want to write a function
function(y, data.frame){
lm(y~x1+...+xn)
}
This would be easy if n was always the same.
If n is arbitrary how could I feed the x1+...+xn terms into lm(response~terms)?
Thanks
Richard
--
Dr.
2011 Mar 25
4
read.xls -> rotate data.frame
Hi to all,
how could I to rotate automatically a data sheet which was imported by
read.xls?
x1 x2 x3 .... xn
y1 1 4 7 ... xn/y1
y2 2 5 8 .... xn/y2
y3 3 6 9 ....xn/y2
yn ... ... ... Xn/Yn
to
y1 y2 y3 .... yn
x1 1 2 3 ..... Yn/x1
x2 4 5 6 .... Yn/x2
x3 7 8 9 .... Yn/x2
xn ... ... ... ..... Yn/xn
Kind regards Knut
2004 Nov 03
3
fold right - recursive list (vector) operators
The programming language mosml comes with foldr that 'accumulates' a
function f over a list [x1,x2,...,xn] with initial value b as follows
foldr f b [x1,x2,...,xn] = f(x1,...,f(xn-1,f(xn,b))...)
Observe that "list" should have same elements so in R terminology it would
perhaps be appropriate to say that the accumulation takes place over a
'vector'.
I wonder if R
2004 Jul 19
10
How to compare X1 = X2 = ... = Xn?
Dear All,
I have a data frame with n columns: X1, X2, ., Xn. Now I want to create a
new column: if X1 = X2 = . = Xn, the value is 1; Otherwise, the value is 0.
How to do that in a quick way instead of doing (n choose 2) comparisons?
Thank you,
Frank
[[alternative HTML version deleted]]
2017 Dec 03
5
Rcpp, dyn.load and C++ problems
Hi,
I have written a small C++ function and compile it.
However in R I can't see the function I have defined in C++.
I have read some web-pages about Rcpp and C++ but it is a bit confusion
for me.
Anyway,
This is the C++-code:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List compute_values_cpp(int totalPoints = 1e5, double angle_increment =
0.01, int radius =
2006 Jul 13
3
How do I pass parameters to my program when using WINE?
Hello,
I'm trying to figure out the proper way of passing parameters to my program
that is being run by WINE. I've been trying different things I've found in
Google, but none have seemed to work yet. The parameters work in a Windows
environment, so I do believe the program is okay. This is on a SUSE/SLES 9
machine using WINE .917. If I want to pass the parameter
2012 Oct 11
3
Formatting data for bootstrapping for confidence intervals
Hi all,
New to R, so this may be obvious to some.
I've been trying to figure this out for a while, I have a dataset "events"
that looks something like this:
Area NAME DATE X Xn Y
1 X 1/10/10 1 1 0
1 Y 1/11/10 0 0 1
1 X 1/12/10 1 0 0
1 X 1/12/10 1 0 0
1 X 1/12/10 1 0 0
2 X 2/12/10 1 1 0
2015 Jul 28
2
all.equal: possible mismatch between behaviour and documentation
Dear all,
The documentation for `all.equal.numeric` says
Numerical comparisons for ?scale = NULL? (the default) are done by
first computing the mean absolute difference of the two numerical
vectors. If this is smaller than ?tolerance? or not finite,
absolute differences are used, otherwise relative differences
scaled by the mean absolute difference.
But the actual behaviour
2009 Dec 15
1
Help in R
Hello,
Can anyone give me some suggestion in term of calculating the sum below.
Is there a function in R that can help doing it faster?
x1, x2, ...xn where xi can be 0 or 1. I want to calculate the following:
sum{ beta[a+sum(xi), b+n-sum(xi) ]* [ (1-x1)dnorm(0,1)+x1dnorm(2,1) ]* [
(1-x2)dnorm(0,1)+x2dnorm(2,1) ]* ...* [ (1-xn)dnorm(0,1)+xndnorm(2,1) ] }
The sum in the beginning is over all
2012 Apr 16
1
eval a SYMSXP from C
Can someone offer some advice on how to properly evaluate a SYMSXP
from a .Call ?
I have the following in R:
variable xn, with an attribute "mu" which references the variable mu
in the global environment.
I know "references" is a loose term; mu was defined in this fashion as
a way to implement deferred binding:
foo <- function(x,mu) {
attr(x,"mu") <-