Skip to content

Commit c2c3652

Browse files
authored
Merge branch 'main' into develop
2 parents 25d7c20 + c0c965a commit c2c3652

27 files changed

+970
-119
lines changed

.github/workflows/prchecks.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,29 @@ name: Binary checks
88
jobs:
99

1010
build:
11-
name: Build for ${{ matrix.config.os }}
11+
name: Build for ${{ matrix.config.os }} (${{ matrix.config.r }})
1212
runs-on: ${{ matrix.config.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
config:
17-
- {os: macOS-latest, r: 'release', artifact_name: '*.tar.gz', asset_name: macOS}
18-
- {os: windows-latest, r: 'release', artifact_name: '*.zip', asset_name: winOS}
19-
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", artifact_name: '*.tar.gz', asset_name: linuxOS}
17+
- {os: macOS-latest, r: 'release'}
18+
- {os: windows-latest, r: 'release'}
19+
- {os: ubuntu-latest, r: 'release'}
20+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2021

2122
env:
2223
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
23-
RSPM: ${{ matrix.config.rspm }}
2424
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2525

2626
steps:
27-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2828

2929
- uses: r-lib/actions/setup-r@v2
3030
with:
3131
r-version: ${{ matrix.config.r }}
32+
http-user-agent: ${{ matrix.config.http-user-agent }}
33+
use-public-rspm: true
3234

3335
- uses: r-lib/actions/setup-pandoc@v2
3436

.github/workflows/pushrelease.yml

+34-58
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,22 @@ name: Check and release
88
jobs:
99

1010
build:
11-
name: Build for ${{ matrix.config.os }}
11+
name: Build for ${{ matrix.config.os }} (${{ matrix.config.r }})
1212
runs-on: ${{ matrix.config.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
config:
1717
- {os: macOS-latest, r: 'release', artifact_name: '*.tar.gz', asset_name: macOS}
1818
- {os: windows-latest, r: 'release', artifact_name: '*.zip', asset_name: winOS}
19-
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", artifact_name: '*.tar.gz', asset_name: linuxOS}
19+
- {os: ubuntu-latest, r: 'release', artifact_name: '*.tar.gz', asset_name: linuxOS}
2020

2121
env:
2222
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
23-
RSPM: ${{ matrix.config.rspm }}
2423
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2524

2625
steps:
27-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2827

2928
- uses: r-lib/actions/setup-r@v2
3029
with:
@@ -63,7 +62,8 @@ jobs:
6362
shell: Rscript {0}
6463

6564
- name: Save binary artifact
66-
uses: actions/upload-artifact@v1
65+
if: success()
66+
uses: actions/upload-artifact@v4
6767
with:
6868
name: ${{ matrix.config.asset_name }}
6969
path: build/
@@ -76,74 +76,50 @@ jobs:
7676
contents: write
7777
steps:
7878
- name: Checkout one
79-
uses: actions/checkout@master
79+
uses: actions/checkout@v4
8080
with:
8181
fetch-depth: '0'
82+
8283
- name: Bump version and push tag
8384
id: newtag
84-
uses: anothrNick/github-tag-action@1.39.0
85+
uses: anothrNick/github-tag-action@v1
8586
env:
8687
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8788
WITH_V: true
8889
DEFAULT_BUMP: patch
8990
RELEASE_BRANCHES: main
91+
9092
- name: Checkout two
91-
uses: actions/checkout@v2
92-
- name: Create Release
93-
id: create_release
94-
uses: actions/create-release@v1
95-
env:
96-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97-
with:
98-
tag_name: ${{ steps.newtag.outputs.tag }}
99-
release_name: Release ${{ steps.newtag.outputs.tag }}
100-
draft: false
101-
prerelease: false
102-
93+
uses: actions/checkout@v4
94+
10395
- name: Download binaries
104-
uses: actions/download-artifact@v2
96+
uses: actions/download-artifact@v4
10597

10698
- name: Display structure of downloaded files
10799
run: ls -R
108100

109-
- name: Rename Mac release
110-
run: mv ./macOS/*.tgz RSiena.tgz
111-
112-
- name: Upload Mac binary
113-
id: upload-mac
114-
uses: actions/[email protected]
115-
env:
116-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117-
with:
118-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
119-
asset_path: RSiena.tgz
120-
asset_name: RSiena.tgz
121-
asset_content_type: application/zip
122-
123-
- name: Rename Linux release
124-
run: mv ./linuxOS/*.tar.gz RSiena.tar.gz
101+
- name: Rename binaries release
102+
shell: bash
103+
run: |
104+
mv ./macOS/*.tgz RSiena.tgz
105+
mv ./linuxOS/*.tar.gz RSiena.tar.gz
106+
mv ./winOS/*.zip RSiena.zip
107+
echo "Renamed files"
108+
ls -R
125109
126-
- name: Upload Linux binary
127-
id: upload-lin
128-
uses: actions/[email protected]
129-
env:
130-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
- name: Create Release and Upload Assets
111+
id: create_release
112+
uses: softprops/action-gh-release@v2
131113
with:
132-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
133-
asset_path: RSiena.tar.gz
134-
asset_name: RSiena.tar.gz
135-
asset_content_type: application/zip
136-
137-
- name: Rename Windows release
138-
run: mv ./winOS/*.zip RSiena.zip
139-
140-
- name: Upload Windows binary
141-
id: upload-win
142-
uses: actions/[email protected]
114+
tag_name: ${{ steps.newtag.outputs.tag }}
115+
name: Release ${{ steps.newtag.outputs.tag }}
116+
draft: false
117+
prerelease: false
118+
fail_on_unmatched_files: true
119+
# Specify the assets you want to upload
120+
files: |
121+
Rsiena.tgz
122+
Rsiena.tar.gz
123+
Rsiena.zip
143124
env:
144-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145-
with:
146-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
147-
asset_path: RSiena.zip
148-
asset_name: RSiena.zip
149-
asset_content_type: application/zip
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

NEWS.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<<<<<<< Updated upstream
2-
=======
31
# RSiena 1.4.21
42

53
2024-12-12
@@ -43,7 +41,6 @@
4341
last wave, was included as member data of `BehaviorLongitudinalData`
4442
together with the corresponding member functions.
4543

46-
>>>>>>> Stashed changes
4744
# RSiena 1.4.19
4845

4946
2024-09-03
@@ -778,4 +775,4 @@
778775
###
779776
* See file `ONEWS` in the source code at GitHub for changes
780777
in versions 17 to 1.2-25 (when the code was hosted at `R-forge`).
781-
778+

R/effectsMethods.r

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ print.sienaEffects <- function(x, fileName=NULL, includeOnly=TRUE,
2121
sink(fileName, split=TRUE)
2222
}
2323

24-
interactions <- x[x$shortName %in% c("unspInt", "behUnspInt") & x$include &
24+
interactions <- x[x$shortName %in% c("unspInt", "behUnspInt", "contUnspInt") & x$include &
2525
x$effect1 > 0, ]
2626
if (expandDummies)
2727
{
@@ -43,7 +43,7 @@ print.sienaEffects <- function(x, fileName=NULL, includeOnly=TRUE,
4343
{
4444
nDependents <- length(unique(x$name))
4545
userSpecifieds <- x$shortName[x$include] %in%
46-
c("unspInt", "behUnspInt")
46+
c("unspInt", "behUnspInt", "contUnspInt")
4747
endowments <- !x$type[x$include] %in% c("rate", "eval", "gmm")
4848
# includes creations and gmm
4949
gmm <- any(x$type[x$include] %in% "gmm")
@@ -322,7 +322,7 @@ updateSpecification <- function(effects.to, effects.from,
322322
# the above does not transfer interaction effects.
323323
# A lot of work is needed to get the information about the interacting effects.
324324
inter <- which(prevEffects$include &
325-
(prevEffects$shortName %in% c("unspInt","behUnspInt")))
325+
(prevEffects$shortName %in% c("unspInt","behUnspInt","contUnspInt")))
326326
if (length(inter) >= 1)
327327
{
328328
# look up the interacting main effects, and try to get information

R/initializeFRAN.r

+21-12
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,12 @@ initializeFRAN <- function(z, x, data, effects, prevAns=NULL, initC,
160160
}
161161
if (x$useStdInits)
162162
{
163-
# The restriction to effects with shortname not unspInt or behUnspInt
164-
# is because of the possibility to call getEffects with
163+
# The restriction to effects with shortname not unspInt, behUnspInt, or
164+
# contUnspInt is because of the possibility to call getEffects with
165165
# non-default values of nintn and behNintn.
166-
effectsr <- (!(effects$shortName %in% c("unspInt","behUnspInt")))
167-
defEffectsr <- (!(defaultEffects$shortName %in% c("unspInt","behUnspInt")))
166+
effectsr <- (!(effects$shortName %in% c("unspInt","behUnspInt","contUnspInt")))
167+
defEffectsr <- (!(defaultEffects$shortName %in% c("unspInt","behUnspInt",
168+
"contUnspInt")))
168169
if (any(effects$shortName[effectsr] != defaultEffects$shortName[defEffectsr]))
169170
{
170171
cat("There seems to be a mismatch between data set and effects object.\n")
@@ -643,26 +644,26 @@ z$gmmEffects <- ((requestedEffects$type=="gmm") & requestedEffects$fix) # hhoho
643644
basicEffects <-
644645
lapply(myeffects, function(x)
645646
{
646-
x[!x$shortName %in% c("unspInt", "behUnspInt"), ]
647+
x[!x$shortName %in% c("unspInt", "behUnspInt", "contUnspInt"), ]
647648
}
648649
)
649650
basicEffectsl <-
650651
lapply(myeffects, function(x)
651652
{
652-
!x$shortName %in% c("unspInt", "behUnspInt")
653+
!x$shortName %in% c("unspInt", "behUnspInt", "contUnspInt")
653654
}
654655
)
655656

656657
interactionEffects <-
657658
lapply(myeffects, function(x)
658659
{
659-
x[x$shortName %in% c("unspInt", "behUnspInt"), ]
660+
x[x$shortName %in% c("unspInt", "behUnspInt", "contUnspInt"), ]
660661
}
661662
)
662663
interactionEffectsl <-
663664
lapply(myeffects, function(x)
664665
{
665-
x$shortName %in% c("unspInt", "behUnspInt")
666+
x$shortName %in% c("unspInt", "behUnspInt", "contUnspInt")
666667
}
667668
)
668669
## store effects objects as we may need to recreate them
@@ -1846,6 +1847,8 @@ unpackBehavior<- function(depvar, observations)
18461847
attr(beh, "simMean") <- attr(depvar, "simMean")
18471848
## attr simMeans
18481849
attr(beh, "simMeans") <- attr(depvar, "simMeans")
1850+
## attr variance
1851+
attr(beh, "variance") <- attr(depvar, "variance")
18491852
if (attr(depvar, "type") == "behavior")
18501853
{
18511854
beh <- round(beh)
@@ -2132,15 +2135,21 @@ numberIntn <- function(myeff){
21322135

21332136
##@ numberIntn siena07 sienaBayes, number of behavior interaction effects used for getEffects
21342137
numberBehIntn <- function(myeff){
2135-
if (!is.null(myeff)){
2136-
numbeh <- length(unique(myeff$name[myeff$shortName=="linear"]))# number of dependent behaviors
2138+
if (!is.null(myeff)){
2139+
numbeh <- length(unique(myeff$name[myeff$shortName=="linear"])) # number of discrete behaviors
21372140
nbehIntn <- sum(myeff$shortName == 'behUnspInt')/3 # 3 for eval - creation - endow
2141+
numcont <- length(unique(myeff$name[myeff$shortName=="intercept"])) # nr. of continuous behaviors
2142+
ncontIntn <- sum(myeff$shortName == 'contUnspInt')
21382143
}
21392144
else
21402145
{
21412146
numbeh <- 0
2147+
numcont <- 0
21422148
}
2143-
ifelse((numbeh <= 0), 4, nbehIntn/numbeh) # 4 is the default in getEffects
2149+
ifelse((numbeh == 0 && numcont == 0), 4, # 4 is the default in getEffects
2150+
ifelse(numbeh == 0, max(4, ncontIntn/numcont),
2151+
ifelse(numcont == 0, max(4, nbehIntn/numbeh),
2152+
max(nbehIntn/numbeh, ncontIntn/numcont))))
21442153
}
21452154

21462155

@@ -2166,7 +2175,7 @@ checkVersion <- function(dat, effs){
21662175
differentVersions <- (effectsVersion != attr(defaultEffects, "version"))
21672176
}
21682177
if ((differentVersions) &
2169-
(any((effs$shortName %in% c("unspInt","behUnspInt"))&effs$include)))
2178+
(any((effs$shortName %in% c("unspInt","behUnspInt", "contUnspInt"))&effs$include)))
21702179
{
21712180
warning("Your effects object contains interaction effects and was made
21722181
using a different RSiena version.

R/sienaDataCreate.r

+23-2
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ sienaDataCreate<- function(..., nodeSets=NULL, getDocumentation=FALSE)
727727
## attr(depvars[[i]], 'simTotal') <- rr$simTotal
728728
## attr(depvars[[i]], 'simCnt') <- rr$simCnt
729729
attr(depvars[[i]], 'simMean') <- rr$simMean
730+
attr(depvars[[i]], 'variance') <- rr$variance
730731
attr(depvars[[i]], 'structural') <- FALSE
731732
attr(depvars[[i]], 'balmean') <- NA
732733
attr(depvars[[i]], 'structmean') <- NA
@@ -827,6 +828,7 @@ sienaDataCreate<- function(..., nodeSets=NULL, getDocumentation=FALSE)
827828
attr(depvars[[i]], 'balmean') <- calcBalmean(depvars[[i]])
828829
attr(depvars[[i]], 'structmean') <- calcStructmean(depvars[[i]])
829830
attr(depvars[[i]], 'simMean') <- NA
831+
attr(depvars[[i]], 'variance') <- NA
830832
attr(depvars[[i]], 'symmetric') <- TRUE
831833
attr(depvars[[i]], 'missing') <- FALSE
832834
attr(depvars[[i]], 'structural') <- FALSE
@@ -934,6 +936,7 @@ sienaDataCreate<- function(..., nodeSets=NULL, getDocumentation=FALSE)
934936
attr(depvars[[i]], 'balmean') <- NA
935937
attr(depvars[[i]], 'structmean') <- NA
936938
attr(depvars[[i]], 'simMean') <- NA
939+
attr(depvars[[i]], 'variance') <- NA
937940
attr(depvars[[i]], 'symmetric') <- FALSE
938941
attr(depvars[[i]], 'missing') <- FALSE
939942
attr(depvars[[i]], 'structural') <- FALSE
@@ -1237,8 +1240,16 @@ rangeAndSimilarity <- function(vals, rvals=NULL)
12371240
simTotal <- sum(raw)
12381241
simCnt <- sum(cnts)
12391242
simMean <- ifelse(simCnt==0, 0, simTotal/simCnt)
1240-
}
1241-
list(simTotal=simTotal, simMean=simMean, range=rvals, simCnt=simCnt)
1243+
}
1244+
1245+
# and variance
1246+
sum <- sum(c(vals), na.rm = TRUE)
1247+
sumSq <- sum(c(vals)^2, na.rm = TRUE)
1248+
nonmis <- sum(!is.na(c(vals)))
1249+
variance <- ifelse(nonmis==0, 0, (sumSq/nonmis) - (sum/nonmis)^2)
1250+
1251+
list(simTotal=simTotal, simMean=simMean, range=rvals, simCnt=simCnt,
1252+
sum=sum, sumSq=sumSq, variance=variance, varCnt=nonmis)
12421253
}
12431254
##@groupRangeAndSimilarityAndMean DataCreate
12441255
## calculates attributes at group level and re-centers actor covariates
@@ -1251,13 +1262,17 @@ groupRangeAndSimilarityAndMean <- function(group)
12511262
behRange <- matrix(NA, ncol=length(netnames), nrow=2)
12521263
colnames(behRange) <- netnames
12531264
bSim <- namedVector(NA, netnames)
1265+
bVar <- namedVector(NA, netnames)
12541266
bPoszvar <- namedVector(NA, netnames)
12551267
bMoreThan2 <- namedVector(NA, netnames)
12561268
bAnyMissing <- namedVector(FALSE, netnames)
12571269
for (net in which(atts$types %in% c("behavior", "continuous")))
12581270
{
12591271
simTotal <- 0
12601272
simCnt <- 0
1273+
sumTotal <- 0
1274+
sumSqTotal <- 0
1275+
varCnt <- 0
12611276
anyMissing <- FALSE
12621277
bPoszvar[net] <- TRUE
12631278
thisrange <- matrix(NA, ncol=length(group), nrow=2)
@@ -1292,12 +1307,18 @@ groupRangeAndSimilarityAndMean <- function(group)
12921307
simTotal <- simTotal + tmp$simTotal
12931308
simCnt <- simCnt + tmp$simCnt
12941309
values <- c(values, unique(depvar))
1310+
1311+
sumTotal <- sumTotal + tmp$sum
1312+
sumSqTotal <- sumSqTotal + tmp$sumSq
1313+
varCnt <- varCnt + tmp$varCnt
12951314
}
12961315
simMean <- ifelse(simCnt==0, 0, simTotal/simCnt)
12971316
bSim[net] <- simMean
12981317
bMoreThan2[net] <- length(unique(values)) > 2
12991318
if (anyMissing)
13001319
bAnyMissing[net] <- TRUE
1320+
variance <- ifelse(varCnt==0, 0, sumSqTotal/varCnt - (sumTotal/varCnt)^2)
1321+
bVar[net] <- variance
13011322
}
13021323
## constant ones will not exist unless there is only one data object
13031324
cCovarRange <- namedVector(NA, atts$cCovars)

0 commit comments

Comments
 (0)