[R] Quick Question about R
Hello, Is there a way to convert a character to a number with out getting a warning? I have a vector that has both numbers and letters in it and I need to convert it to only numbers. At the moment I'm using as.numeric but it is generating a warning when it converts a letter. Is there another function out there that will do what I need or is there a way to turn off the warnings as I don't want the warning to be displayed to the end user? Konrad Hammel Engineer Prilink LTD [EMAIL PROTECTED] 905.305.1096 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] step method in glm()
Hello, I estimaded two logit models via glm(). A null model (called glm00) and "full" model with all accessible covariates and interactions between them (glm1). Then I tried to get even better model by step procedure. I tried the following code: > step(glm00, scope=formula(glm1), method="both") and another one: > step(glm00, scope=formula(glm1), method="forward") In both cases step procedure terminated after several steps with a warning: > Error in factor.scope(ffac, list(add = fadd, drop = fdrop)) : > upper scope does not include model What does the word "model" refer to? To glm00 (the null model)? To my knowledge and understanding, the initial null model should have been included in every step of the search. Am I wrong? Thanks for all comments :-) Konrad Birycki [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multivariate skew-t cdf
> > Thanks to Spencer Graves for provinding this clarification about pmst. > As the author of pmst, I was really the one expected to answer the > query, but I was on travel in the last two weeks and did not read > this query. > > As a complement to what already explained, the reason of the sharp change > from k=19 to k=20 is as follows: pmst (package sn) calls pmt (package > mnormt) with k increased by 1, and pmt calls a Fortran routine (written by > Alan Genz), which issues an error if k>20 or k<1. Hence, the effective > maximum number of dimensions allowed by pmst is 19. Ok, thanks a lot to both of You for help - with Your explanations, You really clarified my view of the problem (and saved me a lot of time I would've spent on digging through my own code). best wishes, Konrad Banachewicz best wishes, > > Adelchi Azzalini > > > Also, have you asked about this directly to the maintainers of > the > > "sn", "mnormt" and "mvtnorm" packages? They might have other > suggestions. > > > > Hope this helps. > > Spencer Graves > -- > "We are what we pretend to be, so we must be careful about what we pretend > to be" > > Kurt Vonnegut Jr. "Mother Night" [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Multivariate skew-t cdf
Dear All, I am using the pmst function from the sn package (version 0.4-0). After inserting the example from the help page, I get non-trivial answers, so everything is fine. However, when I try to extend it to higher dimension: xi <- alpha <- x <- rep(0,27) Omega <- diag(0,27) p1 <- pmst(x, xi, Omega, alpha, df = 5) I get the following result: >p1 [1] 0 attr(,"error") [1] 1 attr(,"status") [1] "oversize" So it seems like the dimension is a problem here (and not the syntax or type mismatch, as I inititally thought - the function is evaluated) - although I found no warning about it in the help page. Can anyone give me a hint as to how to work around this problem and evaluate the skew-t cdf in a large-dimensional space? It's pretty crucial to my current research. Thanks in advance, Konrad [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Workspace restoration error
Dear All, I am working with the new release of R (2.3.0) and have the following problem: I started it the first time, did some computations and the saved the workspace upon exit. Next time I launched it, I got a message "fatal error: unable to restore saved data in .RData".However, if I physically remove the .Rdata file from the directory, launch "clean" and manually load the old .RData file everything is working fine. I tried it a few times, even reinstalled the whole thing (and removing previous versions) and the problem remains. Can someone help me with this one? Thanks in advance Konrad [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Skewed t distribution
On 3/28/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > > You need to learn to supply adequate information. The current > version of sn *does* have such an argument, and I was careful to check. > So it seems that you are using an unstated obselete version of sn. > Do ugrade as the posting guide asked you to. Ok, point taken, I just forgot about it and had no way to do it before computations started (I have to work on two machines, and the one with R on it has no access to the internet). My apologies for wasting Your & everyone else's time. rg, konrad -- > "We are what we pretend to be, so we must be careful about what we pretend > to be" > > Kurt Vonnegut Jr. "Mother Night" [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Skewed t distribution
P is an identity matrix 240X240, mu and alpha are vectors of zeros 240X1, nu equals 10, so alltogether You need: P <- matrix(0,244,244) diag(P) <- 1 nu <- 10 alpha <- rep(0,244) mu <- rep(0,244) require(sn) t1 <- rmst(1,mu,P, alpha, nu) t2 <- dmst(t1,mu,P,alpha,nu) > > please supply the ingredients needed to reproduce the problem that > you have faced (including the values of the parameters mu,P,alpha,nu, > among the rest) > > best wishes, > > Adelchi Azzalini > > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Skewed t distribution
On 3/28/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > Try maximizing the log-likelihood and using the log=TRUE argument to dmst. seems like dmst does not support this argument (the way e.g. "dt" does) > (You have told us so little about what you are doing that we can but guess > at what you mean by `write an mle procedure': what is wrong with st.mle, > for example?) st.mle assumes skewed-t marginals (for a whole distribution), whereas I am working with a copula so my margins are uniform. The whole point is separating the joint and marginal dynamics. rg, konrad [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Skewed t distribution
Dear All, I am working with skewed-t copula in my research recently, so I needed to write an mle procedure instead of using a standard fit one; I stick to the sn package. On subsamples of the entire population that I deal with, everything is fine. However, on the total sample (difference in cross-sectional dimension: 30 vs 240) things go wrong - the objective function diverges to infinity. I located the "rotten" line to be t1 <- dmst(vector, mu, P, alpha, nu) where "vector" is the matrix row, on which I evaluate my likelihood and the rest in parametrized in a standard way, just as the help pages give it. In large dimensions, I get a zero value of the density (which is probably due to numerical issues). I tried the following dummy example t1 <- rmst(1,mu,P,alpha, nu) t2 <- dmst(t1, mu, alpha,nu) and t2 remains to be zero. Can anyone help me on this one? thanks in advance, Konrad -- "We are what we pretend to be, so we must be careful about what we pretend to be" Kurt Vonnegut Jr. "Mother Night" [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] cdecl and stdcall
Hi, I'm trying to load a dynamic link library and it seems to work (is.loaded -> TRUE). When I run the function, which calls the .Fortran subroutine, R crashes! I'v tried the same in S-Plus 2000 and it worked. Therefore I suppose that the dll has been compiled with the stdcall calling convention (and not cdecl). But the problem is that I don't have access to the source code, I've just the dll without any working import library. Maybe someone could be so kind and send me an example how to write a wrapper? I've found one example at the NAG's site (http://www.nag.com/numeric/RunderWindows.asp), but it didn't work. At http://www.cygwin.com/cygwin-ug-net/dll.html there is a description of linking against dlls and how to create a def and an import libraray file, but unfortunately my dll seems to be stripped, because I get the error message "no symbols" after running the command "nm". I'm using R 2.1.0 (windows xp) and CYGWIN (gnu compilers,..) Konrad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] vector autoregression
dear All, I have the following problem: I need to calculate an h-step ahead forecast from a var model (estimated with a dse1 method estVARXls), which in turn will be used as an input for another model as conditioning data, so I need it as a simple, numeric matrix. No exogenous input is used. However, the standard forecast method produces a 1-element list that includes a forecast matrix, yet I have no clue as to how to extract the values of interest. Featherforecast and Horizonforecast do not allow prediction only beyond the sample period, quote: "from.periods cannot exceed available output data". any help will be much appreciated, regards, konrad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] creating a plot
Hi, I have a time series plot to produce, yet I want the x-axis to be labelled with dates (stored on another array) and not with observation numbers. Can anyone suggest me how? Thanks. Konrad __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html