Displaying 20 results from an estimated 21 matches for "ntotal".
Did you mean:
total
2001 Dec 09
1
Help for Power analysis
...ostatistics & Demography. Faculty of Public Health.
#Khon Kaen University. Thailand.
#Email: nikom at kku.ac.th
#Modify data value of the first two line
x1 <- c(6,9)
x2 <- c(6,6)
nc <-cbind(x1)
nr <-rbind(x2)
data1 <- rbind(x1,x2)
chi2<- chisq.test(data1,correct=F)$statistic
Ntotal<-sum(data1)
df<- ncol(nc-1)*nrow(nr-1)
ifelse(df==1,w<- sqrt(chi2/Ntotal), w<-sqrt(chi2/(chi2+Ntotal)))
Ntotal1<-900 #change this if power not enough
alpha <-0.05 #change this for One tailed =0.05
ncp<-0
chicrit<-NULL
power<-NULL
n<-NULL
samplesize<-NULL
for (i...
2005 Nov 09
2
help with legacy R code
...d) seems to be off on some of the data, is
there a better way of doing this.
Thanks very much in advance!
David
library(MASS)
jpeg(filename = "diswrong.jpg", width = 800, height = 600, pointsize = 12,
quality = 75, bg = "white")
myfunc <- function(x, mean, sd, nfalse, ntotal, shape, rate) {
(nfalse*dgamma(x,shape,rate)+(ntotal-nfalse)*dnorm(x,mean,sd))/ntotal
}
wrong <- scan("wrongrawdata.txt", list(x=0))
wrongfit <- fitdistr(wrong$x, "gamma")
wrongmean <- mean(wrong$x)
wrongshape <- wrongfit[[1]][1]
wrongrate <- wrongfit[[1]]...
2008 Jul 16
5
''$'' placeholder naming can confuse your runner
Hi guys, I''m facing a strange behavior that smells like a bug.
consider this scenario:
Scenario: I''m cool
Given that I am cool 4 times out of 7
and this step:
Given("that I am cool $n times out of $n_total") do |n, n_total|
...
end
When running my story, this step is considered as PENDING.
If I change the name of the second placeholder to $total, the step
runs
1997 Sep 05
2
R-beta: help with R simulation
...d y) will be computed.
The code below is my feeble attempt to do the simulation.
So far as I know, it doesn't work. Any help appreciated!
(I am using Mac version of R)
Bill Simpson
# nearest neighbour distance simulation
# for dynamic noise dots
do.sim<-function(nnoise, nsignal, jump)
{
ntotal<-nsignal+nnoise
x<<-NULL
y<<-NULL
x.temp<-0
y.temp<-0
#generate noise dots
nx1<-runif(nnoise,0,4095)
nx2<-runif(nnoise,0,4095)
ny1<-runif(nnoise,0,4095)
ny2<-runif(nnoise,0,4095)
#generate signal dots
sx1<-runif(nsignal,0,4095)
sx2<-sx1
sy1<-runif(nsignal...
2012 Apr 05
0
Multi part problem...array manipulation and sampling
...Part 1. I have a three dimensional array (species, sites, repeat counts
within sites). Sampling effort per site varies so the array should be
ragged.
Maximum number of visits at any site = 22
Number of species = 161
Number of sites = 56
I generated the array first by;
mydata<-tapply(spdata1$NTOTAL,list(spdata1$COUNT,spdata1$SPECIES,spdata1$SITESURVEY),sum)
where spdata1$NTOTAL = number of detections
spdata1$COUNT = repeat visit per site (max = 22)
spdata1$SITESURVEY = site and survey period (=56)
This gives me an array with dim (22,161,56), which is populated by either a
number (NTOTAL), o...
2009 Aug 12
1
calling a function with dynamically generated buttons
...thresh), side=3, col="blue")
}
lb <- tklabel(base, text="Barplot:")
tkgrid(lb, row=4, column=0)
for(i in 1:(reihen-1)) {
anzeige <- data.matrix(dataframe[i,-c(spalten)])
namen <- names(anzeige)
tit <- paste(classi[i], "\nTotal Threshold for", classi[i],
":", dataframe[i, spalten])
but <- tkbutton(base, text = classi[i], command = function()
{plotten(mat = anzeige, namen = namen, titel = tit)})
tkgrid(but, row=4, column=i, sticky="e")
}
The buttons are all displayed corr...
1998 Jul 09
1
numeric(0) -> NA
...is the way it is supposed to be. I would
prefer for it to stay numeric(0).
I notice also
> ceiling(runif(0,0,4095))
numeric(0)
> floor(runif(0,0,4095))
numeric(0)
which leads me to thing round() is not working right.
I have some code like this:
do.sim<-function(nnoise, nsignal, jump)
{
ntotal<-nsignal+nnoise
x<-numeric(ntotal)
y<-numeric(ntotal)
#generate noise dots
nx1<-round(runif(nnoise,0,4095))
nx2<-round(runif(nnoise,0,4095))
ny1<-round(runif(nnoise,0,4095))
ny2<-round(runif(nnoise,0,4095))
#generate signal dots
sx1<-round(runif(nsignal,0,4095))
...
and I...
2008 Feb 19
2
one-way anova power calculations
...= 1
NOTE: n is number in each group
I've already done the calculation in SAS with the following code:
data Dep;
Input cue $ mean weight;
datalines;
A 17.5 1
B 19 1
C 25 1
D 20.5 1
;
proc glmpower;
class cue;
model mean = cue;
weight weight;
power
stddev = 9
alpha = 0.05
ntotal= 80
power = .;
run;
This produces a power of 0.616 which is the answer I was supposed to get.
Any idea what I need to change?
Will
[[alternative HTML version deleted]]
2011 Jun 03
0
How to reconcile Kalman filter result (by package dlm) with linear regression?
...1] [,2] [,3] [,4]
[24,] -0.06046868 0.002829377 -0.01569903 0.03599957
I am pretty troubled by what I see here. So if anyone would offer me some condolence, as well as helpful advice, I am greatly grateful. Thanks a lot. Here are the code and the data.
Thanks a lot.
Wei
nTotal = nMatrix + 1
BuildMod <- function(x){
L1 = matrix(0,nFactor,nFactor)
L1[upper.tri(L1,T)] <- x[1:nMatrix]
return(dlm(
m0 = rep(0,nFactor),
C0 = diag(nFactor)*10,
FF = matrix(1,1,nFactor),
GG = diag(nFactor),
V = tail(x,1)^2,
W = crossprod(L1),
JFF = matrix(1:4,nr=1),...
2011 Dec 16
0
crash in using Rcpp and inline packages.
...sp0);
NumericMatrix phyd(phyd0);
double rmax = as<double>(rmax0);
double step = as<double>(step0);
double totalcout = 0.0;
double totalsum = 0.0;
int binlength = as<int> (binlength0);
NumericVector bincout(binlength);
NumericVector binsum(binlength);
int nfocal=fx.size();
int ntotal=x.size();
double dist =0.0;
double ibin = 0.0;
double lpd = 0.0;
typedef NumericVector::iterator vec_iterator;
vec_iterator ifx = fx.begin(), ify = fy.begin();
vec_iterator ix= x.begin(), iy = y.begin();
vec_iterator ifsp = fsp.begin(), isp = sp.begin();
for (int i = 0; i < nfocal; i++){...
2011 Dec 16
0
Fw: crash in using Rcpp and inline packages.
...sp0);
NumericMatrix phyd(phyd0);
double rmax = as<double>(rmax0);
double step = as<double>(step0);
double totalcout = 0.0;
double totalsum = 0.0;
int binlength = as<int> (binlength0);
NumericVector bincout(binlength);
NumericVector binsum(binlength);
int nfocal=fx.size();
int ntotal=x.size();
double dist =0.0;
double ibin = 0.0;
double lpd = 0.0;
typedef NumericVector::iterator vec_iterator;
vec_iterator ifx = fx.begin(), ify = fy.begin();
vec_iterator ix= x.begin(), iy = y.begin();
vec_iterator ifsp = fsp.begin(), isp = sp.begin();
for (int i = 0; i < nfocal; i++){...
2006 Oct 06
1
glm and plot.effects
Dear R-helpers,
I don't see a difference between the following two plots of effect
objects, which I understand should be different. What am I missing?
require(doBy)
require(effects)
data(budworm)
m1 <- glm(ndead/20 ~ sex + log(dose), data=budworm, weight=ntotal,
family=binomial)
m1.eff <- all.effects(m1)
plot(m1.eff, rescale.axis = FALSE, selection = 2, main = 'rescale = F')
plot(m1.eff, rescale.axis = TRUE, selection = 2, main = 'rescale = T')
*********************************
R version 2.4.0 (2006-10-03)
powerpc-apple-darwin8.7.0...
2008 Feb 21
1
anova power calculations
...anyone have any idea what is wrong with my code?
The SAS I am comparing it to is:
Data Dep;
Input cue $ mean uneven_weight;
datalines;
A 17.5 1
B 19 1
C 25 5
D 20.5 1
;
proc glmpower;
class cue;
model mean = cue;
weight uneven_weight;
power
stddev = 9
alpha = 0.05
ntotal= 80
power = .;
run;
Any help would be much appreciated.
Will
[[alternative HTML version deleted]]
2007 Jan 22
0
Recursive-SVM (R-SVM)
...s label
ReadSVMdata <- function(filename)
{
dd <- read.table( filename, header=F, skip=1)
x <- as.matrix( dd[, 1:(ncol(dd)-1)] )
y <- factor( dd[, ncol(dd)] )
ret <- list(x=x, y=y)
}
## create a decreasing ladder for recursive feature elimination
CreatLadder <- function( Ntotal, pRatio=0.75, Nmin=5 )
{
x <- vector()
x[1] <- Ntotal
for( i in 1:100 )
{
pp <- round(x[i] * pRatio)
if( pp == x[i] )
{
pp <- pp-1
}
if( pp >= Nmin )
{
x[i+1] <- pp
} else
{
break
}
}
x
}
## R-SVM core code
## input:
## x: row matrix of data
## y: class la...
2009 Apr 13
0
encoding -> decoding doesnt work
...ew char[nBytes];
int encodedBytes =
speex_bits_write(&bits,encodedArray,nBytes);
printf("Encoded: %d \t",encodedBytes);
total += encodedBytes;
encoded = (char*)realloc( encoded, total );
memcpy( (encoded+total-encodedBytes), encodedArray,
encodedBytes );
}
printf("\n\nTotally: %u\nper Item: %f\n\n", total,
(float)total/(amountSamples/frame_size) );
speex_bits_destroy(&bits);
speex_encoder_destroy(enc_state);
// ###########################
// decoding
// ###########################
SpeexBits dec_bits;
void *dec_state;
const SpeexMode *dec_mode;
de...
2008 Sep 19
0
Error message in lmer
...ttp://tolstoy.newcastle.edu.au/R/e2/help/06/10/2918.html)
2) the selected samples out of my data set ("id") to run the predictions
create the problem (maybe if some x values = 0?)
Thanks a lot for your time! I very much appreciate the help.
Thomas
Here a chunk of the data:
(n = 30, ntotal = 96)
location ms cut age_insects city rV.rGb ECON_MN SHDI
101 328 3 6 ZH 78.46 32.13 0.926
102 211 8 2 ZH 77.60 7.54 0.614
103 306 1 3 ZH 60.23 20.57 0.831
104 195 3 1 ZH 67.48 18.33 0.872
105 232 11 49 ZH 58.90 8.67 0.682
106 291 2 20 ZH 2.49 70.45 0.637
107 297 9 44 ZH 22.85 5.73 0.522
108 281...
2009 May 29
0
possible bug in "sspir" package?
...uot;logit"), fit=FALSE)
>ssm.ex1.fit <- extended(ssm.ex1$ss)
Error in ss$Fmat(tt, ss$x, ss$phi) : subscript out of bounds
When I went in and looked at the details of the ssm code, I saw that on
lines 146-151, the code is trying to establish the vectors for the
number of trials ("ntotal") and the response ("y") based on the rows of
the input matrix y rather than based on the columns. Thus, if I change
those lines and rerun the code above, I do in fact get an estimated
state vector of length=20 (and the estimates seem reasonable). My
modified version of your code...
2007 May 10
3
how to control the sampling to make each sample unique
I have a dataset of 10000 records which I want to use to compare two
prediction models.
I split the records into test dataset (size = ntest) and training dataset
(size = ntrain). Then I run the two models.
Now I want to shuffle the data and rerun the models. I want many shuffles.
I know that the following command
sample ((1:10000), ntrain)
can pick ntrain numbers from 1 to 10000. Then I just
2006 Nov 16
6
DTrace hooks for CPU caps
...ults in seconds
*/
normalize (@cpu, 1000000000);
normalize (@sleeps, 1000000000);
normalize (@total, 1000000000);
printf ("ON-CPU times:\n");
printa ("%-18s %@u\n", @cpu);
printf ("\nWait times:\n");
printa ("%-18s %@u\n", @sleeps);
printf ("\nTotal times:\n");
printa ("%-18s %@u\n", @total);
}
Any comments/suggestions/objections?
- Alexander Kolbasov
http://blogs.sun.com/akolb
2007 Feb 12
17
NFS/ZFS performance problems - txg_wait_open() deadlocks?
...uot;nfsd"/{txg_c++;self->t1=timestamp;self->arg1=arg1;}'' -n fbt::txg_wait_open:return''/self->t1/{txg_c--;@[self->arg1]=quantize((timestamp-self->t1)/1000000000);self->t1=0;self->arg1=0;}'' -n tick-10s''{printa(@);printf("txg_count: %d\ntotal time in seconds: %d\n",txg_c,(timestamp-gt)/1000000000);}''
txg_count: 0
total time in seconds: 9
txg_count: 0
total time in seconds: 19
txg_count: 0
total time in seconds: 29
txg_count: 0
total time in seconds: 39
txg_count: 0
total time in seconds: 49
txg_count: 487
total time...