This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Power analysis for CSM | |
alpha <- 0.05 #alpha level | |
d <- 29 #degrees of freedom | |
n <- 185 #sample size | |
rmsea0 <- 0.08 #null hypothesized RMSEA | |
rmseaa <- 0.05 #alternative hypothesized RMSEA | |
#Code below this point need not be changed by user | |
ncp0 <- (n-1)*d*rmsea0^2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(pROC) | |
data(aSAH) | |
#Initial ROC analysis | |
roc(aSAH$outcome, aSAH$s100b) #first argument = outcome; second = predictor | |
roc(outcome ~ s100b, aSAH) #formula mode with dataset in the end | |
roc(outcome ~ s100b, aSAH, smooth=TRUE) #applying smoothing | |
#CI and Plotting | |
roc1 <- roc(aSAH$outcome, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Prediction models in R | |
#Packages needed: | |
#"Deducer" | |
#"tree" | |
#"randomForest" | |
#"reshape" | |
lapply(c("Deduces","randomForest","tree","reshape"), | |
library, character.only=T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################################################################### | |
# | |
# MAXEIG -- performs MAXEIG, but can also be used to perform MAXCOV. | |
# | |
# Written by John Ruscio | |
# Last modified January 9, 2012 | |
# | |
########################################################################################################### | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### ANALISE TAXOMETRICA COM O PACOTE R DE JOHN RUSCIO | |
# BANCO DE DADOS PARA AS ANALISES | |
##### | |
#Preparar um banco com dois ou mais indicadores (algumas an·lises requerem trÍs, como MAXCOV e MAXHEIG), sendo que os "indicadores" | |
#s„o escores brutos em escalas ou escores compostos (ponderados ou n„o). Uma alternativa, que pode ajudar na interpretaÁ„o das curvas, È utilizar | |
#escores padronizados dos indicadores, embora seja ˙til relatar tambÈm as informaÁıes descritivas da escala original dos indicadores. Se os | |
#indicadores forem padronizados, lembrar de n„o deixar valores decimais com vÌrgula, que o R n„o reconhece. … necess·rio usar pontos (se n„o | |
#der certo a substituiÁ„o das vÌrgulas por pontos no Excel, reduzir para duas casas decimais, copiar, colar no TexPad, substituir, colar de volta | |
#no Excel e salvar). … recomend·vel tambÈm conferir as opÁıes de an·lise oferecidas no manual, uma vez que alguns dos programas do pacote oferecem a opÁ„o de padronizar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(‘‘parcor’’) | |
library(‘‘Matrix’’) | |
set.seed(100) | |
adls <- adalasso.net(Data) | |
network <- | |
as.matrix(forceSymmetric(adls$pcor.adalasso)) | |
qgraph(network, layout = ‘‘spring’’, labels = | |
colnames(Data), groups = groups) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("IsingFit") | |
library("qgraph") | |
library("Matrix") | |
library("glmnet") | |
library("IsingSampler") | |
lapply(c("IsingFit","qgraph","Matrix","glmnet","IsingSampler","psych"), | |
library, character.only=T) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
itemfit <- function(x, Zh = TRUE, X2 = FALSE, S_X2 = TRUE, group.size = 150, mincell = 1, S_X2.tables = FALSE, | |
empirical.plot = NULL, empirical.CI = 0, method = 'EAP', Theta = NULL, | |
impute = 0, ...){ | |
fn <- function(collect, obj, Theta, ...){ | |
tmpdat <- imputeMissing(obj, Theta) | |
tmpmod <- mirt(tmpdat, obj@nfact, pars = vals) | |
tmpmod@pars <- obj@pars | |
return(itemfit(tmpmod, Theta=Theta, ...)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### USING eRM Package | |
IRTRolandMorris <- RM(RolandMorrisOriginal) | |
summary() | |
coef() | |
confint(,"beta") | |
plotI(,i=3) | |
plotICC(,item.subset=1:4,ask=F,empICC=list("raw"),empCI=list(lty="solid")) | |
plotPImap() | |
pp<-person.parameter() | |
lrt<-LRtest(,se=TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################################### | |
#TEMPLATE DE ANALISE - contexto_study_3.R | |
##################################################################################### | |
# | |
# Glossário | |
# $ = Pertence a = data$sexo, que dizer variável sexo pertencente ao banco data | |
# | |
# | |
##################################################################################### | |
#ORGANIZANDO O AMBIENTE DO R |
NewerOlder