If you get the contents of the a.txt, we use

a <- read.csv(file="c:\\a.csv", header=FALSE)

***************************************

Now if we want to get the property of c:\a.csv such as date (when it is made and when it is modified),

is there any R command? ]]>

I use R to do non-linear regression on data which follow a cosinus rule. I measure intensity of light (Raman intensity=V2) as function of the orientation of the sample (=V1).

I do the fitting with this formula V2(m * (1 - s * cos(2 * V1)))

V2 = intensity of light (no units) measured

m and s are coefficients to be evaluated by the fitting

V1 = angle of rotation in radian

So, I managed to do the non-linear regression :yup: see nlr1.jpg

And I plot the fitted curve and data point with interval of confidence see nlr2.jpg

The actual plot (with confidence limits nlr2.jpg) represent the intensity of light as function of the angle of rotation in radian.

I didn't managed to get the plot nlr2.jpg with x-axis in degrees.

I would like to have the same plot (as nlr2.jpg) with the x-axis in degrees (and not in radians).

I hope my question is clear. Thank you for any suggestion:).

My ultimate solution is to save the graph in svg file and modify the x-axis manually. which is not the optimal solution:shakehead.

Regards

My code is

Code:

`library("stats")`

M1<-nls(V2~I(m*(1-s*cos(2*V1))),data=r1045_960,start=list(m=0.46,s=0.1),trace=T)

plot(r1045_960$V1,r1045_960$V2)

s <- seq(from = 0, to = 3.14, length = 50)

lines(s, predict(M1, list(V1 = s)), col = "green") #generate plot nlr1.jgp

library("nlrwr")

confint2(M1)

Library("investr")

plotFit(M1, interval = "both", pch = 19, shade = TRUE) #generate plot nlr2.jpg

I've started my first R project a few days ago. Currently I'm wondering about some results. Hopefully someone can give me feedback wether the following code is correct or not.

Some Information:

The project: I try to design a stress testing model.

Input: 12 variables, 29 observations

PCA: done, I've selected 4 PCs, explaining 70% of variance

###################################################

D <-US_corp_migr$Defaulted

N <-US_corp_migr$Totals-US_corp_migr$Defaulted

PC1 = PCA2$x[,1]

PC2 = PCA2$x[,2]

PC3 = PCA2$x[,3]

PC4 = PCA2$x[,4]

Regression2 = glm(cbind(D,N)~(PC1+PC2+PC3+PC4),family=binomial(logit))

summary(Regression2)

anova(Regression2, test="Chisq")

plot(Regression2$fitted)

abline(v=15,col="red")

Regression2$fitted

# plot(Regression)

# coef(Regression)

# residuals(Regression)

## predict

test_data = PCA_DATA2[1:29, ]

test_data

test.p = predict(PCA2,test_data)

test.p = data.frame(test.p)

test.p = data.frame(test.p)[1:4]

pred = predict(Regression2,test.p, type="response")

##################################################

Comparing the results with the actual default data leads to high deviations (30-150%). :confused:

Is that correct?

Thank you very much! ]]>