Displaying 5 results from an estimated 5 matches for "pmiss".
Did you mean:
miss
2009 Apr 09
1
.Call()
...(mean(x[cols]) -
mean(x[-cols]))/sd(x)})
ranklist <- ranklist[order(ranklist[,1]),]
if(ranklist[1,2]==1) score[i] <- 1/Ns
if(ranklist[1,2]==0) score[i] <- -(1/(N-Ns))
for(j in 2:nrow(ranklist)){
phit <- sum(rep(1/Ns, sum(ranklist[1:j,2]==1)))
pmiss <- sum(rep(1/(N-Ns), sum(ranklist[1:j,2]==0)))
if((phit-pmiss)>score[i]) score[i] <- phit - pmiss
}
}
I tried a little bit, but not enough knowledge in C.
#include <stdio.h>
#include <R.h>
#include <Rdefines.h>
#include <math.h>
SEXP ESscore(SEXP Rge...
2011 Oct 24
2
C function is wrong under Windows 7
....0;
for (i = 0; i < signLen; ++i) {
nr = absolute(fchr[sign[i] -1]) + nr;
}
return nr;
}
void getPhit(double *fchr, int *sign, int signLen, double nr, double *phit)
{
int i;
for (i = 0; i < signLen; ++i) {
*(phit + sign[i]-1) = absolute(*(fchr + sign[i]-1)) / nr;
}
}
void getPmiss(int *sign, int fchrLen, int signLen, double *pmiss)
{
int i;
double tmp = 1.0 / (fchrLen-signLen);
for (i = 0; i < fchrLen; ++i) {
*(pmiss + i) = tmp;
}
for (i = 0; i < signLen; ++i) {
*(pmiss + sign[i]-1) = 0;
}
}
SEXP getEs(SEXP fchr, SEXP sign)
{
int i, nfchr, nsign;
dou...
2011 Jun 03
3
Not missing at random
...s) as NA
(NMAR- Not missing at random). I managed to sample cases, but I don’t know how
to set values (lower than 3) as NA.
R code:
x <-
matrix(c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,3,3,3,4),
nrow = 7, ncol=7, byrow=TRUE) ####matrix
pMiss <- 30 ####percent of missing values
N <- dim(x)[1] ####number of cases
candidate<-which(x[,1]<3 | x[,2]<3 | x[,3]<3 | x[,4]<3 | x[,5]<3 | x[,6]<3 |
x[,7]<3) #### I want to sample all cases with at least 1 value lower than 3,
so I have to find candidates...
2011 Jun 01
1
Missing completely at random
...thin selected
cases and set them as NA (MCAR-Missing completely at random). I managed to
sample cases and variables, but I don’t know how to set them as NA.
R code:
N <- 1000 ####number of cases
n <- 12 ####number of variables
X <- matrix(rnorm(N * n), N, n) ####matrix
pMiss <- 0.05 ####percent of missing values
idMiss <- sample(1:N, N * pMiss) ####sample cases
nMiss <- length(idMiss)
m <- 3 ####maximum number of missing variables within selected cases
howmanyMiss <- sapply(idMiss, function(x) sample(1:m, 1))
howmanyMiss
lapply(howmanyMiss, fun...
2010 Oct 22
3
Conditional looping over a set of variables in R
Here's the problem I'm trying to solve in R: I have a data frame that consists of about 1500 cases (rows) of data from kids who took a test of listening comprehension. The columns are their scores (1 = correct, 0 = incorrect, . = missing) on 140 test items. The items are numbered sequentially and are ordered by increasing difficulty as you go from left to right across the columns. I want