Re: [R] Suprising R behaviour

2015-11-14 Thread Ilgaz S
Thank you all for answering such a newbie question. :) David thank you for your example too. Best wishes, I.S On Nov 14, 2015 18:28, "David L Carlson" wrote: > My original answer works fine as long as fin_hyp contains only one > definition for the line, but if it contains more than one, R will us

Re: [R] plot.gam help

2015-11-14 Thread Bert Gunter
Please always cc the list to assure a better chance of getting a good answer. I dunno. I assume you could control scaling through xlim and/or ylim arguments as "..." arguments. See ?plot.default and linked Help if you don't know about graphical parameters. If you don't know what "..." arguments ar

Re: [R] Ranking

2015-11-14 Thread Ashta
Thank you David, My intention was if I change the status column to numeric 0= Lost and 1 Won, then I can use this numeric variables to calculate the Percent game Won by each country. how did you read the data first? That was my problem. The actual data is in a file have to be read or laded.

Re: [R] Ranking

2015-11-14 Thread David L Carlson
It is always good to read the manual page for a function, but especially when it is not working as you expected. In this case if you look at the arguments for read.table(), you will find one called fill=TRUE that is useful in this case. Based on your ifelse(), you seem to be assuming that a bla

Re: [R] Two Time Fixed Effects - LFE package

2015-11-14 Thread Andrew Crane-Droesch
Is this an R question or an econometrics question? I'll assume that it is an R question. If your weeks are coded sequentially (i.e.: weeks since a particular date), then they'll be strictly determined by year. If however you're interested in the effect of a particular week of the year (week

[R] Two Time Fixed Effects - LFE package

2015-11-14 Thread Miluji Sb
I have weekly panel data for more than a hundred cities. The independent variables are temperature and precipitation. The time dimensions are year and week and likely have time invariant characteristics and are all important for proper estimation. Could I use the LFE (or plm) package to estimate s

[R] Ranking

2015-11-14 Thread Ashta
Hi all, I have the following raw data some records don't have the second variable. test <- read.table(textConnection(" Country STATUS USA USAW USAW GER GERW GERw GERW UNKW UNK UNKW FRA FRA FRAW FRAW FRAW SPA SPAW SPA "),header = TRUE, sep= "

Re: [R] plot.gam help

2015-11-14 Thread Bert Gunter
Yes. And see the "all.terms" parameter of plot.gam(), which by default is FALSE, yielding the error message reported. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Sat, Nov 14, 2015 at 2:16 PM, An

Re: [R] plot.gam help

2015-11-14 Thread Andrew Crane-Droesch
Your problem is that you've specified a parametric linear model. Your output is a set of parametric coefficients. You can replace `gam` with `lm` in your example, and you'll get identical results. If you wish to specify one of the terms nonparametrically, you'd use s(chlag), for example (assum

Re: [R] Fixing Parameters in maxLik

2015-11-14 Thread Peter Maclean via R-help
Is there a way in maxLik to fix/constraint a parameter to fall within a certain range ? For example I want sigma to be always between 1.98 and 2.02 library(maxLik) loglik <- function(param) { mu <- param[1] sigma <- param[2] ll <- -0.5*N*log(2*pi) - N*log(sigma) - sum(0.5*(x - mu)^2/sigma

Re: [R] Optim() and Instability

2015-11-14 Thread Berend Hasselman
> On 14 Nov 2015, at 17:02, Berend Hasselman wrote: > >> >> On 14 Nov 2015, at 16:15, Lorenzo Isella wrote: >> >> Dear All, >> I am using optim() for a relatively simple task: a linear model where >> instead of minimizing the sum of the squared errors, I minimize the sum >> of the squared rel

Re: [R] How to inherit a base data type (e.g. list, vector)

2015-11-14 Thread Bert Gunter
?? R has 2 built-in OO "class" systems: S3 and S4. S3, which is less an OO system than a way of customizing methods (see e.g. methods(plot) or methods(print)), is simpler. S4 is a more full-fledged OO system, although those coming from languages like C++ and Java might find it somewhat idiosyncrat

[R] R: Package plm (pvcm) "within" and lm

2015-11-14 Thread Malcolm MISTRY
Dear all, I have a doubt on a fixed-effects specification I am trying to run on my large "balanced" panel data with approx 15,000 IDs (n), 33 years (t). I have used R packages lfe and plm and am aware of methods in both packages for following specifications: (a) Individual FE (ID) (b) Twoways FE

[R] plot.gam help

2015-11-14 Thread Pollyanna Fisher via R-help
Hello, I've created a list of gams and for my last step I'd like to plot them but I keep getting an error method. Here is an example of one of themI appreciate your help Gam1s=gam(E1~chlag +chla + waveMax + SST + IRR + site + day +chlag:site, family=gaussian) summary(Gam1s) Family: gaussian

[R] How to inherit a base data type (e.g. list, vector)

2015-11-14 Thread Dawei Cheng
Hi, there I'm trying to extend customized type (for example mylist) from a base type "list" in R, which contains all functions and prototype of R base "list". It should support below operators as "list": a <- list(column1=c(1:5), column2=c(6:10)) aa <- mylist(column1=c(1:5), column2=c(6:10)) a$col

Re: [R] Suprising R behaviour

2015-11-14 Thread David L Carlson
My original answer works fine as long as fin_hyp contains only one definition for the line, but if it contains more than one, R will use a different line for each test which is probably not what you want (e.g. the first point will be tested against the first line and the second point against the

Re: [R] Suprising R behaviour

2015-11-14 Thread David L Carlson
You definitely need to learn about the differences between R and the other languages that you are familiar with. You've done some work since you mention the apply() family, but those are just another way of programming a loop. In many cases (including this one), a loop is not needed. Here's your

Re: [R] Optim() and Instability

2015-11-14 Thread Berend Hasselman
> On 14 Nov 2015, at 16:15, Lorenzo Isella wrote: > > Dear All, > I am using optim() for a relatively simple task: a linear model where > instead of minimizing the sum of the squared errors, I minimize the sum > of the squared relative errors. > However, I notice that the default algorithm is ve

Re: [R] Optim() and Instability

2015-11-14 Thread Gabor Grothendieck
I meant the parscale parameter. On Sat, Nov 14, 2015 at 10:30 AM, Gabor Grothendieck wrote: > Tyipcally the parameters being optimized should be the same order of > magnitude or else you can expect numerical problems. That is what the > fnscale control parameter is for. > > On Sat, Nov 14, 2015

Re: [R] Optim() and Instability

2015-11-14 Thread Gabor Grothendieck
Tyipcally the parameters being optimized should be the same order of magnitude or else you can expect numerical problems. That is what the fnscale control parameter is for. On Sat, Nov 14, 2015 at 10:15 AM, Lorenzo Isella wrote: > Dear All, > I am using optim() for a relatively simple task: a li

[R] Optim() and Instability

2015-11-14 Thread Lorenzo Isella
Dear All, I am using optim() for a relatively simple task: a linear model where instead of minimizing the sum of the squared errors, I minimize the sum of the squared relative errors. However, I notice that the default algorithm is very sensitive to the choice of the initial fit parameters, wherea

Re: [R] prediction with neural network

2015-11-14 Thread Boris Steipe
The process you are looking for is called "imputation" and the following link has the advice you need: http://rseek.org/?q=imputation Other than that, please see here for some hints on how to ask questions productively: http://adv-r.had.co.nz/Reproducibility.html http://stackoverflow.com/quest