Re: [R] Book Recommendation

2023-08-28 Thread William Michels via R-help
I'm a big fan of the sqldf package by Gabor Grothendieck:

"sqldf: Manipulate R Data Frames Using SQL"
https://CRAN.R-project.org/package=sqldf

The sqldf "README.html" converts to a 42 page PDF:
https://cran.r-project.org/web/packages/sqldf/readme/README.html

You can also find favorable blog posts for the sqldf package on the
web, notably a post (circa 2013) from Patrick Burns:
https://www.burns-stat.com/translating-r-sql-basics/

HTH,

Bill.

W. Michels, Ph.D.



On Mon, Aug 28, 2023 at 8:47 AM Stephen H. Dawson, DSL via R-help
 wrote:
>
> Good Morning,
>
>
> I am doing some research to develop a new course where I teach. I am
> looking for a book to use in the course content to teach accomplishing
> SQL in R.
>
> Does anyone know of a book on this topic to recommend for consideration?
>
>
> Thank You,
> --
> *Stephen Dawson, DSL*
> /Executive Strategy Consultant/
> Business & Technology
> +1 (865) 804-3454
> http://www.shdawson.com
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Hadley Wickham
These days I'd recommend duckdb
(https://cran.r-project.org/web/packages/duckdb/index.html) instead.
It's a similar design to RSQLite (i.e. you don't need a separate
server) but it's designed for the needs of data science.

Hadley

On Tue, Aug 29, 2023 at 9:22 AM Martin Møller Skarbiniks Pedersen
 wrote:
>
> The SQLite is a good database to use.
>
> https://cran.r-project.org/web/packages/RSQLite/vignettes/RSQLite.html
>
> On Mon, Aug 28, 2023, 22:12 Stephen H. Dawson, DSL via R-help <
> r-help@r-project.org> wrote:
>
> >
> > This is an academic course. The effort now is to nail down the former. I
> > am pushing against a local db for the students. I prefer they focus on
> > the get-and-analyze efforts and not db administration efforts.
> >
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
http://hadley.nz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Martin Møller Skarbiniks Pedersen
The SQLite is a good database to use.

https://cran.r-project.org/web/packages/RSQLite/vignettes/RSQLite.html

On Mon, Aug 28, 2023, 22:12 Stephen H. Dawson, DSL via R-help <
r-help@r-project.org> wrote:

>
> This is an academic course. The effort now is to nail down the former. I
> am pushing against a local db for the students. I prefer they focus on
> the get-and-analyze efforts and not db administration efforts.
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] biasadj = TRUE in auto.arima...

2023-08-28 Thread akshay kulkarni
dear members,
 I am considering whether to set biasadj = TRUE in 
auto.arima in forecast package. If TRUE, the mean is very nearly equal to the 
original data. So there is no point in doing the transformation at all...

If FALSE, the point forecast is the median which is different from the mean.

So if I have to get more accuracy and gain some thing by the BoxCox 
transformation I have to set the biasadj argument to FALSE.

Am i right?

PLease flag me if this question doesn't belong to R proper and doesn't fit to 
this list.

THanking you,
Yours sincerely,
AKSHAY M KULKARNI

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Stephen H. Dawson, DSL via R-help

Thanks, Bert. I appreciate your helpful assistance.

This is an academic course. The effort now is to nail down the former. I 
am pushing against a local db for the students. I prefer they focus on 
the get-and-analyze efforts and not db administration efforts.



Kindest Regards,
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com


On 8/28/23 13:47, Bert Gunter wrote:
I presume you are familiar with the RSQL and RSQLite packages and 
their vignettes.


Can't offer any help, but a point of clarification:
When you say, "teach accomplishing SQL in R," do you explicitly mean 
using SQL syntax in R to manipulate data or do you mean just doing 
SQL-like types of data manipulation in R? For the former, I assume you 
would be using the above-mentioned packages -- or perhaps others that 
I don't know about like them. For the latter, which I think would be 
subsumed under "data wrangling in R" there are tons of packages, 
tutorials, and books out there that one could search for under that 
rubric. If neither of the above, further clarification might help you 
get a better answer.


Cheers,
Bert

On Mon, Aug 28, 2023 at 8:47 AM Stephen H. Dawson, DSL via R-help 
 wrote:


Good Morning,


I am doing some research to develop a new course where I teach. I am
looking for a book to use in the course content to teach
accomplishing
SQL in R.

Does anyone know of a book on this topic to recommend for
consideration?


Thank You,
-- 
*Stephen Dawson, DSL*

/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Stephen H. Dawson, DSL via R-help

Thanks, Hadley. I appreciate your helpful assistance.


Kindest Regards,
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com


On 8/28/23 14:48, Hadley Wickham wrote:

You might find this chapter of R for Data Science helpful:
https://r4ds.hadley.nz/databases

Hadley

On Tue, Aug 29, 2023 at 3:47 AM Stephen H. Dawson, DSL via R-help
 wrote:

Good Morning,


I am doing some research to develop a new course where I teach. I am
looking for a book to use in the course content to teach accomplishing
SQL in R.

Does anyone know of a book on this topic to recommend for consideration?


Thank You,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Stephen H. Dawson, DSL via R-help

Thanks, Spencer. I appreciate your helpful assistance.


Kindest Regards,
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com


On 8/28/23 15:42, Spencer Graves wrote:

library(sos)
(sql <- findFn('SQL'))


# This opened two tabs in the default browser on my computer just now. 
The second tab lists 298 different packages with help pages containing 
"SQL", sorted to put the package with the most matches first.  The 
first tab lists 1900 different help pages, sorted to put the highest 
ranking package first.



installPackages(sql)


# This installs the highest ranking packages, because the 'sos' code 
knows how to get more information about installed packages than about 
ones that are not installed. To get that information, I followed this 
"installPackages(sql)" with:



sqo


# Hadley Wickham is listed as an author on 14 of those packages. The 
RSQL and RSQLite are numbers 22 and 50 on that list.  RMySQL and 
RPostgreSQL are numbers 48 and 31, respectively.



  If you are looking for course content, I suggest you consider 
using findFn with SQL and applications of greatest interest to your 
target audience.



  Spencer Graves


p.s.  DISCLAIMER:  I'm the lead author and maintainer of the sos package.


On 8/28/23 1:48 PM, Hadley Wickham wrote:

You might find this chapter of R for Data Science helpful:
https://r4ds.hadley.nz/databases

Hadley

On Tue, Aug 29, 2023 at 3:47 AM Stephen H. Dawson, DSL via R-help
 wrote:


Good Morning,


I am doing some research to develop a new course where I teach. I am
looking for a book to use in the course content to teach accomplishing
SQL in R.

Does anyone know of a book on this topic to recommend for 
consideration?



Thank You,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.






__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Spencer Graves

library(sos)
(sql <- findFn('SQL'))


# This opened two tabs in the default browser on my computer just now. 
The second tab lists 298 different packages with help pages containing 
"SQL", sorted to put the package with the most matches first.  The first 
tab lists 1900 different help pages, sorted to put the highest ranking 
package first.



installPackages(sql)


# This installs the highest ranking packages, because the 'sos' code 
knows how to get more information about installed packages than about 
ones that are not installed. To get that information, I followed this 
"installPackages(sql)" with:



sqo


# Hadley Wickham is listed as an author on 14 of those packages. The 
RSQL and RSQLite are numbers 22 and 50 on that list.  RMySQL and 
RPostgreSQL are numbers 48 and 31, respectively.



	  If you are looking for course content, I suggest you consider using 
findFn with SQL and applications of greatest interest to your target 
audience.



  Spencer Graves


p.s.  DISCLAIMER:  I'm the lead author and maintainer of the sos package.


On 8/28/23 1:48 PM, Hadley Wickham wrote:

You might find this chapter of R for Data Science helpful:
https://r4ds.hadley.nz/databases

Hadley

On Tue, Aug 29, 2023 at 3:47 AM Stephen H. Dawson, DSL via R-help
 wrote:


Good Morning,


I am doing some research to develop a new course where I teach. I am
looking for a book to use in the course content to teach accomplishing
SQL in R.

Does anyone know of a book on this topic to recommend for consideration?


Thank You,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.






__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Spencer Graves




On 8/28/23 12:47 PM, Bert Gunter wrote:

I presume you are familiar with the RSQL and RSQLite packages and their
vignettes.

Can't offer any help, but a point of clarification:
When you say, "teach accomplishing SQL in R," do you explicitly mean using
SQL syntax in R to manipulate data or do you mean just doing SQL-like types
of data manipulation in R? For the former, I assume you would be using the
above-mentioned packages -- or perhaps others that I don't know about like
them. For the latter, which I think would be subsumed under "data wrangling
in R" there are tons of packages, tutorials, and books out there that one
could search for under that rubric. If neither of the above, further
clarification might help you get a better answer.

Cheers,
Bert

On Mon, Aug 28, 2023 at 8:47 AM Stephen H. Dawson, DSL via R-help <
r-help@r-project.org> wrote:


Good Morning,


I am doing some research to develop a new course where I teach. I am
looking for a book to use in the course content to teach accomplishing
SQL in R.

Does anyone know of a book on this topic to recommend for consideration?


Thank You,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Hadley Wickham
You might find this chapter of R for Data Science helpful:
https://r4ds.hadley.nz/databases

Hadley

On Tue, Aug 29, 2023 at 3:47 AM Stephen H. Dawson, DSL via R-help
 wrote:
>
> Good Morning,
>
>
> I am doing some research to develop a new course where I teach. I am
> looking for a book to use in the course content to teach accomplishing
> SQL in R.
>
> Does anyone know of a book on this topic to recommend for consideration?
>
>
> Thank You,
> --
> *Stephen Dawson, DSL*
> /Executive Strategy Consultant/
> Business & Technology
> +1 (865) 804-3454
> http://www.shdawson.com
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
http://hadley.nz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Book Recommendation

2023-08-28 Thread Bert Gunter
I presume you are familiar with the RSQL and RSQLite packages and their
vignettes.

Can't offer any help, but a point of clarification:
When you say, "teach accomplishing SQL in R," do you explicitly mean using
SQL syntax in R to manipulate data or do you mean just doing SQL-like types
of data manipulation in R? For the former, I assume you would be using the
above-mentioned packages -- or perhaps others that I don't know about like
them. For the latter, which I think would be subsumed under "data wrangling
in R" there are tons of packages, tutorials, and books out there that one
could search for under that rubric. If neither of the above, further
clarification might help you get a better answer.

Cheers,
Bert

On Mon, Aug 28, 2023 at 8:47 AM Stephen H. Dawson, DSL via R-help <
r-help@r-project.org> wrote:

> Good Morning,
>
>
> I am doing some research to develop a new course where I teach. I am
> looking for a book to use in the course content to teach accomplishing
> SQL in R.
>
> Does anyone know of a book on this topic to recommend for consideration?
>
>
> Thank You,
> --
> *Stephen Dawson, DSL*
> /Executive Strategy Consultant/
> Business & Technology
> +1 (865) 804-3454
> http://www.shdawson.com
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lag.plot showing only lines....

2023-08-28 Thread akshay kulkarni
dear Eric,
Working...! thanks a lot!

THanking you,
Yours sincerely,
AKSHAY M KULKARNI

From: Eric Berger 
Sent: Monday, August 28, 2023 8:37 PM
To: akshay kulkarni 
Cc: R help Mailing list 
Subject: Re: [R] lag.plot showing only lines

Hi Akshay,
I have never used this function before but according to ?lag.plot you
simply need to pass the argument do.lines=FALSE.

HTH,
Eric


On Mon, Aug 28, 2023 at 5:45 PM akshay kulkarni  wrote:
>
> Dear members,
>  I am using the following code:
>
> lag.plot(ygrpch(OHLCData[[i]]),lags=4)
>
> But instead of dots, it is showing lines, which I don't know how to 
> interpret. How to make it plot dots? This is working properly:
>
> lag.plot(na_interpolation(OHLCData[[i]][,4]),lags=4)
>
> I am not attaching the graph here because it would not fit properly. If you 
> want to have a look at the graph, how do i send it?
>
> Thanking you,
> Yours sincerely,
> AKSHAY M KULKARNI
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Book Recommendation

2023-08-28 Thread Stephen H. Dawson, DSL via R-help

Good Morning,


I am doing some research to develop a new course where I teach. I am 
looking for a book to use in the course content to teach accomplishing 
SQL in R.


Does anyone know of a book on this topic to recommend for consideration?


Thank You,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lag.plot showing only lines....

2023-08-28 Thread Eric Berger
Hi Akshay,
I have never used this function before but according to ?lag.plot you
simply need to pass the argument do.lines=FALSE.

HTH,
Eric


On Mon, Aug 28, 2023 at 5:45 PM akshay kulkarni  wrote:
>
> Dear members,
>  I am using the following code:
>
> lag.plot(ygrpch(OHLCData[[i]]),lags=4)
>
> But instead of dots, it is showing lines, which I don't know how to 
> interpret. How to make it plot dots? This is working properly:
>
> lag.plot(na_interpolation(OHLCData[[i]][,4]),lags=4)
>
> I am not attaching the graph here because it would not fit properly. If you 
> want to have a look at the graph, how do i send it?
>
> Thanking you,
> Yours sincerely,
> AKSHAY M KULKARNI
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] lag.plot showing only lines....

2023-08-28 Thread akshay kulkarni
Dear members,
 I am using the following code:

lag.plot(ygrpch(OHLCData[[i]]),lags=4)

But instead of dots, it is showing lines, which I don't know how to interpret. 
How to make it plot dots? This is working properly:

lag.plot(na_interpolation(OHLCData[[i]][,4]),lags=4)

I am not attaching the graph here because it would not fit properly. If you 
want to have a look at the graph, how do i send it?

Thanking you,
Yours sincerely,
AKSHAY M KULKARNI

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Query on finding root

2023-08-28 Thread Ben Bolker
(I mean pdavies)

On Mon, Aug 28, 2023, 7:52 AM Ben Bolker  wrote:

> I would probably use the built in qdavies() function...
>
> On Mon, Aug 28, 2023, 7:48 AM Leonard Mada via R-help <
> r-help@r-project.org> wrote:
>
>> Dear R-Users,
>>
>> Just out of curiosity:
>> Which of the 2 methods is the better one?
>>
>> The results seem to differ slightly.
>>
>>
>> fun = function(u){((26104.50*u^0.03399381)/((1-u)^0.107)) - 28353.7}
>>
>> uniroot(fun, c(0,1))
>> # 0.6048184
>>
>> curve(fun(x), 0, 1)
>> abline(v=0.3952365, col="red")
>> abline(v=0.6048184, col="red")
>> abline(h=0, col="blue")
>>
>>
>>
>> fun = function(u){ (0.03399381*log(u) - 0.107*log(1-u)) -
>> log(28353.7/26104.50) }
>> fun = function(u){ (0.03399381*log(u) - 0.107*log1p(-u)) -
>> log(28353.7/26104.50) }
>>
>> uniroot(fun, c(0,1))
>> # 0.6047968
>>
>> curve(fun(x), 0, 1)
>> abline(v=0.3952365, col="red")
>> abline(v=0.6047968, col="red")
>> abline(h=0, col="blue")
>>
>> Sincerely,
>>
>> Leonard
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Query on finding root

2023-08-28 Thread Ben Bolker
I would probably use the built in qdavies() function...

On Mon, Aug 28, 2023, 7:48 AM Leonard Mada via R-help 
wrote:

> Dear R-Users,
>
> Just out of curiosity:
> Which of the 2 methods is the better one?
>
> The results seem to differ slightly.
>
>
> fun = function(u){((26104.50*u^0.03399381)/((1-u)^0.107)) - 28353.7}
>
> uniroot(fun, c(0,1))
> # 0.6048184
>
> curve(fun(x), 0, 1)
> abline(v=0.3952365, col="red")
> abline(v=0.6048184, col="red")
> abline(h=0, col="blue")
>
>
>
> fun = function(u){ (0.03399381*log(u) - 0.107*log(1-u)) -
> log(28353.7/26104.50) }
> fun = function(u){ (0.03399381*log(u) - 0.107*log1p(-u)) -
> log(28353.7/26104.50) }
>
> uniroot(fun, c(0,1))
> # 0.6047968
>
> curve(fun(x), 0, 1)
> abline(v=0.3952365, col="red")
> abline(v=0.6047968, col="red")
> abline(h=0, col="blue")
>
> Sincerely,
>
> Leonard
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Query on finding root

2023-08-28 Thread Leonard Mada via R-help

Dear R-Users,

Just out of curiosity:
Which of the 2 methods is the better one?

The results seem to differ slightly.


fun = function(u){((26104.50*u^0.03399381)/((1-u)^0.107)) - 28353.7}

uniroot(fun, c(0,1))
# 0.6048184

curve(fun(x), 0, 1)
abline(v=0.3952365, col="red")
abline(v=0.6048184, col="red")
abline(h=0, col="blue")



fun = function(u){ (0.03399381*log(u) - 0.107*log(1-u)) - 
log(28353.7/26104.50) }
fun = function(u){ (0.03399381*log(u) - 0.107*log1p(-u)) - 
log(28353.7/26104.50) }


uniroot(fun, c(0,1))
# 0.6047968

curve(fun(x), 0, 1)
abline(v=0.3952365, col="red")
abline(v=0.6047968, col="red")
abline(h=0, col="blue")

Sincerely,

Leonard

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.