search for: xmean

Displaying 16 results from an estimated 16 matches for "xmean".

Did you mean: mean
2011 May 04
3
Error in .Fortran Call
I have the following FORTRAN code converted to a DLL: ! my_xmean.f90 ! ! FUNCTIONS/SUBROUTINES exported from my_function.dll: ! my_function - subroutine ! subroutine my_xmean(X,N,XMEAN) ! Expose subroutine my_function to users of this DLL ! !DEC$ ATTRIBUTES DLLEXPORT,C,REFERENCE,ALIAS:'my_xmean_'::my_xmean ! Body of my_function DOUBLE PRECISION X(N)...
2006 Nov 17
2
effects in ANCOVA
...Particularly I am interested in obtaining estimates for mu, and the effects alpha_i I have this data (from the book Applied Linear Statistical Models by Neter et al (1996), page 1020) y<-c(38,43,24,39,38,32,36,38,31,45,27,21,33,34,28) x<-c(21,34,23,26,26,29,22,29,30,28,18,16,19,25,29) xmean<-x-mean(x) grupo<-factor(rep(c(1,2,3),5)) datos<-data.frame(y,xmean,grupo) and I have done the following modelo<-lm(y~xmean+grupo,data=datos) summary(modelo) Call: lm(formula = y ~ xmean + grupo, data = datos) Residuals: Min 1Q Median 3Q Max -2.4348 -1.2739 -0.3...
2011 Aug 07
2
help annotating plot.xmean.ordinaly in rms package
Hello List: Does anyone know if there's a way to annotate the plots produced by the plot.xmean.ordinaly function in the rms package. I'd like to produce publication quality figures, but first need to annotate the axis labels. Is there a way to do that? I appreciate any advice. Chris [[alternative HTML version deleted]]
2009 Feb 27
1
Sweave doesn't do csv.get()
...2.8.0 on Mac OS X. I set up LyX 1.6.1 to use Sweave today. I can compile the test file I found on CRAN ( http://cran.r-project.org/contrib/extra/lyx/) without a problem and the output looks very nice. In the test file the following R code is used. <<myFirstChunkInLyX>>= xObs <- 100; xMean <- 10; xVar <- 9 x <- rnorm(n=xObs, mean=xMean, sd=sqrt(xVar)) mean(x) @ that should be the same as: xObs <- 100 xMean <- 10 xVar <- 9 x <- rnorm(n=xObs, mean=xMean, sd=sqrt(xVar)) mean(x) in the R console. My problem is that I want to import data to use in my report. In th...
2004 Dec 02
3
R and Fortran in Windows
...m These notes were written by J.R.M. Hosking. Using Fortran routines from R with CVF 1. Take a working Fortran subroutine, and put its name in an ATTRIBUTES DLLEXPORT directive to ensure that the routine name is exported from the DLL that will be built. Example: SUBROUTINE MYSUB(X,N,XMEAN) CDEC$ ATTRIBUTES DLLEXPORT :: MYSUB IMPLICIT DOUBLE PRECISION (A-H,O-Z) DOUBLE PRECISION X(N) XMEAN=0D0 DO 10 J=1,N XMEAN=XMEAN+X(J) 10 CONTINUE XMEAN=XMEAN/N RETURN END 2. Compile and link the routine using the CVF options /assume:underscore and /dll....
2006 Apr 10
1
Generic code for simulating from a distribution.
Hello all, I have the code below to simulate samples of certain size from a particular distribution (here,beta distribution) and compute some statistics for the samples. betasim2<-function(nsim,n,alpha,beta) { sim<-matrix(rbeta(nsim*n,alpha,beta),ncol=n) xmean<-apply(sim,1,mean) xvar<-apply(sim,1,var) xmedian<-apply(sim,1,median) simset<-data.frame(sampleno=seq1:nsim),means=xmean,vars=xvar,medians=xmedian) return(simset) } I can write a similar coding for any distribution individually. Now, I would like to have a generic code, say if I sp...
2012 May 02
1
returning value from source() in R .Net
...within a C# .Net application equivalent to: source("my_r_code.r") I can get this to run but am not sure how to retrieve R objects defined with script my_r_code.r at runtime. For example, if "my_r_code.r" contains #-- contents of my_r_code.r--------------------- x <- 1:10 xmean <- mean(x) #------------------------------------------------------ My question is how to return the value of xmean to the .Net application? Paul [[alternative HTML version deleted]]
2002 Jun 20
2
tabulate means & NA
...aced or delete ! tapply(data,var,mean) # makes me problem,because when one value is NA mean is NA,too. Another attempt is this, because the summary does what i want , but is not subsetable to summary[4] if i use tapply,table and the the function below gives me again all means as NA ? xmean <- function (var) { summary(var)[4] } apply(data,2,xmean) Thanks for any suggestion & regards,Christian -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "...
2012 Mar 29
1
how to increase speed for function?/time efficiency of below function
i am using sarima() function as below ___________________________________________________________________________________________ sarima=function(data,p,d,q,P=0,D=0,Q=0,S=-1,tol=.001){ n=length(data) constant=1:n xmean=matrix(1,n,1) if (d>0 & D>0) fitit=arima(data, order=c(p,d,q), seasonal=list(order=c(P,D,Q), period=S), optim.control=list(trace=1,REPORT=1,reltol=tol)) if (d>0 & D==0) fitit=arima(data, order=c(p,d,q), seasonal=list(order=c(P,D,Q), period=S),...
2006 Feb 28
2
Elegant way to express residual calculation in R?
Hi All, I am illustrating a simple, two-way ANOVA using the following data and I'm having difficulty in expressing the predicted values succinctly in R. X<- data.frame(read.table(textConnection(" Machine.1 Machine.2 Machine.3 53 61 51 47 55 51 46 52 49 50
2008 Oct 20
1
Calculate SPE in PLS package
Dear list, I want to calculate SPE (squared prediction error) in x-space, can someone help? Here are my codes: fit.pls<- plsr(Y~X,data=DAT,ncomp=3,scale=T,method='oscorespls',validation="CV",x= T) actual<-fit.pls$model$X pred<-fit.pls$scores %*% t(fit.pls$loadings) SPE.x<-rowSums((actual-pred)^2) Am I missing something here? Thanks in advance. Stella Sim
2007 May 21
1
PLS in R and SAS
Dear all: I am comparing the PLS outputs of R and SAS for the following data set: Y x1 x2 x3 3 6 2 2 3 1 5 5 4 7 4 1 5 6 5 6 2 4 3 2 8 5 0 9 where Y is the dependent variable and x1, x2, x3 are the independent variables. I found several PLS algorithms in R (NIPALS,SIMPLS,KERNEL PLS). SAS has SIMPLS and NIPALS. The following are the NIPALS calculations of
2006 Aug 02
0
Trying to use segmented in a function
...the breakpoint regression: this package seems to be the one that most people use for this, as far as I can see. Since I want to run some simulations, I'm trying to write functions that use segmented, and it's driving me mad. Here's a simple example: simdata<-function (Ns=200,Xmean=20,Xsd=5,SdYerr=0.5,Yint=0,threshold=20,slopebelow=0.5,slo peabove=1) { Xs<-rnorm(Ns,Xmean,Xsd) Yerr<-rnorm(Ns,0,SdYerr) D<-ifelse(Xs<=threshold,0,1) XminusX0<-Xs-threshold Ys<-Yint+slopebelow*Xs+slopeabove*XminusX0*D+Yerr plot(Xs,Ys) linmod<-lm(Ys~Xs) segment<-s...
2013 Apr 19
2
NAMESPACE and imports
...,Glm,Gls,groupkm,Hazard,hazard.ratio.plot,histdensity,"%ia%",ie.setup,interactions.containing,legend.nomabbrev,lm.pfit,lrm,lrtest,lsp,matinv,matrx,Newlabels,Newlevels,nomogram,num.intercepts,ols,ols.influence,oos.loglik,pantext,Penalty.matrix,Penalty.setup,pentrace,perimeter,perlcode,plot.xmean.ordinaly,pol,pphsm,predab.resample,Predict,psm,rcs,related.predictors,reVector,robcov,Rq,sascode,scored,sensuc,setPb,show.influence,specs,strat,Surv,"[.Surv",survdiffplot,survest,Survival,survplot,univarLR,validate,val.prob,val.probg,val.surv,vif,which.influence) importFrom(Hmisc) S3meth...
2009 Aug 13
2
Coding problem: How can I extract substring of function call within the function
...invisible(NULL)); } z=as.character(substitute(x)); # must include code here to check that z is the name # of one of our altered functions # if z is an altered function, e.g., "mean" # then concatenating "x" with z gives the overlaid # function -- e.g. xmean is the standard mean #*************************************************************************** # Now we need to get a hold of the ... text * # * w=sys.call...
2005 Nov 09
2
help with legacy R code
...tal } wrong <- scan("wrongrawdata.txt", list(x=0)) wrongfit <- fitdistr(wrong$x, "gamma") wrongmean <- mean(wrong$x) wrongshape <- wrongfit[[1]][1] wrongrate <- wrongfit[[1]][2] good <- scan("rawdata.txt", list(x=0)) xmin = 0 newx = good$x xmean = mean(newx) xmax = max(newx)+0.15 goodhist <- hist(newx, br=seq(from=0,to=xmax,by=0.15), probability=T, col="lightyellow") initmean <- (min(newx)+max(newx))/2 totalx <- length(newx) wrongmeanshift <- wrongmean + 0.2 wrongper <- pgamma(wrongmeanshift, wrongshape,...