search for: mfun1

Displaying 4 results from an estimated 4 matches for "mfun1".

Did you mean: fun1
2004 Oct 11
1
Puzzled on nlm
Dear R People: Here is a function to minimized: >mfun1 function(x,a) { x[1] <- a[1]*x[2] + a[3] - a[2]*(a[1]-a[2])*a[3] x[2] <- a[1]*x[1] - a[2]*a[3] return(x) } Here is my first try: >nlm(mfun1,c(1,1)) Error in f(x, ...) : Argument "a" is missing, with no default > >nlm(mfun1,c(1,1),a=c(0.8,0.5,1)) Error in nlm(mfun1,...
2004 Oct 11
1
nlm question
...ar R People: I am trying to duplicate the example from Dennis and Schnabel's "Numerical Methods for Unconstrained Optimization and Nonlinear Equations", which starts on page 149. My reason for doing so: to try to understand the "nlm" function. Here is the function: >mfun1 function(x) { z <- matrix(0,nrow=2,ncol=1) z[1,1] <- x[1]^2 + x[2]^2 - 2 z[2,1] <- exp(x[1]-1) + x[2]^3 - 2 res <- 0.5*t(z)%*%z res } This function has a root at c(1,1). When I use the following: >nlm(mfun1,c(2,0.5)) $minimum [1] 0.09168083 $...
2011 Sep 01
0
UNSOLVED: Fwd: generate correlated qualitative data
The problem remain unsolved. If you have any idea please do suggest .................... thank you; Ram H On Wed, Aug 31, 2011 at 12:06 PM, Ram H. Sharma <sharma.ram.h@gmail.com>wrote: > Dear R experts: > > I have following problem: > > # myfunction > mfun1 <- function(x) { > if ( x == 2){ > xv <- sample(c(2,1,0),100, replace = T, prob = c(0.6, 0.2, 0.2)) > } > if ( x == 1){ > xv <- sample(c(1,0),100, replace = T, prob = c(0.6, 0.4)) > } > if ( x == 0) { > xv <- sample(c(0,0),100, replace = T, prob = c(0.5,...
2011 Aug 31
0
generate correlated qualitative data
Dear R experts: I have following problem: # myfunction mfun1 <- function(x) { if ( x == 2){ xv <- sample(c(2,1,0),100, replace = T, prob = c(0.6, 0.2, 0.2)) } if ( x == 1){ xv <- sample(c(1,0),100, replace = T, prob = c(0.6, 0.4)) } if ( x == 0) { xv <- sample(c(0,0),100, replace = T, prob = c(0.5, 0.5)) } return(xv) } # applying the...