Pretty_technical_conundrum

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pretty_technical_conundrum

Gerónimo Maldonado
Hi all: 
Quick and dirty question, did SPSS is able to calculate Mean Squared Displacement?. I have a behavior experiment in which I want to compare the movement (specifically crawling) of a bunch of larvae between different conditions. 

P.S. MatLab has an awfully steep learning curve. I heard that R can tackle my problem. Is there an extension that can help me?

Grateful of any help sent my way!

-Gerónimo-
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Pretty_technical_conundrum

Jon Peck
MSD is just the average squared distance(displacement) from initial position of a set of n particles as a function of time.
Here's an example of computing this.  The first AGGREGATE just attaches the initial position (x) to each case, assuming that the data are ordered by time within particle.  This code assumes 4 time periods and 5 particles, so change as needed.  The second one computes the average displacement for each time period into a new dataset named msd.

If you have a particle id, use that instead of the compute particleid command below.

* Encoding: UTF-8.
data list list /time(f5.0), x(f8.2).
begin data
1 21
2 22
3 23
4 24
1 10
2 20
3 30
4 40
1 12
2 12
3 13
4 15 
1 0
2 0
3 0
4 0
1 50
2 100
3 200
4 300
end data.
dataset name particles.
compute particleid = mod(trunc(($CASENUM-1)/4), 5)

aggregate
  /outfile=* mode=addvariables
  /break=particleid
  /first=first(x).
compute distance = (x - first)**2.
dataset declare msd.
aggregate /outfile=msd
/break=time
/msd = mean(distance).

For these data, the result is
time  msd
1 .00
2 520.20
3 4,581.00
4 12,683.60


On Thu, Mar 28, 2019 at 10:35 AM Gerónimo Maldonado-Martínez <[hidden email]> wrote:
Hi all: 
Quick and dirty question, did SPSS is able to calculate Mean Squared Displacement?. I have a behavior experiment in which I want to compare the movement (specifically crawling) of a bunch of larvae between different conditions. 

P.S. MatLab has an awfully steep learning curve. I heard that R can tackle my problem. Is there an extension that can help me?

Grateful of any help sent my way!

-Gerónimo-
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD