楼主: Lisrelchen
1356 1

[问答] SPSS: Recoding time to make sampling rate explicit [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50288 个
通用积分
83.6306
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2014-5-6 01:33:04 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
        I have data from an experiment that is sampling responses between 59 to 60 hz. There is no way to predict the drop-down in sampling rate throughout the experiment which runs for 18 minutes.

Each of the sampled responses are numbered from 1 to N (for total number of rows) showing relative passage of time, stored in variable 'frame'. I also have a unix time stamp marking absolute time stored in 'unixtime'. But unixtime is reported in whole integers & not in fractional units. For example:

1376925380 may be repeated 59 times;
1376925381 may be repeated 60 times in the data file.
I would like to create a new variable that tracks each consecutive frame (or sampled response) from 1 to 60 or from 1 to 59, as the case may be, for each given unixtime stamp in SPSS. See the desired re-arrangement below. Any help w/ appropriate SPSS-syntax is appreciated!

unixtime    newframe
1376925380  1
1376925380  2
1376925380  3
1376925380  4
1376925380  5   
1376925380  6
....
1376925380  58
1376925380  59
1376925381  1
1376925381  2
1376925381  3
1376925381  4
....        ....
1376925381  60
1376925382  1
1376925382  2
....

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Sampling explicit Coding make Rate absolute relative reported between example

沙发
Lisrelchen 发表于 2014-5-6 01:33:57
*fake data.
set seed 10.
input program.
loop #i =  1 to 100.
  loop #j = 1 to TRUNC(RV.UNIFORM(59,61)).
    compute unixtime = 1376925379 + #i.
    end case.
  end loop.
end loop.
end file.
end input program.

*Using lag to calculate newframe variable.
DO IF ($casenum = 1) OR (unixtime <> lag(unixtime)).
  compute newframe = 1.
ELSE.
  compute newframe = lag(newframe) + 1.
END IF.
exe.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 00:31