This post was updated on .
CONTENTS DELETED
The author has deleted this message.

This post was updated on .
CONTENTS DELETED
The author has deleted this message.

Administrator

In reply to this post by JMA1234
Please provide a small example of what the data file looks like now, and what you want it to look like after.

Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an email, please use the address shown above. 
This post was updated on .
CONTENTS DELETED
The author has deleted this message.

In reply to this post by Bruce Weaver
I have to second Bruce's request because it
hard to understand what
your data actually is. You say you have
long format data which
means you have 7 cases per ID but "time vs
melatonin concentration"
make no sense. Consider the
following data layout for one ID:
Now this is all I can infer and I don't have
much confidence that it
is completely correct (sorry, my ESP doesn't
seem to be working today).
I assume that there is a positive linear
relationship between mel_conc
and time which suggests that you can get a
simple regression equation
to predict the value of mel_conc for any
value of time (it is unclear
when you have actual times or ordered time
points like above which
might be interpreted as the original time
converted into ranks).
But I have to ask, why do you want to do
linear interpolation?
My first inclination is that you have a
melatonin concentration
for an ID but not the time, as
follows:
Mel_conc=269 falls between the values of 241
and 280 and you
might want the time that corresponds to the
missing time (if the
time is original time units and not
ranks). But you don't say
anything about missing data which implies you
might be interested
in some time value between the times you (say,
3.5). Again,
a simple regression equation would allow you
to get this value
(run regression using split files using ID as
the splitting variable)
but I still don't understand whether this is
what you wnat to do
or why you might want to do it.
Mike Palij
New York University
On Saturday, May 27, 2017 1:28 PM, Bruce
Weaver wrote: > Please provide a small example of what
the data file looks like now, and what
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD
> you want it to look like after. > > AK1234 wrote >> I have 7 data points (time vs. melatonin concentration) for each ID number >> (in long format). I need to linear interpolate the time at two different >> set melatonin concentrations and then loop this through all ID numbers. If >> anyone has any suggestions on how I can do this, that would be greatly >> appreciated. 
Administrator

In reply to this post by JMA1234
I don't see a variable called concentration. Do you mean you want to compute the mean of the time values for samples 3 and 4 for each subject?
By the way, Nabble shows that your posts have "NOT been accepted by the mailing list yet." (Because of that, I suspect Mike had not seen your reply when he made his post.) Have you joined the actual mailing list?

Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an email, please use the address shown above. 
In reply to this post by JMA1234
Note: the OP's posts are not making it to the
mailing list
and I just checked Nabble to see the thread
and I saw
that the OP has responded and uses a data
layout much
like the one I use below.
After looking at you data table I think the
question you
are asking is "what are the predicted times
for melatonin
concentrations of 3 (units) and 4 (units)"
which suggests
that you want to regression time in original
units on
melatonin concentration [time = b_0 +
b_1(mel_conc)].
Again, I think you may be able to this by
using split files
and calculating the simple regression for each
ID which
you can use to predict/calculate the time for
mel_conc = 3 and 4.
The split files makes getting the regression
equation simple
but then using them to calculate the melatonin
concentration
is going to either require additional
programming or hand
calculation.
A couple of notes:
(1) People who are more familiar with
multilevel analysis
can answer whether such an analysis would be
appropriate
here in order to determine the regression of
time on
melatonin is the same for all IDs or different
across IDs.
If the regressions do not vary significant,
then a single
equation could be used for all IDs. If
there is significant
difference among the equations (e.g. different
slopes),
then you'll have to calculate the time on a ID
level.
(2) A quick look at your data raises the
question whether
melatonin actually has a linear relationship
with time (or
vice versa). Some IDs may have a
quadratic relationship
or more complex pattern (theoretically, I
believe, up to
6th order polynomial).
I'd like to see other people's
suggestions.
Mike Palij
New York University
 Original Message 
From: [hidden email]
To: [hidden email] ; [hidden email]
Cc: [hidden email]
Sent: Saturday, May 27, 2017 2:02 PM
Subject: Re: SPSS Syntax  Linear Interpolation I have to second Bruce's request because it
hard to understand what
your data actually is. You say you have
long format data which
means you have 7 cases per ID but "time vs
melatonin concentration"
make no sense. Consider the
following data layout for one ID:
Now this is all I can infer and I don't have
much confidence that it
is completely correct (sorry, my ESP doesn't
seem to be working today).
I assume that there is a positive linear
relationship between mel_conc
and time which suggests that you can get a
simple regression equation
to predict the value of mel_conc for any
value of time (it is unclear
when you have actual times or ordered time
points like above which
might be interpreted as the original time
converted into ranks).
But I have to ask, why do you want to do
linear interpolation?
My first inclination is that you have a
melatonin concentration
for an ID but not the time, as
follows:
Mel_conc=269 falls between the values of 241
and 280 and you
might want the time that corresponds to the
missing time (if the
time is original time units and not
ranks). But you don't say
anything about missing data which implies you
might be interested
in some time value between the times you (say,
3.5). Again,
a simple regression equation would allow you
to get this value
(run regression using split files using ID as
the splitting variable)
but I still don't understand whether this is
what you wnat to do
or why you might want to do it.
Mike Palij
New York University
On Saturday, May 27, 2017 1:28 PM, Bruce
Weaver wrote: > Please provide a small example of what
the data file looks like now, and what
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD
> you want it to look like after. > > AK1234 wrote >> I have 7 data points (time vs. melatonin concentration) for each ID number >> (in long format). I need to linear interpolate the time at two different >> set melatonin concentrations and then loop this through all ID numbers. If >> anyone has any suggestions on how I can do this, that would be greatly >> appreciated. 
This post was updated on .
In reply to this post by Bruce Weaver
CONTENTS DELETED
The author has deleted this message.

In looking at the two example cases, the relationship doesn't look too linear. That said, a linear assumption may be preferred. If so, that preference leads down one syntax path. Another syntax path is to interpolate the between points enclosing an interval that includes 3 or includes 4. These two different paths probably, almost certainly will give different time codes. Which way do you want to go?
Gene Maguin Original Message From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of AK1234 Sent: Saturday, May 27, 2017 2:25 PM To: [hidden email] Subject: Re: SPSS Syntax  Linear Interpolation Hello Bruce, I should have clarified. MelaAvg corresponds with the melatonin concentration. I would like to linear interpolate the time at which a melatonin concentration of 3 and a melatonin of concentration of 4 are hit/surpassed. I have received confirmation that I was subscribed to the mailing list. I am unsure as to why it continues to say that my posts have not be accepted. I will look into this. Thank you for pointing that out.  View this message in context: http://spssxdiscussion.1045642.n5.nabble.com/SPSSSyntaxLinearInterpolationtp5734282p5734290.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSXL, send a message to [hidden email] (not to SPSSXL), with no body text except the command. To leave the list, send the command SIGNOFF SPSSXL For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSXL, send a message to [hidden email] (not to SPSSXL), with no body text except the command. To leave the list, send the command SIGNOFF SPSSXL For a list of commands to manage subscriptions, send the command INFO REFCARD 
This post was updated on .
In reply to this post by JMA1234
CONTENTS DELETED
The author has deleted this message.

In reply to this post by JMA1234
CASESTOVARS is most likely part of the process.
After doing CASESTOVARS for purposes of visualization before doing any analysis, I suggest you plot a line per person with concentration on the Y axis and "time" on the X axis. You may want to break the data into sets of cases for the plots. Do the shapes appear at least vaguely similar? How do loess fits look? Is there reason to believe the shapes should be similar? Is there reason to believe the shape is linear? Are there subgroups of cases that you wish to compare/contrast their fit? For your two example cases, what value do you want the syntax to create?
Art Kendall
Social Research Consultants 
Administrator

In reply to this post by JMA1234
JMA, no matter how urgent this may be for you, asking the same question repeatedly is not going to make anyone respond more quickly! Bear in mind that it is the weekend, and a long weekend (Memorial Day) for our American friends. So some potential respondents may not even see your question until Tuesday.
Note too that using different subject lines when asking the same question clutters up the archive unnecessarily.

Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an email, please use the address shown above. 
This post was updated on .
In reply to this post by Art Kendall
CONTENTS DELETED
The author has deleted this message.

I think I would be confused a bit, even if I had read all the posts in sequence from Nabble.
So, I confess that I'm not sure of the ultimate end.
But if I wanted the regression for each person with 7 (always, exactly) points, 1 to 7,
I would have all the 7 lines of data in one record and construct the simple linear contrast by hand, for (3 to 3). The covariance for the contrast term can be written like
3*(Mtime7 Mtime1) + 2*(Mtime6Mtime2) + (Mtime5Mtime3) and the sum of squares of the contrasts is 28. Compute the mean and sum of squares of
what I've labeled Mtime_ and you have all the values for the regression coefficient and the intercept.
 Rich Ulrich
From: SPSSX(r) Discussion <[hidden email]> on behalf of JMA1234 <[hidden email]>
Sent: Sunday, May 28, 2017 9:22:53 AM To: [hidden email] Subject: Re: SPSS Syntax  Equation of Line I would like to produce an equation for a line for each persons data based on
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD
their points. Essentially I would like to create a variable indicating the participant's slope of their line as well as another variable indicating the yintercept of that line.  View this message in context: http://spssxdiscussion.1045642.n5.nabble.com/SPSSSyntaxLinearInterpolationtp5734282p5734297.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSXL, send a message to [hidden email] (not to SPSSXL), with no body text except the command. To leave the list, send the command SIGNOFF SPSSXL For a list of commands to manage subscriptions, send the command INFO REFCARD 
AK, One method, the one that you indicated is customary practice, works like this.
I’ll presume the file is appropriately sorted. Then, casestovars by id to get a wide format file (drop sample).
Per the example data you supplied. Id mel.1 mel.2 mel.3 mel.4 mel.5 mel.6 mel.7 time.1 … time.7 1 2.0 2.5 3.5 7.0 9.0 10.0 17.0 23:30 …. 26:30 2 1.0 3.0 7.0 8.0 13.0 17.0 30.0 18:00 … 21:00 Vector mel=mel.1 to mel.7/time=time.1 to time.7. Loop #i=1 to 6. *look for the lower and upper bounds on the interval around 3.0. + do if (mel(7) lt 3.0). + break. + else if (mel(#i) eq 3.0). + compute m3.0time=time(#i). + else if (mel(#i+1) eq 3.0). + compute m3.0time=time(#i+1). + else if (mel(#i) lt 3.0 and mel(#i+1) gt 3). + compute m3.0time=time(#i)+((time(#i+1)time(#i))*((3.0mel(#i))/ (mel(#i+1)mel(#i)))). + end if. end loop. format m3.0time(time5). execute. You can modify the code to look for the mel=4.0 time point. You’d also mentioned looking for the within person slope and intercept. I agree with Mike’s advice to use a split files command. Depending how many cases (not
records) you have, you may find it useful to use the OMSOMSEND commands. Gene Maguin From: SPSSX(r) Discussion [mailto:[hidden email]]
On Behalf Of Rich Ulrich I think I would be confused a bit, even if I had read all the posts in sequence from Nabble.
So, I confess that I'm not sure of the ultimate end.
But if I wanted the regression for each person with 7 (always, exactly) points, 1 to 7,
I would have all the 7 lines of data in one record and construct the simple linear contrast by hand, for (3 to 3). The covariance for the contrast term can be written like
3*(Mtime7 Mtime1) + 2*(Mtime6Mtime2) + (Mtime5Mtime3)
and the sum of squares of the contrasts is 28. Compute the mean and sum of squares of
what I've labeled Mtime_ and you have all the values for the regression coefficient and the intercept.  Rich Ulrich From: SPSSX(r) Discussion <[hidden email]>
on behalf of JMA1234 <[hidden email]> I would like to produce an equation for a line for each persons data based on ===================== To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the command. To leave the list, send the command SIGNOFF SPSSXL For a list of commands to manage subscriptions, send the command INFO REFCARD

Administrator

In reply to this post by JMA1234
Dear OP (JMA1234).
Please STOP deleting the contents of your questions. This entire thread has bcome chaotic mess due to what we would term unacceptable netiquette . Get with the program or leave. As far as I can tell you merely need to do SPIT FILE BY ID and run a bloody regression!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.  "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" 
Free forum by Nabble  Edit this page 