[R] Question about copula-GARCH model

2008-06-20 Thread Jonas Malmros
simple and totally obvious thing, but I just do not get it. :-( Could you please help me understand? How do I do it in MATLAB or R? THanks in advance! -- Jonas Malmros __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE d

[R] How to remove double loop?

2008-03-19 Thread Jonas Malmros
ogram the double loop part now that OVal is used within the function itself? It is pretty easy to write for loops, but it is very hard to write computationally optimal code. :-( Could you please help me with the above one, if possible? -- Jonas Malmros Stockholm University Stockhol

[R] How to remove double for loop?

2008-03-19 Thread Jonas Malmros
x(0, nrow=n+1, ncol=n+1) for( i in 0:n){ for(j in 0:i){ Val[j+1, i+1] <- u^j*d^(i-j) } } Thank you in advance! -- Jonas Malmros __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

Re: [R] Polynomial fitting

2008-01-09 Thread Jonas Malmros
s): > > > coef(lm(y~poly(x,3,raw=TRUE))) > (Intercept) poly(x, 3, raw = TRUE)1 poly(x, 3, raw = TRUE)2 > -774.258364 472.172611 -91.633939 > poly(x, 3, raw = TRUE)3 >5.800653 > > And there's your coefficients. See he

[R] Polynomial fitting

2008-01-07 Thread Jonas Malmros
I wonder how one in R can fit a 3rd degree polynomial to some data? Say the data is: y <- c(15.51, 12.44, 31.5, 21.5, 17.89, 27.09, 15.02, 13.43, 18.18, 11.32) x <- seq(3.75, 6, 0.25) And resulting degrees of polynomial are: 5.8007 -91.6339 472.1726 -774.2584 THanks in advance! --

[R] Diagonal matrix with off diagonal elements

2007-12-21 Thread Jonas Malmros
Hi, everyone I wonder if there is a function in R with which I can create a square matrix with elements off main diagonal (for example one diagonal below the main diagonal). Thanks in advance! -- Jonas Malmros Stockholm University Stockholm, Sweden

[R] Computing normal conf.intervals

2007-12-20 Thread Jonas Malmros
side-down without loading matlab package. Thanks for your help in advance! Best, JM -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

[R] Why is conversion not working?

2007-12-17 Thread Jonas Malmros
t; are 1997: for(i in 1:dim(database)[1]){ if(database$year[i]>90) { database$Year[i] <- as.numeric(database$year[i])+1900 } else { database$Year[i] <- as.numeric(database$year[i])+2000 } } Thanks in advance for explanations. Regards, JM -- Jonas Malmros Stockholm

Re: [R] Cannot grasp how to apply "by" here...

2007-12-17 Thread Jonas Malmros
Dear Charilaos, Thanks, I see what you mean, but I just simplified the real code here and I made a mistake by putting +2, it is +1. :-) JM On Dec 17, 2007 8:02 PM, Charilaos Skiadas <[EMAIL PROTECTED]> wrote: > On Dec 17, 2007, at 1:47 PM, Jonas Malmros wrote: > > >

[R] Cannot grasp how to apply "by" here...

2007-12-17 Thread Jonas Malmros
Obviously, A cannot assign a row name because the dimensions do not agree. I can use rownames(vector) <- x$Name[1] though. then things get calculated (I saw it with browser()) but rbind does not do what I want it to do, "results" remains numeric(). why? -- Jonas Malmros Stockho

Re: [R] How to create a mixed col.names?

2007-12-17 Thread Jonas Malmros
Thanks Gabor! On Dec 17, 2007 3:22 PM, Gabor Csardi <[EMAIL PROTECTED]> wrote: > paste(rep(c("Factor", "Sign Factor"), 5), rep(1:5, each=2)) > > Replace '5' with the desired number, > Gabor > > > On Mon, Dec 17, 2007 at 03:08:09PM +0100, J

[R] Cannot grasp how to apply "by" here...

2007-12-17 Thread Jonas Malmros
t : "Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent" I used browser() and I see that the Name is not assigned to the row name of vector and then dim(x)[1] does not work. What am I doing wrong? Do not understand. :-( Thank you in advance f

[R] How to create a mixed col.names?

2007-12-17 Thread Jonas Malmros
Factor 3" "Sign Factor 3" How can I automate the creation of such a mixed vector? I tried with rep but did not succeed. Could someone please suggest a solution to this problem? Thanks in advance! Regards, JM -- Jonas Malmros Stockholm University Stockholm, Sweden _

[R] Cleaning database: grep()? apply()?

2007-11-13 Thread Jonas Malmros
adjustments. I am new to R, I do write code but usually it consists of for-functions and plotting. I would much appreciate your help. Thank you in advance! -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https

Re: [R] textplot() in gplots causes problems (0x9)

2007-11-01 Thread Jonas Malmros
rwidth(object, cex = cex) : font width unknown for character 0x9 4: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, : font width unknown for character 0x9 5: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, : font width unknown for character 0x9 in PDF everyth

Re: [R] textplot() in gplots causes problems (0x9)

2007-11-01 Thread Jonas Malmros
gt; > There are two simple solutions. First, avoid using characters R > can't figure out sizes for (i.e. tab), or manually specify the font > size so textplot() doesn't attempt to optimize it. > > I personally choose the former, avoid tab characters, since the > app

[R] textplot() in gplots causes problems (0x9)

2007-10-31 Thread Jonas Malmros
t;, : font width unknown for character 0x9 6: In strwidth(object, cex = cex) : font width unknown for character 0x9 7: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, : font width unknown for character 0x9 8: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, : font

Re: [R] How to make own function load automatically on startup

2007-10-30 Thread Jonas Malmros
what :: is and where can I read more about this > > function? > > > help("::") > > -- > Regards, > Hans-Peter -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

[R] Attaching interactive plot to existing PDF file

2007-10-28 Thread Jonas Malmros
n dev.copy(dev.cur(), which = dev.prev()) : cannot supply 'which' and 'device' at the same time and when I close off the devices, my PDF file contains only barplots and histograms. Could someone please instruct me? Thank you in advance for your time and help. -- Jonas Malmros

[R] How to make own function load automatically on startup

2007-10-27 Thread Jonas Malmros
t this function? Thank you very much in advance for your time and help! -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://ww

[R] glm with Student t for error distribution

2007-10-26 Thread Jonas Malmros
proceed to fit glm with Student t? I know that Student t is the Inverse Gamma with shape parameter equal to degrees of freedom (=4). Would it be correct then to specify Gamma family and inverse link in the glm function? Thank you for your help. Jonas M. University of Stockholm -- Jonas Malmros