[R] nlme Output

2010-09-06 Thread Edward Patzelt
Everyone - What do the NaN's mean here? Is this analysis a problem? Linear mixed-effects model fit by maximum likelihood Data: tmp.dat AIC BIClogLik 1611.251 1638.363 -797.6253 Random effects: Formula: ~1 | group_id (Intercept) Residual StdDev: 0.0003077668

Re: [R] nlme Output

2010-09-06 Thread Edward Patzelt
desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Edward Patzelt Verzonden: maandag 6 september 2010 15:43

[R] Hidden Markov Models in R

2011-07-27 Thread Edward Patzelt
R Community - I am attempting to fit a model as described in Hampton, Bossaerts, and O'doherty (J. Neuroscience) 2006. They use a bayesian hidden markov model to model the Reversal Learning data. I have tried using HMM and depmixS4 with no success. My data is a Reversal Learning Task in which

[R] If find x, then y, else do nothing

2011-08-05 Thread Edward Patzelt
I want to write code that says If you find an element equal to 4 in this vector for each person in the data set tested separately, then put in 1 for 2 and 2 for 4, else leave the variable as is u.ppl - (unique(init.dat1$grid)) l.ppl - length(u.ppl) for (i in 1:l.ppl) {

Re: [R] If find x, then y, else do nothing

2011-08-05 Thread Edward Patzelt
at ?ifelse it is something like a vectorized if statement and is, I believe, preferable to your use of a for loop. I can probably give you a runnable solution if you can give the first few rows of the relevant data. Cheers, Josh On Fri, Aug 5, 2011 at 2:15 PM, Edward Patzelt patze...@umn.edu wrote

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
- recode(x, 2 = 1; 4 = 2) } return(x) } ## do it dat$test - with(dat, *ave*(Slide1_RESP, Subject, FUN = foo)) On Fri, Aug 5, 2011 at 4:56 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Fri, Aug 5, 2011 at 2:34 PM, Edward Patzelt patze...@umn.edu wrote: The problem is that we were using

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
On Mon, Aug 8, 2011 at 10:43 AM, Joshua Wiley jwiley.ps...@gmail.comwrote: On Mon, Aug 8, 2011 at 8:23 AM, Edward Patzelt patze...@umn.edu wrote: Thanks Josh for the code to post I have been trying to figure out how to do that. Your code works except that it changes subjects that responded

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
/x64 (64-bit) with car_2.0-10 HTH, Josh On Mon, Aug 8, 2011 at 9:02 AM, Edward Patzelt patze...@umn.edu wrote: Here's the code. I don't want it to even touch the vector if there are already 1's 2's structure(list(subject = c(8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 42L, 42L, 42L

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
survival_2.36-5 nnet_7.3-1 MASS_7.3-11 again without issue, so I am thinking there must be something particular perhaps to your session going on, but it is difficult to say. On Mon, Aug 8, 2011 at 9:35 AM, Edward Patzelt patze...@umn.edu wrote: H, I pulled out a portion of the data

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
... $ TrainTestBlock : int 1 1 1 1 1 1 1 1 1 1 ... $ TrialType : chr AB AB AB BA ... $ Valid : int 1 1 0 1 1 1 1 1 1 0 ... On Mon, Aug 8, 2011 at 12:35 PM, Edward Patzelt patze...@umn.edu wrote: Here's a thought, when I execute it on a data frame with only the subject

[R] Indexing Permutation Values

2011-08-15 Thread Edward Patzelt
R-help - This code iterates over a function with 2 free parameters to find a list of values (which are the number of incorrect predictions for a computational model). I want to find the values of i,e when there is the minimum number of incorrect predictions. In other words, the value of i and e

[R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
R - I have 3 variables with data below. Variable Rev is a vector that changes from 1 to 2, 2 to 3, etc Variable FF is a binary variable with 1's and 0's. Variable bin is a different binary variable with 1's and 0's. I want to calculate the number of elements: 1. Starting with the first

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
)), .Names = c(Rev, FF, bin), row.names = c(NA, -125L), class = data.frame) On Mon, Aug 22, 2011 at 3:57 PM, Jean V Adams jvad...@usgs.gov wrote: Re: [R] Counting Elements Conditionally Jean V Adams to: Edward Patzelt 08/22/2011 03:53 PM [R] Counting Elements Conditionally Edward

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
after it sees the first occurrence of 0 in FF following a transition, I want it to ignore all further elements until the next transition. On Mon, Aug 22, 2011 at 3:58 PM, Edward Patzelt patze...@umn.edu wrote: Awesome, this is close, couple changes. Below is full data set for 1 person. I

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
, NA, 3, NA,NA, NA, 2) ? Jean Edward Patzelt patze...@umn.edu wrote on 08/22/2011 03:58:38 PM: [image removed] Re: [R] Counting Elements Conditionally Edward Patzelt to: Jean V Adams 08/22/2011 03:58 PM Cc: r-help Awesome, this is close, couple

[R] Running Total

2012-03-05 Thread Edward Patzelt
I'm am trying to create a vector that has a running total that adds each time a 1 occurs. here's the code and data c(1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L,

Re: [R] Running Total

2012-03-05 Thread Edward Patzelt
[12,] 1 9 [13,] 1 10 [14,] 1 11 [15,] 1 12 [16,] 1 13 [17,] 0 13 On Mon, Mar 5, 2012 at 1:51 PM, Edward Patzelt patze...@umn.edu wrote: I'm am trying to create a vector that has a running total that adds each time a 1 occurs. here's the code and data c(1L, 1L, 0L, 1L, 1L

[R] Cubic Gradient Descent Package

2011-11-16 Thread Edward Patzelt
R - Does anyone know of a cubic gradient descent package? I found grad.desc() but that only allows for a 2d function. I have 3 free parameters and thus am looking for a 3d function. Thank you, -- Edward H. Patzelt Research Assistant – TRiCAM Lab University of Minnesota –

[R] Loop through each subject

2011-06-28 Thread Edward Patzelt
R help - I am attempting to write a script that has multiple subjects in 1 data file. Each subject has multiple rows with columns as variables. Here is my code, I am having problem executing it on each unique subject id (dat$Subject). getwd()

Re: [R] Loop through each subject

2011-06-28 Thread Edward Patzelt
- On Tue, Jun 28, 2011 at 1:27 PM, David Winsemius dwinsem...@comcast.netwrote: On Jun 28, 2011, at 1:44 PM, Edward Patzelt wrote: R help - I am attempting to write a script that has multiple subjects in 1 data file. Each subject has multiple rows with columns as variables. Here is my

[R] Softmax Action Selection

2012-06-20 Thread Edward Patzelt
R Community - I'm attempting to apply a softmax action selection to a probability generated by a hidden Markov model. I'm having difficulties in how to apply the softmax temperature parameter (beta). Here is my code thus far. I'm thinking the sigmoid function will work but I need this function

[R] Axis Breaks with ggplot2

2012-10-19 Thread Edward Patzelt
R-help - I'm trying to create axis breaks similar to this : http://www.r-bloggers.com/wp-content/uploads/2010/08/bar-chart-natural-axis-split1.png . Is there a way to do this in R? Here's my code thus far: structure(list(condition = structure(c(2L, 1L, 3L), .Label = c(con, exp, unedit), class

[R] Aggregate Table Data into Cell Frequencies

2012-10-31 Thread Edward Patzelt
R-help - I have this set of aggregated tables (sample data below via dput()). And I would like to have delayValue as the column variables with the temp (temp1, temp2, temp3) values as the row variables. However I would like to have the temp variables *aggregated into single rows* so that I have

[R] Constructing a matrix of outputs from loop

2013-07-08 Thread Edward Patzelt
R - I would like to construct a matrix from the output of a loop that has 2 values it varies over the course of the loop creating a 20x20 matrix of output values: ap = logspace(-3, 0, 20) am = logspace(-3, .7, 20) for (ap in apList) { for (am in amList) { output = func(ap, am) } }

[R] fminsearch usage

2013-10-02 Thread Edward Patzelt
R Help - I'm attempting to use fminsearch and it continues to give me errors. I have a normal Rescorla Wagner function that has 2 parameters and returns total error. for some reason fminsearch keeps saying the type of errors below, I've put the function and data after it using dput sol -

[R] Changing Order of Factor Levels in Mixed Model (nlme)

2013-05-14 Thread Edward Patzelt
R Help - Why is that in the results below, changing the order of the factor (trialType2: levels - DD, SD, DS, SS) changes the estimates in the fixed effects tests? tmp.dat4$trialType2 - sort(tmp.dat4$trialType, decreasing = TRUE) mod2c - lme(proportion.down ~ trialType2, data = tmp.dat4,