Methods for easily fitting multiple loops from repeated measures designs.

Description

Fit a sinusoidal hysteretic process between an input and an output variable across multiple loops separated by subjects and repeated.

Usage

1
2
3
4
5
6
7
8
floop.repeated(x,y=NULL,m=1,n=1,subjects=NULL,repeated=NULL,
subjects.in="all",repeated.in="all",...)
floop2r.repeated(x,y=NULL,m=1,n=1,subjects=NULL,repeated=NULL,
subjects.in="all",repeated.in="all",...)
## S3 method for class 'fittedlooplist'
summary(object,N=1000,boot=TRUE,seed=NULL,...)
## S3 method for class 'fittedlooplist2r'
summary(object,N=1000,boot=TRUE,seed=NULL,...)

Arguments

x

numeric input vector.

y

numeric output vector.

n

positive integer. Loop shape parameter, see loop.parameters.

m

positive odd integer. Loop bulging parameter, see loop.parameters.

subjects

factor of the same length as x that represents experimental units.

repeated

factor of the same length as x that represents the repeated measure.

subjects.in

a vector of characters, the levels of subjects to be included. Default is "all".

repeated.in

a vector of characters, the levels of repeated to be included. Default is "all".

object

an fittedlooplist object.

N

number of bootstrap replicates. See summary.fittedloop.

boot

whether or not bootstrapping should be performed. See summary.fittedloop.

seed

for generating random numbers. See summary.fittedloop.

...

extra arguments to either floop or summary.fittedloop.

Details

Fits multiple loops with one call, separated by the factors subjects and repeated. The arguments subjects.in and repeated.in are used to select subsets of the factors subjects and repeated.

Value

floop.repeated returns an object of class fittedlooplist.

models

Separate model fits for each loop, see floop.

Estimates

Parameter estimates for all loops in matrix form.

Std.Errors

Delta standard errors for all loops in matrix form.

When boot=TRUE floop.repeated returns an object of class loopsummarylist which consists of

models

Separate model summaries for each ellipse, see summary.fittedloop.

values

Bootstrapped parameter estimates, standard errors, quantiles, and more for each loop.

Boot.Estimates

Bootstrapped parameter estimates with reduced bias.

Boot.Std.Errors

Standard errors provided by bootstrapping.

Author(s)

Spencer Maynes, Fan Yang, and Anne Parkhurst.

References

Yang, F. and A. Parkhurst, Efficient Estimation of Elliptical Hysteresis (submitted)

See Also

floop and summary.fittedloop, also fel.repeated and summary.ellipsefitlist. Also residuals.fittedlooplist.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
data(HysteresisData)
loopmodels.rep <- floop.repeated(HysteresisData$X, HysteresisData$Y,
n=5,m=3, subjects = HysteresisData$subjects,subjects.in=c("A","C"),
repeated=HysteresisData$repeated)
loopmodels.rep                #Gives estimates and delta standard errors
loopmodels.rep$Estimates      #List estimates only
loopmodels.rep$Std.Errors     #List delta standard errors

par(mfrow=c(2,2))
plot(loopmodels.rep,main='Simulated Rep Loops',values="hysteresis")
par(mfrow=c(1,1))

loopmodels.rep$models["A",1]       #Select one subject, one replication

### Bootstrap estimates and standard errors (Seed is necessary if want to reproduce results)
boot.rep.loop=floop.repeated(HysteresisData$X, HysteresisData$Y,
n=5,m=3, subjects = HysteresisData$subjects,subjects.in=c("A","C"),
repeated=HysteresisData$repeated,boot=TRUE,seed=123)
boot.rep.loop                 #Gives boot estimates, boot bias, boot SE and boot quartiles
boot.rep.loop$Boot.Estimates  #Lists boot estimates
boot.rep.loop$Boot.Std.Errors #Gives boot standard errors 

par(mfrow=c(2,2))
plot(boot.rep.loop, main='Simulated Rep Boot Loops', values="hysteresis")
par(mfrow=c(1,1))

##Can write results to a file. First set your directory from the file tab.
## Change file path in command below to coincide with where you want to store data files
##setwd("C:/Users/..........................")
##write.table(boot.rep.loop$Boot.Estimates,"Hys.eg.repbootvalues.txt")
##test.floop=read.table("Hys.eg.repbootvalues.txt",header=TRUE)
##head(test.floop)