similar to: Approximate a f(x,y)

Displaying 20 results from an estimated 2000 matches similar to: "Approximate a f(x,y)"

2005 Aug 31
1
Distributional characteristics
Hi all I've a continuous variable and I want to test (graphically, plotting observed and theoretical distr, qqplot) whether it follows some formal distribution. (some thing close to Ricci document : Fitting distributions with R, Feb05). The distribution I want to fit is a truncated Gamma at 1 (the minimal value is 1), P(x)=Pgamma(rate,x)/(1-Pgamma(rate,x<1)) NB : changing the variable
2005 Oct 26
1
Pb encountered with demos
Hi all, I've just installed R on my Mac & PC. The base demo run fine.. But I'm encountering several pb with some packages (installed using CRAN binaries using the menu) - Lattice: > demo(lattice,package='lattice') demo(lattice) ---- ~~~~~~~ Type <Return> to start : > require(grid) [1] TRUE > old.prompt <- grid.prompt(TRUE) > old.settings
2005 Nov 08
1
Hybrid Monte Carlo algorithm (MCMC)
Hi all, I'm trying to estimate a nested model (purchase decision, cloglog formula, & quantity bought given a purchase, truncated Poisson). Some of the parameters are mixed (6) and 4 are fixed for all the respondent. The simulated ML (500 simulations) method forwards highly correlated estimates. After some research, Hybrid Monte Carlo seems to be a good alternative to estimate the model. I
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
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
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") <-
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 =
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 Mar 27
1
constraint optimization: solving large scale general nonlinear problems
Hi I need advice regarding constraint optimization with large number of variables. I need to solve the following problem max f(x1,...,xn) x1,..xn x1=g1(x1,...,xn) . . xn=gn(x1,...,xn) I am using Rdonlp2 package which works well until 40 variables in my case. I need to solve this problem with over 300 variables. In this case Rdonlp2 is very very slowly. I know
2012 Jul 03
1
integral with error:non-finite function value
Hi guys, I'm trying to use the the integral function to estimate the area under a PDF and a crossing curve. first I stated the function with several vectors in it: fn=function(a,b,F,mu,alpha,xi) { x<-vector() fs<-function(x) { c <- (mu+(alpha*(1-(1-F)^xi)/xi)) tmp <- (1 + (xi * (x - mu))/alpha) ((as.numeric(tmp > 0) * (tmp^(-1/xi - 1) *
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
.Call("compute_values_cpp") Also, if you were passing arguments to the C++ function you would need to declare the function differently. Do a search on "Rcpp calling C++ functions from R" HTH, Eric On Sun, Dec 3, 2017 at 3:06 AM, Martin M?ller Skarbiniks Pedersen < traxplayer at gmail.com> wrote: > Hi, > > I have written a small C++ function and compile it.
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
2009 Feb 22
1
a coding problem from Ross Simulation book
Hi, there could you help me coding this problme? I am just starting to leard the R. So I really need help Question is from Ross, Simulation, 4th Edition. ch3 14. with x1=23, x2=66 Xn=3*Xn-1+5*Xn-2 mod(100) n>=3 we will call the sequence Un=Xn/100 n>=1 find the first 14 values thank you sophia
2009 Aug 19
1
ridge regression
Dear all, I considered an ordinary ridge regression problem. I followed three different ways: 1. estimate beta without any standardization 2. estimate standardized beta (standardizing X and y) and then again convert back 3. estimate beta using lm.ridge() function X<-matrix(c(1,2,9,3,2,4,7,2,3,5,9,1),4,3) y<-t(as.matrix(cbind(2,3,4,5))) n<-nrow(X) p<-ncol(X) #Without
2009 Aug 19
1
Ridge regression [Repost]
Dear all, For an ordinary ridge regression problem, I followed three different approaches: 1. estimate beta without any standardization 2. estimate standardized beta (standardizing X and y) and then again convert back 3. estimate beta using lm.ridge() function X<-matrix(c(1,2,9,3,2,4,7,2,3,5,9,1),4,3) y<-as.matrix(c(2,3,4,5)) n<-nrow(X) p<-ncol(X) #Without standardization
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.
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 30
1
all.equal: possible mismatch between behaviour and documentation
Dear Jon, thank you for raising the issue, >>>>> Jon Clayden <jon.clayden at gmail.com> >>>>> on Tue, 28 Jul 2015 12:14:48 +0100 writes: > Sorry; minor clarification. The actual test criterion in the example I > gave is of course abs((0.1-0.102)/0.1) < 0.01, not abs(0.1) < 0.01. In > any case, this does not match (my reading of) the docs,
2004 Feb 22
1
For loop help
hello, I would like to do a for loop for matrix: Xm Xm-1 ...... X1 Xm+1 Xm ...... X2 ....................................... ..................................... Xn Xn-1 ...... Xn-m+1 How can I do it in R? Thanks!!! --------------------------------- [[alternative HTML version deleted]]