Re: [R] glmmLasso with interactions errors

2016-07-16 Thread David Winsemius

> On Jul 16, 2016, at 11:26 AM, Walker Pedersen  wrote:
> 
> Hi,
> 
> Thanks for the response.
> 
> The warnings and errors can be reproduced with the data and code I
> included in my first mailing list post. I will provide the full output
> at the end of this post.
> 

I get:

> glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
+ STAIt + as.factor(ROI)
+ + as.factor(Novelty):as.factor(Valence):as.factor(ROI),
+ list(Subject=~1), data = Nov7T, lambda=10)
Error in is.data.frame(data) : object 'Nov7T' not found

If I instead run with KNov rather than the missing Nov7T object and use the 
`interaction` function to build a three-way interaction, I get:

glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
STAIt + as.factor(ROI) + interaction(Novelty,Valence,ROI),
list(Subject=~1), data = KNov, lambda=10)
summary(glm2)
Call:
glmmLasso(fix = Activity ~ as.factor(Novelty) + as.factor(Valence) + 
STAIt + as.factor(ROI) + interaction(Novelty, Valence, ROI), 
rnd = list(Subject = ~1), data = KNov, lambda = 10)


Fixed Effects:

Coefficients:
   Estimate StdErr z.value p.value
(Intercept)  1.4584e-01 NA  NA  NA
as.factor(Novelty)R -6.3017e-02 NA  NA  NA
as.factor(Valence)N -3.8093e-02 NA  NA  NA
STAIt   -1.7146e-03 NA  NA  NA
as.factor(ROI)B -1.3502e-02 NA  NA  NA
as.factor(ROI)H  1.1962e-03 NA  NA  NA
interaction(Novelty, Valence, ROI)R.E.A  0.e+00 NA  NA  NA
interaction(Novelty, Valence, ROI)N.N.A -1.9828e-02 NA  NA  NA
interaction(Novelty, Valence, ROI)R.N.A  2.5937e-19 NA  NA  NA
interaction(Novelty, Valence, ROI)N.E.B  0.e+00 NA  NA  NA
interaction(Novelty, Valence, ROI)R.E.B  0.e+00 NA  NA  NA
interaction(Novelty, Valence, ROI)N.N.B  0.e+00 NA  NA  NA
interaction(Novelty, Valence, ROI)R.N.B  0.e+00 NA  NA  NA
interaction(Novelty, Valence, ROI)N.E.H  0.e+00 NA  NA  NA
interaction(Novelty, Valence, ROI)R.E.H -2.1495e-02 NA  NA  NA
interaction(Novelty, Valence, ROI)N.N.H  0.e+00 NA  NA  NA
interaction(Novelty, Valence, ROI)R.N.H  0.e+00 NA  NA  NA

Random Effects:

StdDev:
  Subject
Subject 0.0644229

It does appear that the author has tried to discourage using formula-mediated 
interactions, since with a continuous-by-factor interaction I get this error 
message:

Error in est.glmmLasso.RE(fix = fix, rnd = rnd, data = data, lambda = lambda,  
: 
  Usage of '*' not allowed in formula! Please specify the corresponding 
variables separately.


Neither of the first two examples on the glmmLasso page returns standard errors 
either. Perhaps you should correspond with the package author. Are you familiar 
with the maintainer function?

David



> By sketchy, I mean having a higher likelihood of resulting in
> overfitting.  By more straightforward, I mean having a less steep
> learning curve for implementation.
> 
>   Thanks for your help!
> 
> 
>> KNov <- read.table("Novelty_abr.txt", header = TRUE)
>> KNov$Subject <- factor(KNov$Subject)
>> glm1 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) + STAIt + 
>> as.factor(ROI)
> + + as.factor(Valence):as.factor(ROI), list(Subject=~1), data = KNov, 
> lambda=10)
>> summary(glm1)
> Call:
> glmmLasso(fix = Activity ~ as.factor(Novelty) + as.factor(Valence) +
>STAIt + as.factor(ROI) + as.factor(Valence):as.factor(ROI),
>rnd = list(Subject = ~1), data = KNov, lambda = 10)
> 
> 
> Fixed Effects:
> 
> Coefficients:
>   Estimate StdErr z.value p.value
> (Intercept)  0.14047593 NA  NA  NA
> as.factor(Novelty)R -0.06333466 NA  NA  NA
> as.factor(Valence)N -0.03537854 NA  NA  NA
> STAIt   -0.00173351 NA  NA  NA
> as.factor(ROI)B -0.00438142 NA  NA  NA
> as.factor(ROI)H  0.00016285 NA  NA  NA
> as.factor(Valence)N:as.factor(ROI)B -0.00739870 NA  NA  NA
> as.factor(Valence)N:as.factor(ROI)H  0. NA  NA  NA
> 
> Random Effects:
> 
> StdDev:
>   Subject
> Subject 0.05186835
>> glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) + STAIt + 
>> as.factor(ROI)
> + + as.factor(Novelty):as.factor(Valence):as.factor(ROI),
> list(Subject=~1), data = Nov7T, lambda=10)
> Warning messages:
> 1: In split.default((1:ncol(X))[-inotpen.which], ipen) :
>  data length is not a multiple of split variable
> 2: In lambda_vec * sqrt(block2) :
>  longer object length is not a multiple of shorter object length
> 3: In 

Re: [R] glmmLasso with interactions errors

2016-07-16 Thread Walker Pedersen
Hi,

Thanks for the response.

The warnings and errors can be reproduced with the data and code I
included in my first mailing list post. I will provide the full output
at the end of this post.

By sketchy, I mean having a higher likelihood of resulting in
overfitting.  By more straightforward, I mean having a less steep
learning curve for implementation.

Thanks for your help!


> KNov <- read.table("Novelty_abr.txt", header = TRUE)
> KNov$Subject <- factor(KNov$Subject)
> glm1 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) + STAIt + 
> as.factor(ROI)
+ + as.factor(Valence):as.factor(ROI), list(Subject=~1), data = KNov, lambda=10)
> summary(glm1)
Call:
glmmLasso(fix = Activity ~ as.factor(Novelty) + as.factor(Valence) +
STAIt + as.factor(ROI) + as.factor(Valence):as.factor(ROI),
rnd = list(Subject = ~1), data = KNov, lambda = 10)


Fixed Effects:

Coefficients:
   Estimate StdErr z.value p.value
(Intercept)  0.14047593 NA  NA  NA
as.factor(Novelty)R -0.06333466 NA  NA  NA
as.factor(Valence)N -0.03537854 NA  NA  NA
STAIt   -0.00173351 NA  NA  NA
as.factor(ROI)B -0.00438142 NA  NA  NA
as.factor(ROI)H  0.00016285 NA  NA  NA
as.factor(Valence)N:as.factor(ROI)B -0.00739870 NA  NA  NA
as.factor(Valence)N:as.factor(ROI)H  0. NA  NA  NA

Random Effects:

StdDev:
   Subject
Subject 0.05186835
> glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) + STAIt + 
> as.factor(ROI)
+ + as.factor(Novelty):as.factor(Valence):as.factor(ROI),
list(Subject=~1), data = Nov7T, lambda=10)
Warning messages:
1: In split.default((1:ncol(X))[-inotpen.which], ipen) :
  data length is not a multiple of split variable
2: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
3: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
4: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
5: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
6: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
7: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
8: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
9: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length
> summary(glm2)
Call:
glmmLasso(fix = Activity ~ as.factor(Novelty) + as.factor(Valence) +
STAIt + as.factor(ROI) +
as.factor(Novelty):as.factor(Valence):as.factor(ROI),
rnd = list(Subject = ~1), data = Nov7T, lambda = 10)


Fixed Effects:

Coefficients:
 Estimate
StdErr z.value p.value
(Intercept)-0.0562165
   NA  NA  NA
as.factor(Novelty)R-0.0218362
   NA  NA  NA
as.factor(Valence)N-0.0067723
   NA  NA  NA
STAIt   0.0028832
   NA  NA  NA
as.factor(ROI)BNST -0.0457882
   NA  NA  NA
as.factor(ROI)Hip  -0.0430477
   NA  NA  NA
as.factor(Novelty)N:as.factor(Valence)E:as.factor(ROI)Amy   0.000
   NA  NA  NA
as.factor(Novelty)R:as.factor(Valence)E:as.factor(ROI)Amy   0.000
   NA  NA  NA
as.factor(Novelty)N:as.factor(Valence)N:as.factor(ROI)Amy   0.0164788
   NA  NA  NA
as.factor(Novelty)R:as.factor(Valence)N:as.factor(ROI)Amy   0.0067723
   NA  NA  NA
as.factor(Novelty)N:as.factor(Valence)E:as.factor(ROI)BNST  0.000
   NA  NA  NA
as.factor(Novelty)R:as.factor(Valence)E:as.factor(ROI)BNST  0.000
   NA  NA  NA
as.factor(Novelty)N:as.factor(Valence)N:as.factor(ROI)BNST  0.000
   NA  NA  NA
as.factor(Novelty)R:as.factor(Valence)N:as.factor(ROI)BNST  0.000
   NA  NA  NA
as.factor(Novelty)N:as.factor(Valence)E:as.factor(ROI)Hip   0.000
   NA  NA  NA
as.factor(Novelty)R:as.factor(Valence)E:as.factor(ROI)Hip   0.000
   NA  NA  NA
as.factor(Novelty)N:as.factor(Valence)N:as.factor(ROI)Hip   0.0338616
   NA  NA  NA
as.factor(Novelty)R:as.factor(Valence)N:as.factor(ROI)Hip   0.000
   NA  NA  NA

Random Effects:

StdDev:
   Subject
Subject 0.09132963
> glm3 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) + STAIt + 
> as.factor(ROI)
+ + as.factor(Valence):as.factor(ROI) + as.factor(Novelty):STAIt,
list(Subject=~1), data = Nov7T, 

Re: [R] glmmLasso with interactions errors

2016-07-16 Thread David Winsemius

> On Jul 16, 2016, at 9:29 AM, Walker Pedersen  wrote:
> 
> Thank you for the input Brian and Ben.
> 
> It is odd how it seems to handle a two way interaction fine (as long
> as the continuous variable is not in the mix), but not a 3-way.

You should post code and data to demonstrate what is "not being handled".
> 
> In any case would anyone be able to give me a rundown of how I would
> create a matrix/dummy variable for these interactions to input into
> glmmLASSO?

Your first question on this dataset June 17 to CrossValidated.com was closed 
because no reproducible example was offered. You then posted two further 
questions on StackOverflow and got guesses as to the solutions  because you 
again posted no reproducible examples. One of those questions was given in this 
thread as a possible solution. IN the otehr one you did post some output that 
gave clues as to the arrangement of your data and suggested that the 
categorical data was relatively sparse:

http://stackoverflow.com/questions/38132830/getting-p-values-for-all-included-parameters-using-glmmlasso

Now you are getting advice that is similarly just speculation due to lack of 
code,  data and output. You are unlikely to get further advice that addresses 
what ever problems you have vaguely described unless you post examples of code 
that is failing along with either a) the real data or b) R code that creates a 
simulation with covariate features resembling your data.
> 
> Alternatively, is there a method for paring down a model that is a bit
> less sketchy than simple backfitting, that you would expect to be more
> straight forward software-wise?

That appears incredibly vague. Exactly what is "sketchy"? And what would be 
"more straightforward"?

-- 
David.


> Thanks!
> 
> Walker
> 
> UW-MKE
> 
> On Thu, Jul 14, 2016 at 10:08 AM, Cade, Brian  wrote:
>> It has never been obvious to me that the lasso approach can handle
>> interactions among predictor variables well at all.  I'ld be curious to see
>> what others think and what you learn.
>> 
>> Brian
>> 
>> Brian S. Cade, PhD
>> 
>> U. S. Geological Survey
>> Fort Collins Science Center
>> 2150 Centre Ave., Bldg. C
>> Fort Collins, CO  80526-8818
>> 
>> email:  ca...@usgs.gov
>> tel:  970 226-9326
>> 
>> 
>> On Wed, Jul 13, 2016 at 2:20 PM, Walker Pedersen  wrote:
>>> 
>>> Hi Everyone,
>>> 
>>> I am having trouble running glmmLasso.
>>> 
>>> An abbreviated version of my dataset is here:
>>> 
>>> https://drive.google.com/open?id=0B_LliPDGUoZbVVFQS2VOV3hGN3c
>>> 
>>> Activity is a measure of brain activity, Novelty and Valence are
>>> categorical variables coding the type of stimulus used to elicit the
>>> response, ROI is a categorical variable coding three regions of the
>>> brain that we have sampled this activity from, and STAIt is a
>>> continuous measure representing degree of a specific personality trait
>>> of the subjects. Subject is an ID number for the individuals the data
>>> was sampled from.
>>> 
>>> Before glmmLasso I am running:
>>> 
>>> KNov$Subject <- factor(KNov$Subject)
>>> 
>>> to ensure the subject ID is not treated as a continuous variable.
>>> 
>>> If I run:
>>> 
>>> glm1 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
>>> STAIt + as.factor(ROI)
>>> + as.factor(Valence):as.factor(ROI), list(Subject=~1), data = KNov,
>>> lambda=10)
>>> summary(glm1)
>>> 
>>> I don't get any warning messages, but the output contains b estimates
>>> only, no SE or p-values.
>>> 
>>> If I try to include a 3-way interaction, such as:
>>> 
>>> glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
>>> STAIt + as.factor(ROI)
>>> + as.factor(Novelty):as.factor(Valence):as.factor(ROI),
>>> list(Subject=~1), data = Nov7T, lambda=10)
>>> summary(glm2)
>>> 
>>> I get the warnings:
>>> 
>>> Warning messages:
>>> 1: In split.default((1:ncol(X))[-inotpen.which], ipen) :
>>>  data length is not a multiple of split variable
>>> 2: In lambda_vec * sqrt(block2) :
>>>  longer object length is not a multiple of shorter object length
>>> 
>>> And again, I do get parameter estimates, and no SE or p-values.
>>> 
>>> If I include my continuous variable in any interaction, such as:
>>> 
>>> glm3 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
>>> STAIt + as.factor(ROI)
>>> + as.factor(Valence):as.factor(ROI) + as.factor(Novelty):STAIt,
>>> list(Subject=~1), data = Nov7T, lambda=10)
>>> summary(glm3)
>>> 
>>> I get the error message:
>>> 
>>> Error in rep(control$index[i], length.fac) : invalid 'times' argument
>>> 
>>> and no output.
>>> 
>>> If anyone has an input as to (1) why I am not getting SE or p-values
>>> in my outputs (2) the meaning of there warnings I get when I include a
>>> 3-way variable, and if they are something to worry about, how to fix
>>> them and (3) how to fix the error message I get when I include my
>>> continuous factor in an interatction, I would be very appreciative.
>>> 
>>> Thanks!
>>> 
>>> 

Re: [R] glmmLasso with interactions errors

2016-07-16 Thread Walker Pedersen
Thank you for the input Brian and Ben.

It is odd how it seems to handle a two way interaction fine (as long
as the continuous variable is not in the mix), but not a 3-way.

In any case would anyone be able to give me a rundown of how I would
create a matrix/dummy variable for these interactions to input into
glmmLASSO?

Alternatively, is there a method for paring down a model that is a bit
less sketchy than simple backfitting, that you would expect to be more
straight forward software-wise?

Thanks!

Walker

UW-MKE

On Thu, Jul 14, 2016 at 10:08 AM, Cade, Brian  wrote:
> It has never been obvious to me that the lasso approach can handle
> interactions among predictor variables well at all.  I'ld be curious to see
> what others think and what you learn.
>
> Brian
>
> Brian S. Cade, PhD
>
> U. S. Geological Survey
> Fort Collins Science Center
> 2150 Centre Ave., Bldg. C
> Fort Collins, CO  80526-8818
>
> email:  ca...@usgs.gov
> tel:  970 226-9326
>
>
> On Wed, Jul 13, 2016 at 2:20 PM, Walker Pedersen  wrote:
>>
>> Hi Everyone,
>>
>> I am having trouble running glmmLasso.
>>
>> An abbreviated version of my dataset is here:
>>
>> https://drive.google.com/open?id=0B_LliPDGUoZbVVFQS2VOV3hGN3c
>>
>> Activity is a measure of brain activity, Novelty and Valence are
>> categorical variables coding the type of stimulus used to elicit the
>> response, ROI is a categorical variable coding three regions of the
>> brain that we have sampled this activity from, and STAIt is a
>> continuous measure representing degree of a specific personality trait
>> of the subjects. Subject is an ID number for the individuals the data
>> was sampled from.
>>
>> Before glmmLasso I am running:
>>
>> KNov$Subject <- factor(KNov$Subject)
>>
>> to ensure the subject ID is not treated as a continuous variable.
>>
>> If I run:
>>
>> glm1 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
>> STAIt + as.factor(ROI)
>> + as.factor(Valence):as.factor(ROI), list(Subject=~1), data = KNov,
>> lambda=10)
>> summary(glm1)
>>
>> I don't get any warning messages, but the output contains b estimates
>> only, no SE or p-values.
>>
>> If I try to include a 3-way interaction, such as:
>>
>> glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
>> STAIt + as.factor(ROI)
>> + as.factor(Novelty):as.factor(Valence):as.factor(ROI),
>> list(Subject=~1), data = Nov7T, lambda=10)
>> summary(glm2)
>>
>> I get the warnings:
>>
>> Warning messages:
>> 1: In split.default((1:ncol(X))[-inotpen.which], ipen) :
>>   data length is not a multiple of split variable
>> 2: In lambda_vec * sqrt(block2) :
>>   longer object length is not a multiple of shorter object length
>>
>> And again, I do get parameter estimates, and no SE or p-values.
>>
>> If I include my continuous variable in any interaction, such as:
>>
>> glm3 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
>> STAIt + as.factor(ROI)
>> + as.factor(Valence):as.factor(ROI) + as.factor(Novelty):STAIt,
>> list(Subject=~1), data = Nov7T, lambda=10)
>> summary(glm3)
>>
>> I get the error message:
>>
>> Error in rep(control$index[i], length.fac) : invalid 'times' argument
>>
>> and no output.
>>
>> If anyone has an input as to (1) why I am not getting SE or p-values
>> in my outputs (2) the meaning of there warnings I get when I include a
>> 3-way variable, and if they are something to worry about, how to fix
>> them and (3) how to fix the error message I get when I include my
>> continuous factor in an interatction, I would be very appreciative.
>>
>> Thanks!
>>
>> Walker
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] glmmLasso with interactions errors

2016-07-15 Thread Ben Bolker
Cade, Brian  usgs.gov> writes:

> 
> It has never been obvious to me that the lasso approach can handle
> interactions among predictor variables well at all. 
> I'ld be curious to see
> what others think and what you learn.
> 
> Brian
> 

  For what it's worth I think lasso *does* handle interactions
reasonably (although I forget where I read that) -- there is a
newer "hierarchical lasso" that tries to deal with marginality
concerns more carefully.

  Related questions asked on StackOverflow:

http://stackoverflow.com/questions/37910042/glmmlasso-warning-messages/
  37922918#37922918
(warning, broken URL)

My answer (in comments) there was

my guess is that you're going to have to build your own model
matrix/dummy variables; I think that as.factor() in formulas is
treated specially, so including the interaction term will probably
just confuse it. (It would be worth trying as.factor(Novelty:ROI) - I
doubt it'll work but if it does it would be the easiest way forward.)


> 
> On Wed, Jul 13, 2016 at 2:20 PM, Walker Pedersen  uwm.edu> wrote:

[snip]

> >
> > An abbreviated version of my dataset is here:
> >
> > https://drive.google.com/open?id=0B_LliPDGUoZbVVFQS2VOV3hGN3c
> >

[snip snip]

> > Before glmmLasso I am running:
> >
> > KNov$Subject <- factor(KNov$Subject)
> >
> > to ensure the subject ID is not treated as a continuous variable.
> >
> > If I run:
> >
> > glm1 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
> > STAIt + as.factor(ROI)
> > + as.factor(Valence):as.factor(ROI), list(Subject=~1), data = KNov,
> > lambda=10)
> > summary(glm1)
> >
> > I don't get any warning messages, but the output contains b estimates
> > only, no SE or p-values.
> >
> > If I try to include a 3-way interaction, such as:
> >
> > glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
> > STAIt + as.factor(ROI)
> > + as.factor(Novelty):as.factor(Valence):as.factor(ROI),
> > list(Subject=~1), data = Nov7T, lambda=10)
> > summary(glm2)
> >
> > I get the warnings:
> >
> > Warning messages:
> > 1: In split.default((1:ncol(X))[-inotpen.which], ipen) :
> >   data length is not a multiple of split variable
> > 2: In lambda_vec * sqrt(block2) :
> >   longer object length is not a multiple of shorter object length
> >
> > And again, I do get parameter estimates, and no SE or p-values.
> >
> > If I include my continuous variable in any interaction, such as:
> >
> > glm3 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
> > STAIt + as.factor(ROI)
> > + as.factor(Valence):as.factor(ROI) + as.factor(Novelty):STAIt,
> > list(Subject=~1), data = Nov7T, lambda=10)
> > summary(glm3)
> >
> > I get the error message:
> >
> > Error in rep(control$index[i], length.fac) : invalid 'times' argument
> >
> > and no output.
> >
> > If anyone has an input as to (1) why I am not getting SE or p-values
> > in my outputs (2) the meaning of there warnings I get when I include a
> > 3-way variable, and if they are something to worry about, how to fix
> > them and (3) how to fix the error message I get when I include my
> > continuous factor in an interatction, I would be very appreciative.


 [snip snip snip]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] glmmLasso with interactions errors

2016-07-14 Thread Cade, Brian
It has never been obvious to me that the lasso approach can handle
interactions among predictor variables well at all.  I'ld be curious to see
what others think and what you learn.

Brian

Brian S. Cade, PhD

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO  80526-8818

email:  ca...@usgs.gov 
tel:  970 226-9326


On Wed, Jul 13, 2016 at 2:20 PM, Walker Pedersen  wrote:

> Hi Everyone,
>
> I am having trouble running glmmLasso.
>
> An abbreviated version of my dataset is here:
>
> https://drive.google.com/open?id=0B_LliPDGUoZbVVFQS2VOV3hGN3c
>
> Activity is a measure of brain activity, Novelty and Valence are
> categorical variables coding the type of stimulus used to elicit the
> response, ROI is a categorical variable coding three regions of the
> brain that we have sampled this activity from, and STAIt is a
> continuous measure representing degree of a specific personality trait
> of the subjects. Subject is an ID number for the individuals the data
> was sampled from.
>
> Before glmmLasso I am running:
>
> KNov$Subject <- factor(KNov$Subject)
>
> to ensure the subject ID is not treated as a continuous variable.
>
> If I run:
>
> glm1 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
> STAIt + as.factor(ROI)
> + as.factor(Valence):as.factor(ROI), list(Subject=~1), data = KNov,
> lambda=10)
> summary(glm1)
>
> I don't get any warning messages, but the output contains b estimates
> only, no SE or p-values.
>
> If I try to include a 3-way interaction, such as:
>
> glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
> STAIt + as.factor(ROI)
> + as.factor(Novelty):as.factor(Valence):as.factor(ROI),
> list(Subject=~1), data = Nov7T, lambda=10)
> summary(glm2)
>
> I get the warnings:
>
> Warning messages:
> 1: In split.default((1:ncol(X))[-inotpen.which], ipen) :
>   data length is not a multiple of split variable
> 2: In lambda_vec * sqrt(block2) :
>   longer object length is not a multiple of shorter object length
>
> And again, I do get parameter estimates, and no SE or p-values.
>
> If I include my continuous variable in any interaction, such as:
>
> glm3 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
> STAIt + as.factor(ROI)
> + as.factor(Valence):as.factor(ROI) + as.factor(Novelty):STAIt,
> list(Subject=~1), data = Nov7T, lambda=10)
> summary(glm3)
>
> I get the error message:
>
> Error in rep(control$index[i], length.fac) : invalid 'times' argument
>
> and no output.
>
> If anyone has an input as to (1) why I am not getting SE or p-values
> in my outputs (2) the meaning of there warnings I get when I include a
> 3-way variable, and if they are something to worry about, how to fix
> them and (3) how to fix the error message I get when I include my
> continuous factor in an interatction, I would be very appreciative.
>
> Thanks!
>
> Walker
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] glmmLasso with interactions errors

2016-07-13 Thread Walker Pedersen
Hi Everyone,

I am having trouble running glmmLasso.

An abbreviated version of my dataset is here:

https://drive.google.com/open?id=0B_LliPDGUoZbVVFQS2VOV3hGN3c

Activity is a measure of brain activity, Novelty and Valence are
categorical variables coding the type of stimulus used to elicit the
response, ROI is a categorical variable coding three regions of the
brain that we have sampled this activity from, and STAIt is a
continuous measure representing degree of a specific personality trait
of the subjects. Subject is an ID number for the individuals the data
was sampled from.

Before glmmLasso I am running:

KNov$Subject <- factor(KNov$Subject)

to ensure the subject ID is not treated as a continuous variable.

If I run:

glm1 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
STAIt + as.factor(ROI)
+ as.factor(Valence):as.factor(ROI), list(Subject=~1), data = KNov, lambda=10)
summary(glm1)

I don't get any warning messages, but the output contains b estimates
only, no SE or p-values.

If I try to include a 3-way interaction, such as:

glm2 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
STAIt + as.factor(ROI)
+ as.factor(Novelty):as.factor(Valence):as.factor(ROI),
list(Subject=~1), data = Nov7T, lambda=10)
summary(glm2)

I get the warnings:

Warning messages:
1: In split.default((1:ncol(X))[-inotpen.which], ipen) :
  data length is not a multiple of split variable
2: In lambda_vec * sqrt(block2) :
  longer object length is not a multiple of shorter object length

And again, I do get parameter estimates, and no SE or p-values.

If I include my continuous variable in any interaction, such as:

glm3 <- glmmLasso(Activity~as.factor(Novelty) + as.factor(Valence) +
STAIt + as.factor(ROI)
+ as.factor(Valence):as.factor(ROI) + as.factor(Novelty):STAIt,
list(Subject=~1), data = Nov7T, lambda=10)
summary(glm3)

I get the error message:

Error in rep(control$index[i], length.fac) : invalid 'times' argument

and no output.

If anyone has an input as to (1) why I am not getting SE or p-values
in my outputs (2) the meaning of there warnings I get when I include a
3-way variable, and if they are something to worry about, how to fix
them and (3) how to fix the error message I get when I include my
continuous factor in an interatction, I would be very appreciative.

Thanks!

Walker

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.