[R] General Copula theory

2014-04-11 Thread Chris89
Hi everyone!

Firstly, let me specify that I an new to copula theory, so be gentle! 

I have two data sets containing wind data for 14 years, and I am to use
Gumbel marginals and a Gumbel copula. The question is, how will I generate
data from the marginals? 

I have 14 years of data (4 observations each day), so I have taken the
maximum of each year (eliminating seasonality) and then found the parameters
of the corresponding Gumbel distribution. But then what? Should I generate n
values of Gumbel distributed data, get uniform values by the inverse
cumulative, and then put these into the Gumbel copula?

I guess this have to be wrong, but I just can't seem to find a good
procedure on this topic.

Sincerely
Chris




--
View this message in context: 
http://r.789695.n4.nabble.com/General-Copula-theory-tp4688594.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Lognormal AR(0,1) model

2014-04-04 Thread Chris89
Hi everyone!

I am trying to make two log-normal AR(0,1) model using R with a given
correlation between them, \rho, on the form:

X_t = \alpha X_{t-1} + a_t
Y_t = \beta Y_{t-1} + b_t

At the moment I have been making n values of correlated log-normal data,
called a_t and b_t, and generated a starting value X[1] and Y[1] using the
rnorm() function. The rest of the n-1 values are calculated in a for() loop.
The data do get a lognormal look, but it is obviously not a lognormal
distribution. 

As I am a novice to time-series, my question is simply: Are there any way to
make correlated log-normal distributed AR(0,1) models, and are there any
package in R that will help me?

sincerely
Chris

 





--
View this message in context: 
http://r.789695.n4.nabble.com/Lognormal-AR-0-1-model-tp4688176.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Simulate from an ARIMA Model with fixed errors

2014-02-14 Thread Chris89
Hi everyone!I am trying to make some synthetic data using two AR(1) models,
but I am having some troubles.I want to make data from:x_t = \alpha x_{t-1}
+ a_{1t}y_t = \beta y_{t-1} + \gamma a_{1t} + \sqrt{1-\gamma^2} a_{2t}But I
don't know how to set a fixed error term in the arima.sim()
function...Thanks!-Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/Simulate-from-an-ARIMA-Model-with-fixed-errors-tp4685316.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Hide return values

2013-11-18 Thread Chris89
Awesome, thanks!

-Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/Hide-return-values-tp4680611p4680666.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Hide return values

2013-11-17 Thread Chris89
Hi everyone!

I am in the process of writing an R-package and while writing a summary
function, I have come across a problem. I am able to print a summary table
(as in a standard glm() summary) by using *cat()* but the values I return is
also printet. 
How am I able to remove the return values from being printet, but still
being able to grab using e.g. summary$coeff??

Sincerly
Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/Hide-return-values-tp4680611.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Extracting AICc and BIC from an ARIMA model.

2013-10-19 Thread Chris89
Hi everyone!

I am making some time series models, and as i want to compare a lot of
models I thought it would be smart to compare the AIC, AICc and BIC values
from the models. My question is, how can I extract the BIC and AICc from the
model?

As an example:

kings - scan(http://robjhyndman.com/tsdldata/misc/kings.dat,skip=3)
mod = arima(kings, order = c(1,0,0), include.mean=T)

obviously summary(mod) would suffice, but I don't want to have to look
through all the models (as there are alot... )

Sincerly 
Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/Extracting-AICc-and-BIC-from-an-ARIMA-model-tp4678593.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] regression imputation in R

2013-09-09 Thread Chris89
Hi!

For example if data is the complete dataset with both x and y values:

tempdata = data[complete.cases(data[,1:2]),] # Regression data
model = lm(y~x, data = tempdata)   # Linear model

From this you can calculate the regression value of the missing values.

Hope this helped!
Regards,
Chris




--
View this message in context: 
http://r.789695.n4.nabble.com/regression-imputation-in-R-tp4675667p4675677.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Regression using ggplot2

2013-09-09 Thread Chris89
Hi!
I am currently working with a project where I want to plot the regression
line in a plot using ggplot.
The problem occurs when I want to add the second variable, i.e. the z in the
source code:

p = ggplot(data = dat, aes_string(x = sd, y = mean, z = corr))  
p = p + stat_smooth(method = lm, formula = y~x+z, se = FALSE, size = 0.75,
linetype = solid)
p = p + geom_point()
plot(p)

I´m not sure if it is even possible to do multiple regression using
stat_smooth, in which case do you have any alternative method?

Best regards
Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/Regression-using-ggplot2-tp4675676.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Adding additional points to ggplot2

2013-08-19 Thread Chris89
That worked great! 

Best regards, 
Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/Adding-additional-points-to-ggplot2-tp4673928p4674059.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Adding additional points to ggplot2

2013-08-16 Thread Chris89
Hi!
I am having a difficulty adding additional points to a plot using ggplot2..

The case is that I want to plot both original and estimated values in the
same graph, and general I would use 
plot and then lines, but I do not know how to do it with ggplot...

Thanks!

Regards,
Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/Adding-additional-points-to-ggplot2-tp4673928.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-squared and GLM

2013-07-18 Thread Chris89
Haha, true true! ;)

It was to be used as a measure on how good the models I use are, but I found
out that the AIC would be much easier to implement, and as I understand, a
better measure of how good the model fit.

Thanks,
Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/R-squared-and-GLM-tp4671754p4671820.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R-squared and GLM

2013-07-17 Thread Chris89
Dear users,

I want to compute r-squared values from a glm regression using a gamma
distribution and an identity link-function, but find no such thing when
using the summary() or names() function. My next guess was to calculate it
by hand, i.e.

r2 = (sum((estimate - xbar)^2) /sum((x-xbar)^2)) 

but I am unsure if this is even allowed...

Chris





--
View this message in context: 
http://r.789695.n4.nabble.com/R-squared-and-GLM-tp4671754.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Finding parameters for residuals using GAMLSS and a lognormal dist.

2013-07-16 Thread Chris89
Hi everyone!

First of all: I am new to the forum, so please excuse my lack of knowledge
on how to post a question...

I am working on a project where I need to use the GAMLSS package, and the
boss have asked me to try using the lognormal distribution. 
The regression goes as planned, but when evaluating the residuals and using
the coef() function, I get multiple coefficients as theory says, but I´m not
sure if they can be used as parameters.

My question is: How can I model the residuals? Do I have to assume a
lognormal distribution of these, or can I assume a distribution of choice? 
I have plotted the kernel density of the residuals and they do seem to fit a
lognormal distribution, but as I am not entirely sure how to find
parameters, I do not know how... I guess this is an easy question, but I
just cant seem to find a solution to this.

A section of the code:
tmpformula = as.formula(paste(logvarnames[i], ~ ,
paste(logvarnames[1:i-1], collapse= +)))
res = gamlss(tmpformula, family = LOGNO(), data = myall )

where logvarnames[] is a vector containing the names of columns  from the
dataset I use called myall. 





--
View this message in context: 
http://r.789695.n4.nabble.com/Finding-parameters-for-residuals-using-GAMLSS-and-a-lognormal-dist-tp4671674.html
Sent from the R help mailing list archive at Nabble.com.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.