问题标签 [traminer]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2402 浏览

r - “不对称”成对距离矩阵

假设要比较三个序列:a、b 和 c。传统上,生成的 3×3 成对距离矩阵是对称的,表明从 a 到 b 的距离等于从 b 到 a 的距离。

我想知道 TraMineR 是否提供了一些方法来生成不对称的成对距离矩阵。

0 投票
2 回答
374 浏览

r - 我进行了聚类分析 - 如何将包含结果的列添加到我的原始数据中

我从OM使用TraMineR.

我选择了6个集群

我试图向我的数据集添加一个 cloumn :

我收到以下错误消息:

我怎么解决这个问题 ??

0 投票
1 回答
174 浏览

r - 在 R 中一次遍历 10 列

我有一个包含 1000 列的数据框。我试图一次循环超过 10 列,并使用包中的seqdef()函数TraMineR对这些列中的数据进行序列对齐。因此,我想将此函数应用于第一次复飞中的第 1-10 列,以及第二次复飞中的第 11-20 列,一直到 1000。

这是我正在使用的代码。

但是,这只循环前 10 个然后停止。如何在 10 列的块中循环它?

0 投票
2 回答
206 浏览

r - 在观察中识别随时间变化的模式 (R)

我有数以千计的人在几年内每月输入的转移支付数据,无论观察是否在当月收到付款。我想看看理论提出的某些类型的传输接收器是否可以被数据证实。为此,我计划先做一些描述性统计,然后再使用 package TraMineR

然而,首先,我想简单地弄清楚哪个观察适合哪个类别。例如,其中一类是短期经济援助接受者,他们只出现一次。因此,我需要确定所有仅收到三个月(或更短时间)付款的观察结果。另外,这些受援时间是不能中断的,所以如果有人受援两个月,两个月什么都没有,然后再一个月,这已经是一个不同的类别了。这是一个仅针对一年和 30 次观察的小示例:

在此示例中,我的问题是第 13 行,否则我可以简单地使用rowSums,然后选择结果等于或小于 3 的每一行。我可以使用哪个程序来仅识别仅在一个连接期间获得帮助的那些观察?我将如何识别诸如 13 之类的观察结果?

0 投票
1 回答
1404 浏览

r - 遍历列表中的序列对象?

我有一个包含 24 个TraMineR序列对象的列表。现在我想计算每个序列对象的最佳匹配距离(仅在每个对象内)并将其存储在一个新列表中,现在由 24 个 OM 距离对象(距离矩阵)组成。

数据集可以在这里找到。

步骤 (1) 工作正常,但是当我进行到步骤 (2) 时,它告诉我:

这是很自然的,因为sequence_objects不是序列对象,而是序列对象的列表。

如何将该seqsubm函数应用于序列对象列表?

0 投票
1 回答
294 浏览

r - 使用 mapply 在 R/TraMineR 中创建序列对象?

我正在运行下面的代码来生成TraMineR序列对象列表。数据集可以在 [这里][1] 找到。

但是,如果我运行:

我收到的错误信息是:

怎么mapply使用seqdef不创建序列对象列表?

0 投票
2 回答
1618 浏览

r - Problem with big data (?) during computation of sequence distances using TraMineR

I am trying to run an optimal matching analysis using TraMineR but it seems that I am encountering an issue with the size of the dataset. I have a big dataset of European countries which contains employment spells. I have more than 57,000 sequences which are 48 units long and consist of 9 distinct states. In order to get an idea of the analysis, here is the head of sequence object employdat.sts:

In a shorter SPS format, this reads as follows:

After passing this sequence object to the seqdist() function, I get the following error message:

Is this error related to the huge number of distinct, long sequences? I am using a x64-machine with 4GB RAM and I have also tried it on a machine with 8-GB RAM which reproduced the error message. Does someone know a way to tackle this error? Besides, analyses for each single country using the same syntax with an index for the country worked well and produced meaningful results.

0 投票
1 回答
836 浏览

r - 从 SPELL 数据创建序列对象

我正在尝试seqdef使用 SPELL 格式创建一个序列对象。这是我的数据示例:

当我尝试定义序列对象时,会抛出一个奇怪的错误:

但是,如果我通过 间接执行相同的操作seqformat,保留相同的参数,则不会引发错误:

将 TraMineR 1.8-5 与 R 3.0.0 Windows 7 64 位一起使用。这是一个错误还是我做错了什么?提前致谢。

0 投票
2 回答
907 浏览

r - TraMineR: extract events between equal states from SPELL-based sequence data

Context

This question concerns sequence analysis using TraMineR package. The package offers automatic transformation of temporal sequences (statuses in time) to event sequences (changes between statuses in time). One of the recurrent issues in my analyses concerns the options to distinguish events of change between equal statuses.

Question-specific example

Suppose we have sequences of employment statuses, e.g. work, unemployment, inactivity, retirement. The analysis is focused on career transitions, distinguishing between stable and transitional careers. All kinds of transitions are relevant, from work to unemployment, inactivity to work, but also (and most importantly) from work to work!

Question

For TraMineR an event takes place when a status in a sequence is changed. For instance, the respondent had 3 years of work and then 1 in unemployment: Work-Work-Work-Unemployment (assuming annual interval). This is the STS format, representing statuses in time. However, in SPELL format we have additional information, e.g:

From the table above we can clearly see that two work-to-work transition events have occurred (otherwise there would be just one line: Work from 1 to 3). The question is whether there is any convenient way to extract an event object from the sequence object based on these data.

Data

My data contains work-related respondent statuses in the SPELL format (status, begin & end time), like this:

What I have tried

As per this post I must convert SPELL to STS first, then define sequences:

The information I require is already lost at this step, but until the bug (see link) is resolved there is no other way. It still shows what I want to achieve:

My results

Here, the first four event sequences are identical. If you look at the SPELL data (to.SO), it is apparent that there are multiple work-to-work transitions involved for respondents with id 11 and 13. In my other article I solve this by ascribing different statuses to job-1, job-2 and so forth. It is a less desirable strategy however, since it (1) explodes the number of statuses making subsequent dissimilarity analysis difficult and (2) is not theoretically important which job in career it is, the status of employment alone should cover it.

Thanks

I imagine this goes beyond the existing package capabilities, but perhaps I am missing something. Thanks in advance for reading this long post (at least) and for having any suggestions.

0 投票
2 回答
312 浏览

r - 根据 2 个 pdf 页面上的可变条件打印绘图

我正在尝试打印一个图,这取决于一个有 12 个术语的变量。该图是使用 OM 距离对序列进行聚类分类的结果。

我在一个 pdf 页面上打印此图:

但是打印很小......所以我尝试在 2 页上打印,如下所示:

但它不起作用......你知道我如何要求 R 将术语的变量分成两组,以便每 pdf 页打印 6 个图形吗?