search for: f_2

Displaying 19 results from an estimated 19 matches for "f_2".

Did you mean: f2
2011 Dec 10
2
efficiently finding the integrals of a sequence of functions
...ving a question about efficiently finding the integrals of a list of functions. To be specific, here is a simple example showing my question. Suppose we have a function f defined by f<-function(x,y,z) c(x,y^2,z^3) Thus, f is actually corresponding to three uni-dimensional functions f_1(x)=x, f_2(y)=y^2 and f_3(z)=z^3. What I am looking for are the integrals of these three functions f_1,f_2,f_3 over some interval, say, (0,1). More specifically, the integrals \int_0^1 f_1(x) dx, \int_0^1 f_2(y) dy and \int_0^1 f_3(z) dz. For this simple example, of course we can do these three integrals one...
2010 Sep 08
11
problem with outer
...(n-q+1,size=1,prob=cbind(p_11,p_12,(1-p_11-p_12))) N_0=apply(X_0[,(n-2*k-L+1):(n-k-L)],1,sum) N_1=apply(X_1[,(n-q-k+2):(n-q+1)],1,sum) S_vek[i]=((sum(((N_1-k*cbind(p_11,p_12,(1-p_11-p_12)))^2)/k*cbind(p_11,p_12,(1-p_11-p_12))))/(sum(((N_0-k*p_0)^2)/k*p_0)))-1 } 1-mean(f_1<=S_vek & S_vek <=f_2) } An other problem i have is when i define p_11=seq(0,1,0.1) p_12=seq(0,1,0.1) then i get also this error message: Error in rmultinom(n - q + 1, size = 1, prob = rbind(p_11, p_12, (1 - : non-positive probability i cannot solve this problem too. Thank you for your time and sorry for my eng...
2010 Mar 04
2
which coefficients for a gam(mgcv) model equation?
Dear users, I am trying to show the equation (including coefficients from the model estimates) for a gam model but do not understand how to. Slide 7 from one of the authors presentations (gam-theory.pdf URL: http://people.bath.ac.uk/sw283/mgcv/) shows a general equation log{E(yi )} = ?+ ?xi + f (zi ) . What I would like to do is put my model coefficients and present the equation used. I am an
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
2001 Oct 22
2
OT: compare several graphs
Hi all, this is OT, but maybe someone can give me a clue. I've got data from eye tracker experiments (750 data points). These figures show how the data lock like |** * ***** |*** ****** | ** **** | * * | | * * | | * |-------------- |--------------- Y axes display velocity, x axes display time, * are the data points.
2009 May 06
0
bivariate normal and rho
Hi, Let f(rho) = E[F_1(x) F_2(y)], i.e f(rho) is the expectation of F(x) * F(y) with respect to the bivariate Gaussian density with mean 0 and covariance matrix [1 rho; rho 1]. Moreover, assume F_1(x) and F_2(y) to be increasing functions of x and y respectively. I was wondering if it was true that f(rho) is an increasing func...
2003 Nov 10
1
ts package function filter: mismatch between function action and help (PR#5017)
...init) # init: for recursive filters only. Specifies the initial values of # the time series just prior to the start value, in reverse # time order. The default is a set of zeros. but looks as if it should be in usual order as x is e.g. init y_0 y_-1 y_-2: 3, 2, 1 filter f_1 f_2 f_3: 1, .5, .25 x: 4, 5, 6, 7, 8 y_1 = 4 + 1*3 + .5*2 + .25*1 = 8.25 y_2 = 5 + 1*8.25 + .5*3 + .25*2 = 15.25 ... but > filter(4:8,c(1,.5,.25),method="recursive", init=3:1) Time Series: Start = 1 End = 5 Frequency = 1 [1] 6.7500 12.7500 22.3750 37.4375 59.8125 whereas > filte...
2003 Apr 21
2
piece wise functions
...he one dimensional case and two intervals, the problem is to find A_0, A_1, ... A_p and "C" from the given sample, assuming the curve is like this: A_0*f_0(x)+A_1*f_1(x)+ ... + A_p*f_p(x) with x < C A_0'*f_0(x)+A_1'*f_1(x)+ ... + A_p'*f_p(x) with x >= C Functions f_1, f_2, ... f_p are known. Is there anything in R for that? I have tried to use nonlinear (nls package) regression, "forcing" with the "nls" function the shape of the surface, but it does not work. By the way, the cofficients A_i have to be positive, but I suppose this is another qu...
2013 Nov 19
1
Generación de números aleatorios. Mixtura k-puntos
Saludo cordial para cada uno. Les pido ayuda para generar números aleatorios de una mixtura k-puntos. Sabemos que la función de distribución F es una mixtura k-puntos si es de la forma F(x) = p_1 F_1(x) + p_2 F_2(x) + … + p_k F_k(x), donde F_j es una función de distribución de probabilidad, p_j > 0 y suma(p_j) = 1, para j = 1, 2, …, k. En mi caso particular F es la suavización de la función de probabilidad discreta {p_j} mediante kernel gamma. En el siguiente código F es la función Keg: # Distribuc...
2006 Nov 18
1
Questions regarding "integrate" function
Hi there. Thanks for your time in advance. I am using R 2.2.0 and OS: Windows XP. My final goal is to calculate 1/2*integral of (f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes: $\frac{1}{2}\int^{{\infty}}_{\infty} (\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx $.) where f1(x) and f2(x) are two marginal densities. My problem: I have the following R codes using "adapt" package. Although "adapt" function is mainly designed for more than 2 dimensions, the manual says it will also call up "integrate" if the number of d...
2004 Jul 10
1
Exact Maximum Likelihood Package
...*(1-p)*t^2*(1-t)^2; f3 = 4*p*s^3*(1-s) + 4*(1-p)*t^3*(1-t); f4 = p*s^4 + (1-p)*t^4; The polynomial f_i represents the probability of seeing i successes. Suppose we repeat this experiment 1000 times, and u_i is the number of times we saw i successes. The likelihood of this event is f_0^u_0*f_1^u_1*f_2^u_2*f_3^u_3*f_4^u_4, and we seek to find those parameter values for s,t,p which maximize the likelihood. My Singular package has as input the 5 polynomials and a data vector u. For the particular example of u = (3,5,7,11,13). The output are the following four roots (p,s,t) and the corresponding Li...
2006 Nov 17
0
Question regarding "integrate" function
Hi there. Thanks for your time in advance. My final goal is to calculate 1/2*integral of (f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes: $\frac{1}{2}\int^{{\infty}}_{\infty} (\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx $.) where f1(x) and f2(x) are two estimated marginal densities. My problem: I have the following R codes using "adapt" package. Although "adapt" function is mainly designed for more than 2 dimensions, the manual says it will also call up "integrate" if the n...
2006 Nov 17
0
questions regarding "integrate" function in R
Hi there. Thanks for your time in advance. My final goal is to calculate 1/2*integral of (f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes: $\frac{1}{2}\int^{{\infty}}_{\infty} (\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx $.) where f1(x) and f2(x) are two marginal densities. My problem: I have the following R codes using "adapt" package. Although "adapt" function is mainly designed for more than 2 dimensions, the manual says it will also call up "integrate" if the number of d...
2013 Aug 23
1
Setting up 3D tensor product interactions in mgcv
Hi, I am trying to fit a smoothing model where there are three dimensions over which I can smooth (x,y,z). I expect interactions between some, or all, of these terms, and so I have set up my model as mdl <- gam(PA ~ s(x) + s(y) + s(z) + te(x,y) + te(x,z) + te(y,z) + te(x,y,z),...) I have recently read about the ti(), "tensor product interaction smoother", which takes care of these
2009 Aug 24
2
Formulas in gam function of mgcv package
Dear R-experts, I have a question on the formulas used in the gam function of the mgcv package. I am trying to understand the relationships between: y~s(x1)+s(x2)+s(x3)+s(x4) and y~s(x1,x2,x3,x4) Does the latter contain the former? what about the smoothers of all interaction terms? I have (tried to) read the manual pages of gam, formula.gam, smooth.terms, linear.functional.terms but
2009 Aug 24
2
Formulas in gam function of mgcv package
Dear R-experts, I have a question on the formulas used in the gam function of the mgcv package. I am trying to understand the relationships between: y~s(x1)+s(x2)+s(x3)+s(x4) and y~s(x1,x2,x3,x4) Does the latter contain the former? what about the smoothers of all interaction terms? I have (tried to) read the manual pages of gam, formula.gam, smooth.terms, linear.functional.terms but
2000 Oct 03
5
Where is gam?
I noticed that there is no generalised additive model functions in R (1.1.1) ... is there a package that implements them? Thanks Prasad ***************************************************************** Mr. Anantha Prasad, Ecologist/GIS Specialist USDA Forest Service, 359 Main Rd. Delaware OHIO 43015 USA Ph: 740-368-0103 Email: aprasad at fs.fed.us Web:
2011 Apr 21
0
C source code question (Robustbase edition)
..._qn REprintf(" f_1: j=%2d", j); #endif j = n + 1; for (i = 0; i < n; ++i) { while ((float)(y[i] - y[n - j + 1]) > trial) --j; q[i] = j; } sump = 0; sumq = 0; for (i = 0; i < n; ++i) { sump += p[i]; sumq += q[i] - 1; } #ifdef DEBUG_qn REprintf(" f_2 -> j=%2d, sump|q= %lld,%lld", j, sump,sumq); #endif if (knew <= sump) { for (i = 0; i < n; ++i) right[i] = p[i]; nr = sump; #ifdef DEBUG_qn REprintf("knew <= sump =: nr , new right[]\n"); #endif } else if (knew > sumq) { for (i = 0; i < n; ++...
2012 Mar 25
2
avoiding for loops
I have data that looks like this: > df1 group id 1 red A 2 red B 3 red C 4 blue D 5 blue E 6 blue F I want a list of the groups containing vectors with the ids. I am avoiding subset(), as it is only recommended for interactive use. Here's what I have so far: df1 <- data.frame(group=c("red", "red", "red", "blue",