[R] GAM using penalized regression splines with 4 degress o.f.

Collin Lynch collinl at cs.pitt.edu
Wed Feb 19 16:37:29 CET 2014


Hi Katharina, what gam package are you using?  With mgcv you can inspect
the results of the output variables to check whether the fixed field is
true which would indicate whether the df is fixed or floating.  I'm not
sure if this is applicable to what you want.

My rough translation of your German error message, however, suggests that
that the problem may stem from the lagBYmean variable.  It looks like it
is complaining that the number of items is not a multiple of
Ersetzungslnge (4?).  It may be that you don't have a sufficient
distribution for the df that you want.

    Hope that helps,
    Collin.

On Wed, 19 Feb 2014, Katharina Mersmann wrote:

> Dear R-Users,
>
> I am fairly new to R and got in trouble by understanding how to run a GAM
> using penalized regression splines with 4 degress of freedom (even by
> reading the R Documentation).
>
>
>
> I tried the following:
>
> >  gamreg1.2<-gam(num_FCRlong ~ s(GDP,df=4)+s(cupol_GDPpCapita,df=4)
>
> +                              +s(fort_budget,df=4)+s(fort_percentDebt,
> df=4)
>
> +                              +s(linpol_primSurplus,df=4)+s(Inflation,df=4)
>
> +                              +s(lagBYmean,df=4),
>
> +                  data = data.plm)
>
> Fehler in o[, i] <- junk$o :
>
>   Anzahl der zu ersetzenden Elemente ist kein Vielfaches der Ersetzungslänge
>
>
>
> If I remove
>
>      +s(lagBYmean,df=4),
>
> It works.
>
>
>
> So I do not really understand why this is the case and what I am actually
> doing wrong.
>
> Further I am even not sure, if this is the right code at all.
>
> Will I receive run a GAM using penalized regression splines with 4 degress
> of freedom by this code?
>
>
>
> Thanks for your help and have a nice day!
> Katie
>
>
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
>




More information about the R-help mailing list