Count longest unbroken run of heads

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

Count longest unbroken run of heads

retiefa@gmail.com
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

Maguin, Eugene
How have you tried to solve your problem--other than by posting a data file and asking others to solve your problem?
Gene Maguin

Bruce, maybe incorrectly, but I think of you as the administrator of the nabble spss list. If you are that person, I'm curious, does the entity behind nabble do a deep scrub of posted files for viruses and related things? If I were to download this file, it's true that my antivirus program would screen the file but it seems like files ought to be screened as part of the upload process.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Tuesday, June 02, 2015 9:27 AM
To: [hidden email]
Subject: Count longest unbroken run of heads

I have a datafile with the combined results of coin flips for a company. Each staff member spent the whole day flipping coins, recording the result of each flip. The attached text file shows the combined results of all the coin flips.

Find out for each employee what their longest unbroken run of heads was.

Coin_flippling.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/n5729707/Coin_flippling.sav>  



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Count-longest-unbroken-run-of-heads-tp5729707.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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: Count longest unbroken run of heads

Jon K Peck
Is the list really going to do someone's homework for them?


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        "Maguin, Eugene" <[hidden email]>
To:        [hidden email]
Date:        06/02/2015 07:47 AM
Subject:        Re: [SPSSX-L] Count longest unbroken run of heads
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




How have you tried to solve your problem--other than by posting a data file and asking others to solve your problem?
Gene Maguin

Bruce, maybe incorrectly, but I think of you as the administrator of the nabble spss list. If you are that person, I'm curious, does the entity behind nabble do a deep scrub of posted files for viruses and related things? If I were to download this file, it's true that my antivirus program would screen the file but it seems like files ought to be screened as part of the upload process.


-----Original Message-----
From: SPSSX(r) Discussion [
[hidden email]] On Behalf Of [hidden email]
Sent: Tuesday, June 02, 2015 9:27 AM
To: [hidden email]
Subject: Count longest unbroken run of heads

I have a datafile with the combined results of coin flips for a company. Each staff member spent the whole day flipping coins, recording the result of each flip. The attached text file shows the combined results of all the coin flips.

Find out for each employee what their longest unbroken run of heads was.

Coin_flippling.sav
<
http://spssx-discussion.1045642.n5.nabble.com/file/n5729707/Coin_flippling.sav>  



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Count-longest-unbroken-run-of-heads-tp5729707.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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


===================== 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: Count longest unbroken run of heads

retiefa@gmail.com
This post was updated on .
In reply to this post by Maguin, Eugene
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

retiefa@gmail.com
In reply to this post by Maguin, Eugene
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

Mario Giesel
* How about:.

SORT CASES BY Name Time.
DO IF ($CASENUM EQ 1).
- COMPUTE headrun = (Heads_Tails EQ 1).
ELSE IF (Name NE LAG(Name)).
- COMPUTE headrun = (Heads_Tails EQ 1).
ELSE.
- COMPUTE headrun = (LAG(headrun) + (Heads_Tails EQ 1)) * (Heads_Tails EQ 1).
END IF.
EXECUTE.

AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=Name
  /headrun_max 'Maximum number of head runs'=MAX(headrun).

* GL, Mario.



"[hidden email]" <[hidden email]> schrieb am 15:57 Dienstag, 2.Juni 2015:


I ran tables which I then formatted in Excel, but I am looking for an
automated way to do this. Not sure if there is one?



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Count-longest-unbroken-run-of-heads-tp5729707p5729710.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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


===================== 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
Mario Giesel
Munich, Germany
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

retiefa@gmail.com
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

David Marso
Administrator
In reply to this post by retiefa@gmail.com
retiefa@gmail.com wrote
Hi Eugene

Yes, of course I have. I only posted my query because I cannot seem to find
an answer to my problem.

Kind regards,
Anna

On Tue, Jun 2, 2015 at 3:50 PM, Maguin, Eugene [via SPSSX Discussion] <
[hidden email]> wrote:

> How have you tried to solve your problem--other than by posting a data
> file and asking others to solve your problem?
> Gene Maguin
>
> Bruce, maybe incorrectly, but I think of you as the administrator of the
> nabble spss list. If you are that person, I'm curious, does the entity
> behind nabble do a deep scrub of posted files for viruses and related
> things? If I were to download this file, it's true that my antivirus
> program would screen the file but it seems like files ought to be screened
> as part of the upload process.
>
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5729708&i=0>] On Behalf Of [hidden
> email] <http:///user/SendEmail.jtp?type=node&node=5729708&i=1>
> Sent: Tuesday, June 02, 2015 9:27 AM
> To: [hidden email] <http:///user/SendEmail.jtp?type=node&node=5729708&i=2>
> Subject: Count longest unbroken run of heads
>
> I have a datafile with the combined results of coin flips for a company.
> Each staff member spent the whole day flipping coins, recording the result
> of each flip. The attached text file shows the combined results of all the
> coin flips.
>
> Find out for each employee what their longest unbroken run of heads was.
>
> Coin_flippling.sav
> <
> http://spssx-discussion.1045642.n5.nabble.com/file/n5729707/Coin_flippling.sav>
>
>
>
>
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/Count-longest-unbroken-run-of-heads-tp5729707.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5729708&i=3> (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
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5729708&i=4>
> (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
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
Your problem is very easily solved using the LAG function (COMPUTE)  and AGGREGATE command.
Look it up and try it.  If you still have trouble then you will get added help, but you should at least try to solve it yourself.
This appears to  be a very poorly disguised homework assignment.
What company has their employees sitting around flipping coins all day?
Nice try!
---
>
> http://spssx-discussion.1045642.n5.nabble.com/Count-longest-unbroken-run-of-heads-tp5729707p5729708.html
>  To unsubscribe from Count longest unbroken run of heads, click here
> <http://spssx-discussion.1045642.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729707&code=cmV0aWVmYUBnbWFpbC5jb218NTcyOTcwN3wtODk1MjI1NjEz>
> .
> NAML
> <http://spssx-discussion.1045642.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

Bruce Weaver
Administrator
In reply to this post by Maguin, Eugene
Good morning Gene.  David Marso and I are "administrators" of the Nabble archive for SPSSX-L, which can be viewed here:  http://spssx-discussion.1045642.n5.nabble.com/.  This means that we can delete posts, ban users etc, but only in the Nabble archive--we have no such power over the UGA-administered mailing list (https://listserv.uga.edu/cgi-bin/wa?A0=SPSSX-L).

Re your question about attachments, I don't know if Nabble does any screening of uploaded files, so I would exercise caution with files uploaded by folks I don't know.

Cheers,
Bruce


Maguin, Eugene wrote
How have you tried to solve your problem--other than by posting a data file and asking others to solve your problem?
Gene Maguin

Bruce, maybe incorrectly, but I think of you as the administrator of the nabble spss list. If you are that person, I'm curious, does the entity behind nabble do a deep scrub of posted files for viruses and related things? If I were to download this file, it's true that my antivirus program would screen the file but it seems like files ought to be screened as part of the upload process.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Tuesday, June 02, 2015 9:27 AM
To: [hidden email]
Subject: Count longest unbroken run of heads

I have a datafile with the combined results of coin flips for a company. Each staff member spent the whole day flipping coins, recording the result of each flip. The attached text file shows the combined results of all the coin flips.

Find out for each employee what their longest unbroken run of heads was.

Coin_flippling.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/n5729707/Coin_flippling.sav> 



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Count-longest-unbroken-run-of-heads-tp5729707.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

Andreas Sprenger
In reply to this post by Mario Giesel
Hi,

I was a bit surprised about the disconcertment on the question. I had similar problems previously and I used Matlab to solve the problem. Therefore I found the post absolutely reasonable and I'm quite grateful about the solution in SPSS.

Greetings

Andreas
Reply | Threaded
Open this post in threaded view
|

Re: Count longest unbroken run of heads

David Marso
Administrator
It was an obvious

'I haven't bothered to get off my a$$ and try anything myself.
Here's my data.
Do my homework' sort of question...

We don't do that around here.
OTOH, here is a concise bit of code.

COMPUTE run=SUM(1,(Name EQ Lag(Name)) * (LAG(Heads_Tails) EQ 1)* LAG(run))*(Heads_Tails EQ 1).            
AGGREGATE OUTFILE * / BREAK v2 name / MaxRunH=MAX(Run).

Good luck explaining that to the instructor.



Andreas Sprenger wrote
Hi,

I was a bit surprised about the disconcertment on the question. I had similar problems previously and I used Matlab to solve the problem. Therefore I found the post absolutely reasonable and I'm quite grateful about the solution in SPSS.

Greetings

Andreas
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?"