Re: [R] Looking for package for data generation for classification and regression

2022-03-04 Thread Paul Smith
On Fri, Mar 4, 2022 at 8:07 AM Ranjan Maitra wrote: > > > I am in need of generating artificial data for machine learning > > classification and regression analysis. What I am looking for is > > something similar to Python sklearn.datasets.make_classification and > > sklearn.datasets.make_regressi

[R] Looking for package for data generation for classification and regression

2022-03-03 Thread Paul Smith
Dear All, I am in need of generating artificial data for machine learning classification and regression analysis. What I am looking for is something similar to Python sklearn.datasets.make_classification and sklearn.datasets.make_regression: https://scikit-learn.org/stable/modules/generated/sklea

Re: [R] kableExtra: How to change kable font family

2019-05-27 Thread Paul Smith
Yes, Jeff, that works! Thanks! However, if I wanted to change the font family to a family different of typewriter, I guess it would be impossible. Paul On Mon, May 27, 2019 at 2:17 PM Jeff Newmiller wrote: > > What about the "monospace" setting? > > On May 27, 2019 1:08

Re: [R] kableExtra: How to change kable font family

2019-05-27 Thread Paul Smith
Thanks, Jeff, but apparently there is no option to change font family through cell_spec. Paul On Mon, May 27, 2019 at 2:22 AM Jeff Newmiller wrote: > > Perhaps... ?cell_spec > > On May 26, 2019 11:13:04 AM PDT, Paul Smith wrote: > >Dear All, > > > >Is it possibl

[R] kableExtra: How to change kable font family

2019-05-26 Thread Paul Smith
Dear All, Is it possible to change the font family to typewriter of the tables generated by kable from kableExtra package? Thanks in advance, Paul __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listin

Re: [R] Best Optimization Routines

2018-02-15 Thread Paul Smith
On Tue, Feb 13, 2018 at 7:55 PM, JamesRyan(Ryan James)/E&P North America Business Division wrote: > I have a set of data, the production of oil from a well. And an equation to > predict that forecast. > > The equation requires 5 input variables which are real numbers with upper and > lower boun

Re: [R] Most appropriate function for the following optimisation issue?

2015-10-20 Thread Paul Smith
On Tue, Oct 20, 2015 at 11:58 AM, Andy Yuan wrote: > > Please could you help me to select the most appropriate/fastest function to > use for the following constraint optimisation issue? > > Objective function: > > Min: Sum( (X[i] - S[i] )^2) > > Subject to constraint : > > Sum (B[i] x X[i]) =0 >

[R] Testing correlation of equation in a SUR model fitted by systemfit

2014-04-15 Thread Paul Smith
Dear All, How to test whether the correlation in the matrix of correlation of a two-equations SUR model fitted by package systemfit are significant? Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-h

Re: [R] Solving quadratic equation in R

2012-07-27 Thread Paul Smith
On Thu, Jul 26, 2012 at 9:48 PM, Diviya Smith wrote: > Hi there, > > I would like to solve a simple equation in R > > a^2 - a = 8.313 > > There is no real solution to this problem but I would like to get an > approximate numerical solution. Can someone suggest how I can set this up? Since your eq

Re: [R] Event Studies in R

2012-06-23 Thread Paul Smith
I suspect Ivan is looking for packages to do discrete-event simulation like simulation of queues. Paul On Sat, Jun 23, 2012 at 5:15 PM, Jim Porzak wrote: > Ivan, > You need to be more specific if you want an answer. What kind of > events? With or without attributes? > Species extinction? Formul

Re: [R] Extraction of rules from Support Vector Machines

2011-12-18 Thread Paul Smith
2011/12/17 Uwe Ligges : >> I am using the svm() function of package e1071 for creating Support >> Vector Machines prediction models. As far as I understand, there is no >> function in this package to extract rules of prediction. Is there some >> other package with such a functionality? > > Those "r

[R] Extraction of rules from Support Vector Machines

2011-12-15 Thread Paul Smith
Dear All, I am using the svm() function of package e1071 for creating Support Vector Machines prediction models. As far as I understand, there is no function in this package to extract rules of prediction. Is there some other package with such a functionality? Thanks in advance, Paul __

Re: [R] Maximization

2011-10-30 Thread Paul Smith
On Tue, Oct 25, 2011 at 12:04 PM, Eliano wrote: > hi people, > > I'm trying to maximize this function: > > fn= function (x) {x[1]^2+5*x[2]^2} > > with this restriction > fn1 = function (x) {x[1]+x[2] <=5} > > Can someone help me how to procedure this? > > I tried in the alabama and genoud package

Re: [R] Function for running a sign test

2011-09-19 Thread Paul Smith
ot; returned both several functions and > a website stating authoritatively that "there is no R function for the > sign test," so its all a matter of your chosen authority, I suppose. > > Sarah > > On Mon, Sep 19, 2011 at 6:10 AM, Paul Smith wrote: >> Dear All, >>

[R] Function for running a sign test

2011-09-19 Thread Paul Smith
Dear All, Has R got a function to perform a sign test? I have done some searching but with no luck. Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] How to change the color of the bar lines of a histogram?

2011-08-18 Thread Paul Smith
That is it, Uwe! Thanks! Paul 2011/8/18 Uwe Ligges : > Read further on and find "border": > > >  hist(rnorm(10), border="yellow") > > > Uwe Ligges > > On 18.08.2011 13:14, Paul Smith wrote: >> >> Dear All, >> >> How to ch

[R] How to change the color of the bar lines of a histogram?

2011-08-18 Thread Paul Smith
Dear All, How to change the color of the bar lines of a histogram? I have read ?hist which mentions the parameter 'col', but this one is to configure the color of the bars filling. Thanks in advance, Paul __ R-help@r-project.org mailing list https:/

Re: [R] Goodness of fit of binary logistic model

2011-08-06 Thread Paul Smith
diately see that this model MUST fit the data, so > that any evidence for lack of fit has to be misleading. > > Frank > > Peter Dalgaard-2 wrote: >> >> On Aug 5, 2011, at 23:16 , Paul Smith wrote: >> >>> Thanks, Frank. The following piece

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
Thanks, Frank. The following piece of code generate data, which exhibit the problem I reported: - set.seed(123) intercept = -1.32 beta = 1.36 xtest = rbinom(1000,1,0.5) linpred = intercept + xtest*beta prob = exp(linpred)/(1 + exp(linpred)) runis = runif(100

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
On Fri, Aug 5, 2011 at 7:07 PM, David Winsemius wrote: >> I have just estimated this model: >> --- >> Logistic Regression Model >> >> lrm(formula = Y ~ X16, x = T, y = T) >> >>                  Model Likelihood    

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
On Fri, Aug 5, 2011 at 5:35 PM, David Winsemius wrote: I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T)                   Model Likelihood     Discriminati

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
On Fri, Aug 5, 2011 at 4:54 PM, David Winsemius wrote: >> I have just estimated this model: >> --- >> Logistic Regression Model >> >> lrm(formula = Y ~ X16, x = T, y = T) >> >>                    Model Likelihood     Discrimination    Rank Di

[R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
Dear All, I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T) Model Likelihood DiscriminationRank Discrim. Ratio TestIndexes

Re: [R] Can glmnet handle models with numeric and categorical data?

2011-08-05 Thread Paul Smith
On Fri, Aug 5, 2011 at 8:45 AM, Martin Maechler wrote: > Note the following: As soon as you use "categorical predictors", > i.e., factors, and particularly when these have many levels (instead of just > being binary), the resulting model matrix is often sparse, > i.e. contains many zeros. > When t

Re: [R] Can glmnet handle models with numeric and categorical data?

2011-08-04 Thread Paul Smith
On Fri, Aug 5, 2011 at 12:02 AM, Marc Schwartz wrote: >> Can the x matrix in the glmnet() function of glmnet package be a >> data.frame with numeric columns and factor columns? I am asking this >> because I have a model with both numeric and categorical predictors, >> which I would like to study w

[R] Can glmnet handle models with numeric and categorical data?

2011-08-04 Thread Paul Smith
Dear All, Can the x matrix in the glmnet() function of glmnet package be a data.frame with numeric columns and factor columns? I am asking this because I have a model with both numeric and categorical predictors, which I would like to study with glmnet. I have already tried to use a data.frame, bu

Re: [R] Automatic creation of binary logistic models

2011-08-04 Thread Paul Smith
On Thu, Aug 4, 2011 at 9:35 PM, Marc Schwartz wrote: >> Suppose that you are trying to create a binary logistic model by >> trying different combinations of predictors. Has R got an automatic >> way of doing this, i.e., is there some way of automatically generating >> different tentative models an

Re: [R] Automatic creation of binary logistic models

2011-08-04 Thread Paul Smith
e bestglm() package will do the trick. > Jeremy > > On 4 August 2011 12:23, Paul Smith wrote: >> >> Dear All, >> >> Suppose that you are trying to create a binary logistic model by >> trying different combinations of predictors. Has R got an automatic >> way o

[R] Automatic creation of binary logistic models

2011-08-04 Thread Paul Smith
Dear All, Suppose that you are trying to create a binary logistic model by trying different combinations of predictors. Has R got an automatic way of doing this, i.e., is there some way of automatically generating different tentative models and checking their corresponding AIC value? If so, could

Re: [R] Drawing a histogram from a massive dataset

2011-07-19 Thread Paul Smith
On Tue, Jul 19, 2011 at 12:30 AM, Joshua Wiley wrote: [snip] I guess that I must have a data frame to plot a histogram. >>> >>> Not at all! >>> >>> ## a *vector* of 100 million observation >>> x <- rnorm(10^8) >>> ## a histogram for it (see attached for the result from my system) >>> hist(x)

Re: [R] Drawing a histogram from a massive dataset

2011-07-18 Thread Paul Smith
On Mon, Jul 18, 2011 at 9:11 PM, Joshua Wiley wrote: >> [snip] I guess that I must have a data frame to plot a histogram. > > Not at all! > > ## a *vector* of 100 million observation > x <- rnorm(10^8) > ## a histogram for it (see attached for the result from my system) > hist(x) > > No data frame

Re: [R] Drawing a histogram from a massive dataset

2011-07-18 Thread Paul Smith
repeat). > > HTH, > Dennis > > On Fri, Jul 15, 2011 at 4:21 AM, Paul Smith wrote: >> Dear All, >> >> I have a massive dataset from which I would like to draw a histogram. >> Any ideas on how to accomplish this? >> >> Thanks in advance, >> >

[R] Drawing a histogram from a massive dataset

2011-07-15 Thread Paul Smith
Dear All, I have a massive dataset from which I would like to draw a histogram. Any ideas on how to accomplish this? Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting g

[R] Plot and curve inside C++

2011-03-06 Thread Paul Smith
Dear All, I would like to use - plot, - curve inside a C++ program. What R package do you recommend? Rcpp? Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide htt

Re: [R] "Nash Equilibrium"

2010-12-04 Thread Paul Smith
On Sat, Dec 4, 2010 at 10:09 AM, Christophe Dutang wrote: > Months ago, when I wanted to compute Nash equilibria (both standard and > generalized), I only found one package that implements the discrete, i.e. > when the player payoff is represented by a matrix. Could you please tell us which R p

Re: [R] constrained optimization -which package?

2010-09-28 Thread Paul Smith
On Tue, Sep 28, 2010 at 9:47 PM, Leonardo Monasterio wrote: > In the function bellow I  want to find the maximum value of v, > subject to the constrain that the sum of x is equal to 1. >  I want to maximize: > v<-t(x)%*%distance%*%x > > Subject to: > sum(x)=1 > > Where: > "x" is a vector n X 1 > "

Re: [R] Bug on r-bc?

2010-07-27 Thread Paul Smith
On Tue, Jul 27, 2010 at 5:12 AM, Gabor Grothendieck wrote: The following code should return 1, but it returns 0: source("http://r-bc.googlecode.com/svn/trunk/R/bc.R";) bc("9 % 2") >>> >>> See FAQ 2 on the r-bc package home page: >>> http://r-bc.googlecode.com >> >> Thanks

Re: [R] Bug on r-bc?

2010-07-26 Thread Paul Smith
On Mon, Jul 26, 2010 at 11:42 PM, Gabor Grothendieck wrote: >> The following code should return 1, but it returns 0: >> >> source("http://r-bc.googlecode.com/svn/trunk/R/bc.R";) >> bc("9 % 2") >> > > See FAQ 2 on the r-bc package home page: > http://r-bc.googlecode.com Thanks to all respondents f

[R] Bug on r-bc?

2010-07-26 Thread Paul Smith
Dear All, The following code should return 1, but it returns 0: source("http://r-bc.googlecode.com/svn/trunk/R/bc.R";) bc("9 % 2") Do you confirm this bug? Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] (no subject)

2010-07-24 Thread Paul Smith
2010/7/23 w 霍 : > I use the constrOptim to maximize a function with four constriants but the > answer does not leave from the starting value and there is only one outer > iteration. The function is defined as follows: > tm<-function(p){ > p1<-p[1]; p2<-p[2]; p3<-p[3]; > p4<-1-p1-p2-p3; > p1*p2*p3

Re: [R] minimization function

2010-04-10 Thread Paul Smith
On Sat, Apr 10, 2010 at 5:13 PM, Paul Smith wrote: >>    I am trying to minimize the quardratic form w'Aw, with certain >> constraints. >> In particular, >>    (1) A=(a_{ij}) is n by n matrix and it is symmetric positive definite, >>        a_{ii}=1 for a

Re: [R] minimization function

2010-04-10 Thread Paul Smith
On Sat, Apr 10, 2010 at 4:58 PM, li li wrote: >    I am trying to minimize the quardratic form w'Aw, with certain > constraints. > In particular, >    (1) A=(a_{ij}) is n by n matrix and it is symmetric positive definite, >        a_{ii}=1 for all i; >        and 0    (2) w'1=n; >    (3) w_{i}>=0

Re: [R] Playing with rgl: a Youtube video

2009-12-21 Thread Paul Smith
On Mon, Dec 21, 2009 at 12:42 PM, Duncan Murdoch wrote: > I've just posted a demo made with the rgl package to Youtube, visible here: >  http://www.youtube.com/watch?v=prdZWQD7L5c > > For future reference, here are the steps I used: > > 1.  Design a shape to be displayed, and then play with the an

Re: [R] Boxplot with grouped data

2009-10-22 Thread Paul Smith
On Thu, Oct 22, 2009 at 5:31 PM, Jakson A. Aquino wrote: >> Is there some way of drawing a boxplot, with R, when one does not have >> the original continuous data, but only the data grouped in classes? >> The function boxplot() can only deal with original data. > > Do you mean a numeric vector gro

[R] Boxplot with grouped data

2009-10-22 Thread Paul Smith
Dear All, Is there some way of drawing a boxplot, with R, when one does not have the original continuous data, but only the data grouped in classes? The function boxplot() can only deal with original data. Thanks in advance, Paul __ R-help@r-project.o

Re: [R] Problem with downloading workspace file from a web address

2009-09-27 Thread Paul Smith
2009/9/27 Uwe Ligges : >> To load a previously saved workspace, one can do the following: >> >> load("/path/to/the/saved/workspace/file") >> >> However, if the path to the saved workspace file is a web address, one >> gets the following error: >> >> «Error in readChar(con, 5L, useBytes = TRUE) : ca

[R] Problem with downloading workspace file from a web address

2009-09-26 Thread Paul Smith
Dear All, To load a previously saved workspace, one can do the following: load("/path/to/the/saved/workspace/file") However, if the path to the saved workspace file is a web address, one gets the following error: «Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection In addit

Re: [R] Appending strings at the beginning of a text file

2009-08-26 Thread Paul Smith
he writeLines. > > On Tue, Aug 25, 2009 at 2:48 PM, Paul Smith wrote: >> >> Thanks, Henrique. >> >> I think you mean the following: >> >> fConn <- file('test.txt', 'r+') >> Lines <- readLines(fConn) >> writeLines(c(&qu

Re: [R] Appending strings at the beginning of a text file

2009-08-25 Thread Paul Smith
M, Henrique Dallazuanna wrote: > Try this; > > fConn <- file('test.txt', 'r+') > Lines <- readLines(fConn) > writeLines(paste("Text at beginning of file", Lines, sep = "\n"), >    con = fConn) > > On Tue, Aug 25, 2009 at

[R] Appending strings at the beginning of a text file

2009-08-25 Thread Paul Smith
Dear All, I have a piece of text that I want to append to a text file at the beginning of the text file. I have thought about using cat() with the option 'append=T', but the appending, in this case, is done at the bottom of the text file. Any ideas? Thanks in advance, Paul

Re: [R] Looking for Rdonlp2

2009-06-27 Thread Paul Smith
Thanks, Mario. With a different browser, it works, but not with Firefox 3.5b4. Paul On Sat, Jun 27, 2009 at 7:19 PM, Mario Valle wrote: > Retry, it works for me. > Ciao! >               mario > > Paul Smith wrote: >> >> Dear All, >> >> I tried to downlo

[R] Looking for Rdonlp2

2009-06-27 Thread Paul Smith
Dear All, I tried to download the package Rdonlp2 from the address given at "CRAN Task View: Optimization and Mathematical Programming": http://arumat.net/Rdonlp2/ However, this link seems to be dead. Any ideas? Thanks in advance, Paul __ R-help@r-p

Re: [R] Optimization Question

2009-06-12 Thread Paul Smith
On Thu, Jun 11, 2009 at 9:56 PM, Brecknock, Peter wrote: > Apologies if this is not the correct list for this question. > > The Rglpk package offers the following example in its documentation > > library(Rglpk) > ## Simple mixed integer linear program. > ## maximize: 3 x_1 + 1 x_2 + 3 x_3 > ## subj

Re: [R] Fwd: From two colors to 01 sequences

2009-05-12 Thread Paul Smith
On Tue, May 12, 2009 at 2:35 PM, Zeljko Vrba wrote: > Aha, so you DON'T have only red and green rectangles in the picture, there is > also white in between, and some pale delimiter lines.  Nevertheless, both > things ease the job slightly, and the approach I described should work.  You > can even

Re: [R] From two colors to 01 sequences

2009-05-12 Thread Paul Smith
Thanks, Baptiste and Zeljko. I am attaching here an example of the picture of the rectangles. Paul On Tue, May 12, 2009 at 1:23 PM, baptiste auguie wrote: > > Depending on the nature of your pdf file, it may be possible to use > the grImport package. I've never used it before, but a quick test

[R] From two colors to 01 sequences

2009-05-12 Thread Paul Smith
Dear All, Perhaps, what I am asking is impossible, but I am asking it anyway. I have got several pdf files with rows of colored rectangles: red rectangles should be read as 0; green rectangles as 1. No other color exists. Is there some way to have R reading the colored rectangles to a matrix or d

Re: [R] Code of the max() function

2009-05-04 Thread Paul Smith
On Mon, May 4, 2009 at 7:47 PM, David Winsemius wrote: >> Where can one find the code of the max() function? Is that written in C? > > pages 43-54 of: > > http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf > > ... is an article by Uwe Ligges on accesssing source code. Thanks, David. That is it!

[R] Code of the max() function

2009-05-04 Thread Paul Smith
Dear All, Where can one find the code of the max() function? Is that written in C? Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/post

Re: [R] is there a way to read a specific column from a txt file

2009-05-03 Thread Paul Smith
On Sun, May 3, 2009 at 6:36 PM, Wensui Liu wrote: > Sometimes, it is too costly to read the whole data file into R. > I am looking for solution in scan() and read.Lines() but don't they work. Try the following (assuming a 3 columns data file): mydata <- read.table(file="myfile",header=T,colClass

Re: [R] "reverse truncate" to extract only decimal values

2009-04-16 Thread Paul Smith
On Thu, Apr 16, 2009 at 10:30 PM, T.D.Rudolph wrote: > Is there a way of truncating in the opposite direction so as to retain only > the values to the right of the decimal?? > > i.e. rather than: >> trunc(39.5) > [1] 39 > > i would get something like: >> revtrunc(39.5) > [1] 0.5 > > I've been sear

Re: [R] issue with L-BFGS-B in optim (optim just hangs)

2009-04-15 Thread Paul Smith
On Wed, Apr 15, 2009 at 3:57 PM, Tiago Marques wrote: > I am using optim, with method=L-BFGS-B, to maximize a likelihood inside a > large simulation exercise. This runs fine for most simulated data sets, but > for some reason, about 1 out of 100 times, optim will just hang. > Using a dumb approach

Re: [R] nls factor

2009-04-15 Thread Paul Smith
On Wed, Apr 15, 2009 at 2:33 PM, Paul Smith wrote: > On Wed, Apr 15, 2009 at 1:27 PM, Manuel Gutierrez > wrote: >> I want to fit the model y=a*x^b using nls; where "a" should be different for >> each level of a factor. >> What is the easiest way to fit it? Ca

Re: [R] nls factor

2009-04-15 Thread Paul Smith
On Wed, Apr 15, 2009 at 1:27 PM, Manuel Gutierrez wrote: > I want to fit the model y=a*x^b using nls; where "a" should be different for > each level of a factor. > What is the easiest way to fit it? Can i do it with nls? > I've looked the help pages and the MASS example in page 249 but the formula

Re: [R] Quantative procedure assessing if data is normal

2009-04-13 Thread Paul Smith
On Mon, Apr 13, 2009 at 7:42 AM, Henry Cooper wrote: > As part of an R code assingment I have been asked to find a quantitative > procedure for assessing whether or not the data are normal? > > I have previously used the graphical procedure using the qqnorm command. > > Any help/tips would be gre

Re: [R] Generating random integers

2009-04-12 Thread Paul Smith
On Sun, Apr 12, 2009 at 1:21 PM, jim holtman wrote: > floor(runif(1000, 1,101)) > >>   I need to generate random integer(s) in a range (say that beetween 1 to >>   100) in R. Another way: sample(1:100,1000,replace=T) Paul __ R-help@r-project.org mail

Re: [R] R interpreter not recognized

2009-04-09 Thread Paul Smith
On Thu, Apr 9, 2009 at 9:01 AM, Maria I. Tchalakova wrote: > I am trying to install a program based on R, but I am receiving the > following error message: > r...@darkstar:/home/maria/UCS# perl System/Install.perl > Error: Can't run the R interpreter (/usr/local/bin/R). > Please make sure that R i

Re: [R] Code of sample() in C

2009-04-06 Thread Paul Smith
o be set. */ >> > #endif >> > #include >> > >> > /* Note that use of this function involves a prior call to the Rmath >> > library to >> >   get the seeds in place. It is assumed that this is done in the calling >> >   function. */

Re: [R] Code of sample() in C

2009-04-06 Thread Paul Smith
t;    const double len = (double) n; >    int i; >    int* x = malloc(n * sizeof(int)); >    if (!x) { >      return 2; >    } > >    for (i = 0; i < n; ++i)     x[i] = i; > >    for (i = 0; i < k; ++i) { >      const int j = (int)(len * runif(0.0, 1.0)); >      y[i] = x[

Re: [R] Code of sample() in C

2009-04-05 Thread Paul Smith
t wishes, > Ranjan > > On Sun, 5 Apr 2009 15:35:25 +0100 Paul Smith wrote: > >> Dear All, >> >> I would like to use the function sample() in a program written in C. >> Is there somewhere the code of sample() written in C? >> >> Thanks in advance, >>

[R] Code of sample() in C

2009-04-05 Thread Paul Smith
Dear All, I would like to use the function sample() in a program written in C. Is there somewhere the code of sample() written in C? Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

Re: [R] Constrined dependent optimization.

2009-04-02 Thread Paul Smith
On Thu, Apr 2, 2009 at 3:49 PM, wrote: > Sorry I sent a description of the function I was trying to minimize but I > must not have sent it to this group (and you). Hopefully with this clearer > description of my problem you might have some suggestions. > > It is basically a warehouse placement

Re: [R] Constrined dependent optimization.

2009-04-02 Thread Paul Smith
SANN. Does your answer > change if instead of 100 "variables" or bins there are 20,000? From the > documentation L-BFGS-B is designed for a large number of variables. But maybe > SANN can handle this as well. > > Kevin > > Paul Smith wrote: >> Apparently

Re: [R] Constrined dependent optimization.

2009-03-30 Thread Paul Smith
tions, one gets the exact optimal solution, which does not take too long. Paul On Mon, Mar 30, 2009 at 5:11 PM, Paul Smith wrote: > Optim with SANN also solves your example: > > --- > > f <- function(x) sum(c(1:50,50:1)*x) > >

Re: [R] Constrined dependent optimization.

2009-03-30 Thread Paul Smith
to an exhaustive search on the 100! permutations -- > probably not a feasible job. > > Regards,  Hans Werner > > > > Paul Smith wrote: >> >> On Sun, Mar 29, 2009 at 9:45 PM,   wrote: >>> I have an optimization question that I was hoping to get some sug

Re: [R] Constrined dependent optimization.

2009-03-30 Thread Paul Smith
ram > here such as the free software Bprolog. I would be interested to > learn what others propose. > > Of course, if we don't know anything about the function f then > it amounts to an exhaustive search on the 100! permutations -- > probably not a feasible job. > > Regards,  

Re: [R] Constrined dependent optimization.

2009-03-30 Thread Paul Smith
or the suggestions. > > Kevin > > Paul Smith wrote: >> On Sun, Mar 29, 2009 at 9:45 PM,   wrote: >> > I have an optimization question that I was hoping to get some suggestions >> > on how best to go about sovling it. I would think there is probably a >>

Re: [R] Constrined dependent optimization.

2009-03-30 Thread Paul Smith
On Sun, Mar 29, 2009 at 9:45 PM, wrote: > I have an optimization question that I was hoping to get some suggestions on > how best to go about sovling it. I would think there is probably a package > that addresses this problem. > > This is an ordering optimzation problem. Best to describe it wit

Re: [R] Non-Linear Optimization - Query

2009-03-18 Thread Paul Smith
On Wed, Mar 18, 2009 at 7:43 PM, Berend Hasselman wrote: >>> system.time(ans.nl <- nleqslv(x=p0, fn=broydt))[1] >> >> user.self >>    8.17 > > On my Imac 2.16Ghz and R 2.8.1 and Mac OS X 10.5.6 > this took approximately 5 seconds. > > Interesting is this experiment. > I set the jacobian for a star

Re: [R] Non-Linear Optimization - Query

2009-03-18 Thread Paul Smith
On Tue, Mar 17, 2009 at 7:55 PM, Berend Hasselman wrote: > You can also try my package "nleqslv" for solving systems of non linear > equations (using Broyden or Newton with a selection of global strategies). > > library(nleqslv) > > xinit <- rep(1,3)               # or rep(0,3) for a singular star

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Paul Smith
On Tue, Mar 17, 2009 at 7:10 PM, Ravi Varadhan wrote: > Here is how you can implement the Lagrangian multiplier approach and solve > the first-order KKT conditions to obtain the solution for Paul Smith's > example: > >        require(BB) > > f2 <- function(x) { > f <- rep(NA, length(x)) > f[1] <-

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Paul Smith
in BB? Otherwise, how do I construct my > system of equations? > > Thanks again > > Lars. > > On Mon, Mar 16, 2009 at 9:54 PM, Paul Smith wrote: >> >> On Tue, Mar 17, 2009 at 12:09 AM, Lars Bishop wrote: >> > I couple of weeks ago, I’ve asked for a package recom

Re: [R] Non-Linear Optimization - Query

2009-03-16 Thread Paul Smith
On Tue, Mar 17, 2009 at 12:09 AM, Lars Bishop wrote: > I couple of weeks ago, I’ve asked for a package recommendation for nonlinear > optimization. In my problem I have a fairly complicated non-linear objective > function subject to one non-linear equality constrain. > > I’ve been suggested to use

Re: [R] Matrix Construction; Subdiagonal

2009-03-13 Thread Paul Smith
On Wed, Mar 11, 2009 at 11:49 PM, Sundar Dorai-Raj wrote: > Does this help? > > A <- matrix(0, 6, 6) > vec <- 1:5 > A[row(A) == col(A) + 1] <- vec Maybe, more simply: A <- matrix(0, 6, 6) vec <- 1:5 diag(A[-1,]) <- vec Paul __ R-help@r-project.org ma

Re: [R] Sorting rows of a matrix independent of each other

2009-03-13 Thread Paul Smith
On Fri, Mar 13, 2009 at 5:26 PM, Wacek Kusnierczyk wrote: >> Oh, this seemed so simple (and I'm sure the answer will be, as usual, so >> thanks in advance for enlightening me). I need to sort each row of a matrix >> independent of the others. For example, >> >    apply(matrix, 1, sort) t(apply(te

Re: [R] R solve equation

2009-02-09 Thread Paul Smith
On Mon, Feb 9, 2009 at 4:46 PM, Giovanni Petris wrote: > > As suggested by somebody else, uniroot() can be used to solve > equations in one unknown variable. However, you will never get the > "exact x" in R, only an approximate root... > > Best, > Giovanni > >> Date: Sat, 07 Feb 2009 02:20:10 -080

Re: [R] R solve equation

2009-02-08 Thread Paul Smith
On Sat, Feb 7, 2009 at 10:20 AM, oryie <43248...@qq.com> wrote: > I want to use R to calculate the variable x which is in some eqation, give > an example: > > 3*x-log(x)+1=0, > > how to solve equation to get the exact x in R? You could use uniroot(), but your equation has no real solution. Paul

Re: [R] Odp: Matrix

2009-02-02 Thread Paul Smith
On Mon, Feb 2, 2009 at 4:05 PM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 02.02.2009 16:52:06: > >> >> Hi, >> >> I have a very basic question on merging two matrices by alternating the >> rows. For illustration, assume two matrices - >> >> A looks like: >> >> 10 10 >> 10 1

Re: [R] How to get solution of following polynomial?

2009-01-11 Thread Paul Smith
On Sun, Jan 11, 2009 at 6:03 AM, RON70 wrote: > > Hi, I want find all roots for the following polynomial : > > a <- c(-0.07, 0.17); b <- c(1, -4); cc <- matrix(c(0.24, 0.00, -0.08, > -0.31), 2); d <- matrix(c(0, 0, -0.13, -0.37), 2); e <- matrix(c(0.2, 0, > -0.06, -0.34), 2) > A1 <- diag(2) + a %*

Re: [R] Convex optimization in R?

2008-09-27 Thread Paul Smith
On Sat, Sep 27, 2008 at 3:32 AM, Hesen Peng <[EMAIL PROTECTED]> wrote: > Well, I finally figured out to do some algebra transformation and the > problem was reduced to non-linear optimization on bounded areas. But > on my way to this I ran into IMSL Fortran library function NNLPF. And > its documen

Re: [R] How to draw the graph of f(x,y) = x * y ?

2008-09-24 Thread Paul Smith
> three dimensional. The degeneracy in y means a 2-D curve will be > "extruded" along the Y dimension. > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Paul Smith > Sent: Wednesday, September 24, 2008 06:20 > To: [E

[R] Bug in persp?

2008-09-24 Thread Paul Smith
Dear All, I am not sure whether the following can be considered a bug: > x <- seq(-1,1,length=20) > y <- x > z <- matrix(1,20,20) > persp(x,y,z) Error in persp.default(x, y, z) : invalid 'z' limits It works with: persp(x,y,z,zlim=c(0,1.5)) Should not persp set the z limits by default when the

Re: [R] How to draw the graph of f(x,y) = x * y ?

2008-09-24 Thread Paul Smith
On Wed, Sep 24, 2008 at 4:05 AM, Ben Bolker <[EMAIL PROTECTED]> wrote: >> The function curve() draws the graph of functions from R to R. Is >> there some homologous function to curve() to draw functions from R^2 >> to R? > > There is a curve3d function in the emdbook package on CRAN. Thanks, Ben

Re: [R] Can R load a saved workspace from the Internet?

2008-09-23 Thread Paul Smith
On Tue, Sep 23, 2008 at 11:06 PM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: >> Can load() load a saved workspace from an Internet address? I have >> tried it but I am getting errors: >> >> In addition: Warning message: >> In readChar(con, 5L, useBytes = TRUE) : >> cannot open compressed file 'http

[R] Can R load a saved workspace from the Internet?

2008-09-23 Thread Paul Smith
Dear All, Can load() load a saved workspace from an Internet address? I have tried it but I am getting errors: In addition: Warning message: In readChar(con, 5L, useBytes = TRUE) : cannot open compressed file 'http://X/workspace.RData', probable reason 'No such file or directory' Paul ___

Re: [R] How to draw the graph of f(x,y) = x * y ?

2008-09-23 Thread Paul Smith
On Tue, Sep 23, 2008 at 6:32 PM, Duncan Murdoch <[EMAIL PROTECTED]> wrote: >> The function curve() draws the graph of functions from R to R. Is >> there some homologous function to curve() to draw functions from R^2 >> to R? > > No, you would have to write it yourself. The basic idea is to use out

[R] How to draw the graph of f(x,y) = x * y ?

2008-09-23 Thread Paul Smith
Dear All, The function curve() draws the graph of functions from R to R. Is there some homologous function to curve() to draw functions from R^2 to R? Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] new to R

2008-09-06 Thread Paul Smith
On Sat, Sep 6, 2008 at 5:10 AM, sudeshna <[EMAIL PROTECTED]> wrote: > > hi im starting with R.have no idea to start...plz help Search the Internet for online tutorials and/or read an introductory book (search for them, e.g., on Amazon.Com). Good luck, Paul __

Re: [R] nonlinear constrained optimization

2008-08-20 Thread Paul Smith
On Tue, Aug 19, 2008 at 8:12 PM, Hans W. Borchers <[EMAIL PROTECTED]> wrote: > Please have a look at the 'Rdonlp2' package at . > It provides non-linear optimization with nonlinear constraints. Notwithstanding, be aware of the following limitation of Donlp2: "If the pr

Re: [R] nonlinear constrained optimization

2008-08-20 Thread Paul Smith
On Tue, Aug 19, 2008 at 7:37 PM, Ravi Varadhan <[EMAIL PROTECTED]> wrote: > The "Tango project" website (from Brazil) has some R functions to implement > Algencan. I haven't used it, but I would be interested to hear others' > experience if someone has already used it or will be using it. Ravi,

Re: [R] nonlinear constrained optimization

2008-08-19 Thread Paul Smith
On Tue, Aug 19, 2008 at 8:35 AM, Chua Siang Li <[EMAIL PROTECTED]> wrote: > > Hi. I need some advises on how to use R to find pi (i is the index) with > the following objective function and constraint: > > max (sum i)[ f(ai, bi, pi) * g(ci, di, pi) * Di ] > > s.t. (sum i)[ f(ai, bi, pi) *

  1   2   3   >