nlme arguments explained

han8

New Member
Hi All,

I'm trying to run an nlme on some data looking at the nonlinear response (in this case 'distance', but will also use for 'weight') of individuals ('possum') over time (repeated measures, recorded weekly for 12 weeks = 'week'). There were 3 different 'treatment' groups. Other factors likely to influence the response variable include 'sex' (potentially other variables to add in later). The data looks like:

(data1)
'data.frame': 528 obs. of 5 variables:
$possum : Factor w/ 44 levels "Ham","Hank","Happy",..: 5 5 5 5 5 5 5 5 5 5 ...$ treatment: Factor w/ 3 levels "HARD_RELEASE",..: 1 1 1 1 1 1 1 1 1 1 ...
$sex : Factor w/ 2 levels "F","M": 1 1 1 1 1 1 1 1 1 1 ...$ week : Factor w/ 12 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
\$ distance : num 1388 2678 2629 2629 2581 ...
possum treatment sex week distance
1 Hart HARD_RELEASE F 1 1387.692
2 Hart HARD_RELEASE F 2 2677.538
3 Hart HARD_RELEASE F 3 2629.376
4 Hart HARD_RELEASE F 4 2629.376
5 Hart HARD_RELEASE F 5 2581.214
6 Hart HARD_RELEASE F 6 2588.126

I'm fairly confident I need to use an nlme to analyse the data (it's nonlinear because the distances reach an asymptote at various stages depending on treatment), but I'm having trouble in working out how to plug in the formula to R. The usage given by R is

nlme(model, data, fixed, random, groups, start, correlation, weights, subset, method, na.action, naPattern, control, verbose)

I'm not sure how to get my data in to here - any pointers would be greatly appreciated, thanks! What I've got for each so far is:
model. distance ~ treatment (but do co-variables need to be included in this bit?)
data. data=data1
fixed.
random.
groups.
start. (not sure if required, or whether to use selfStart)
correlation. (default=NULL, I think this is ok?)
weights. (default=NULL, again, I think this is ok)
subset. (default is all, which is what I want)
method. (default is ML, this is ok)
na.action. (there are blanks, which I'm assuming show up as NAs - need to find a way around this)
naPattern.
control.
verbose.