Recoding Workaround for JASP
261 views
Apr 10, 2025
Easily recode variables (columns) in the free statistics program JASP; and quickly duplicate a column (variable). (Recoding is changing the values, e.g. so you can combine categories to do a t-test.) #jasp #statistics #freesoftware #opensource
View Video Transcript
0:00
hi uh my name is Dave and I'm here to
0:03
talk about uh how to recode or change
0:07
some of the values of a variable in JASP
0:10
a little more easily than you normally
0:12
could because JASP JASP has some
0:15
mechanisms for doing this that are
0:17
rather difficult now uh I'm going to use
0:20
as my example this general social survey
0:23
variable pairorn which means where were
0:26
your parents born and it has eight
0:28
possible values which means it's really
0:31
hard to use it in in an independent
0:33
samples t test or you can only have two
0:35
values so that we can use this to decide
0:38
whether somebody is a first generation
0:41
American so they're either an immigrant
0:44
who uh has gotten citizenship or they're
0:47
just an immigrant who does not have
0:49
citizenship and that would include
0:50
people who are undocumented so there's
0:53
eight possibilities here and we want to
0:55
narrow it down to two so that we can do
0:58
independent samples t tests because you
1:00
can't do a t test against eight
1:02
different groups it doesn't work like
1:04
that you can only compare two groups to
1:06
each other and the thing about uh JASP
1:09
is in SPSS you could for example let's
1:14
uh just put anything here working hours
1:17
is a nice continuous variable and then
1:19
we'll go to this variable and you see it
1:21
says maximum number of levels is two but
1:24
the variable has nine levels you have to
1:26
have just two possible values in
1:29
whatever variable you're using to group
1:31
so what we're going to do is we're going
1:34
to create a new parents born variable it
1:37
will have just two values one of them
1:40
let's double click here so you can see
1:41
what we've got one of them will be
1:44
either parent born in the US so that's 0
1:48
1 2 3 and five so any place where one
1:54
parent is born in the US and then the
1:56
other group will be neither parent born
1:59
in the US which will be
2:00
four 6 7 and 8 so how do we do that well
2:05
first of all
2:07
uh let's close this little window here
2:10
first of all let's try copying and
2:15
pasting there's all sorts of different
2:17
ways to do that let's see
2:21
insert column
2:25
after let's see if copying and pasting
2:27
works well what do you know copying and
2:30
pasting worked so now we've got pairorn
2:33
and pairorn 2 now and let's see did it
2:36
copy and paste all the values are copied
2:40
well that's great for recoding so let's
2:42
go to this one over
2:44
here okay so we take it and we copy it
2:48
i'm right clicking here by the way Mac
2:50
people you can rightclick uh by holding
2:52
down the control key as sorry the
2:54
command key which is the clover leaf as
2:57
you click on your uh laptop keyboard or
3:00
you can get yourself a two-b button
3:01
mouse like I did i do have a Mac it has
3:04
a two-b button mouse it makes stuff like
3:05
this very easy normally I'd use the
3:07
keyboard for stuff like this but I can't
3:09
show you the keyboard here so let's go
3:13
into Excel we paste i just did controlV
3:16
all right
3:18
now for whatever reason it's showing us
3:21
the value labels i guess that we just
3:23
have to live with that so now we can
3:25
change it so we
3:29
do
3:30
[Music]
3:31
both let's see we do find and
3:38
replace both born in the US we replace
3:43
with we're going to use one for both
3:46
born in the US one for either parent
3:50
born in the US or
3:51
both so replace
3:54
all i don't see a point in making you
3:57
watch me do each one one at a time at
3:59
real time so I'm just going to do this
4:01
at four times speed all right so let's
4:04
take neither born in the
4:07
US and we'll make that two
4:12
now just rushing through at eight times
4:14
speed uh we're going to make this
4:17
missing so I'll just put in a dot here
4:20
we go at eight times speed again no need
4:22
to watch replace all those keep going
4:25
down and find any other possibilities if
4:27
there are
4:31
any there's one
4:35
so mother don't know father no so that's
4:39
also a two
4:42
that person is probably an
4:47
immigrant and this is good for simple
4:53
uh very
4:54
simple recoding because you can't do it
4:57
based on what another column says unless
5:00
you go unless you copy in more
5:03
columns let's
5:09
see all right father don't know father
5:13
yes is
5:19
yes all right so there we go so now we
5:22
go to the bottom i'm going to hold down
5:25
on a Mac shift and croleaf
5:28
keys copy this whole mess go back here
5:32
and paste it
5:34
in and now it's all there so now I
5:38
change these
5:40
labels to one is uh let's see there's no
5:44
zero
5:47
so don't really know how to get rid of
5:49
this one
5:53
becomes either parent born in US and two
5:58
becomes either parent born in
6:02
[Music]
6:04
US all right so now in theory this is
6:08
all good it is showing up as nominal
6:11
which is good so now let's do a uh let's
6:14
do a comparison to make sure we got this
6:16
right so we're going to go to
6:17
contingency tables which means cross
6:20
tabs and we go to pairorn
6:23
2 we'll make that the
6:26
columns and pairorn the rows and let's
6:30
look at what we have here
6:33
so both parents born in the US mother
6:36
yes father yes mother
6:38
yes these are all either parent born in
6:41
the US along with father yes over here
6:44
and then uh what do we have mother no
6:47
father don't know mother don't know
6:49
father no and neither born in the US are
6:52
all in the correct places so we do this
6:54
cross tab here or as JASP calls it
6:56
contingency table to make sure that we
7:00
got our recoding right and didn't lose
7:02
data so now if we wanted to do that t
7:05
test
7:07
uh and see if uh ours worked is
7:10
different for these two
7:13
groups we can just go in here and
7:16
there's your t test and if we really
7:18
want to be clever uh anytime that you do
7:20
a t test you want to show the
7:24
descriptives you want to show what's
7:26
going
7:28
on because you want to see what the
7:31
actual averages are the standard
7:33
deviations and the number of people here
7:36
so either parent born in the US is
7:39
1772 people neither parent born is 519
7:43
and as you can see there is no real
7:46
average difference in how many hours
7:48
they work so uh that's basically a quick
7:53
workaround you can in theory the way
7:56
that they want you to do it is by using
7:58
the synchronization tool i have not
8:00
found this to work and when it I have
8:02
made it work uh then it lost all the
8:06
value labels so there's some funky stuff
8:08
going on there and I know that they're
8:10
working on the code and trying to make
8:11
it better jasp is great because the
8:14
developers really do care but in the
8:16
meantime this is a quick e workaround
8:18
and it might really be easier