[R] Comparing two GAMs using anova (mgcv)

2013-09-20 Thread Lucas Holland
Hey all, I've fitted two GAMs to some data using mgcv. The only difference between the two models is that one includes an additional smooth term (the smooth terms are s(x), s(y) and s(log(y)), the difference being that one model contains s(y) as additional term whereas the other one only

[R] Plotting GAM fit using RGL

2013-08-15 Thread Lucas Holland
Hello all, I’ve fitted a bivariate smoothing model (with GAM) to some data, using two explanatory variables, x and y. Now I’d like to add the surface corresponding to my fit to a 3D scatterplot generated using plot3d(). My approach so far is to create a grid of x and y values and the

[R] Polynomial Regression and NA coefficients in R

2013-04-27 Thread Lucas Holland
Hey all, I'm performing polynomial regression. I'm simulating x values using runif() and y values using a deterministic function of x and rnorm(). When I perform polynomial regression like this: fit_poly - lm(y ~ poly(x,11,raw = TRUE)) I get some NA coefficients. I think this is due to the

[R] GAM Penalised Splines - Intercept

2013-04-23 Thread Lucas Holland
Hey all, I'm using the gam() function inside the mgcv package to fit a penalised spline to some data. However, I don't quite understand what exactly the intercept it includes by default is / how to interpret it. Ideally I'd like to understand what the intercept is in terms of the B-Spline

[R] Median across matrices

2013-03-22 Thread Lucas Holland
Hey all, I have a list of matrices. I'd like to calculate the median across all those matrices for each element. What I'd like to end up with is a matrix containing the median of all [1,1] [1,2] etc. elements across all matrices. Is there a concise way of doing that? Thanks!

[R] Copula package - normalCopula() param order

2013-03-17 Thread Lucas Holland
Hey all, I'm trying to construct a 7-dimensional normal copula using the copula package. I'd like to supply as parameter a randomly generated correlation matrix (that I'll convert to a vector so I can feed it to the normalCopula function). What order do the pairwise correlations inside that